Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 07-31-2011, 03:05 PM   #1
Khan-Dam
Enthusiast
Khan-Dam began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2011
Location: France
Device: iPad, Kindle 3, Kobo Glo, Kobo Aura
Question Some questions about my développement of sort_title

Hi again

Folowing m'y post on plugins forum https://www.mobileread.com/forums/sho...d.php?t=143460 i begin to work on this feature
It's very near to be finish but i have some questions :
  • I use tweaks [local_for_sorting] to Know if The hook must be call or not (if value is 'Fr' or not) this tweak are use for other things ?
  • I would use new tweaks, what The way to create new tweak with default value?
  • Now i put them in plugins tweaks part but i don't have default value and user must put them manualy!
  • In using tweaks is it necesary to use try except like in source of title_sort routine?

another thing i use a string to declare sort article like in tweak [title_sort_articles] = '^(A|The|An)\\s+'
i use french article and it's work find unless L' and D' i think it's a encoding problem butt i don't know how to solve that

my string is :
french_sort_articles = '^(Le|La|Les|L'|De|Du|Des|D'|A|Au|Aux|Ce|Ca|Ces)\\ s+'

another thing os there anybody here can lokk my modification to tell me if the writing i mad is correct or not

the last thing is does the sort process use accent letter like plain letter ( without accent) or not ?
thank you in advence to be patient with me i new in python and in calibre world

Last edited by Khan-Dam; 07-31-2011 at 03:14 PM.
Khan-Dam is offline   Reply With Quote
Old 08-04-2011, 04:58 AM   #2
Khan-Dam
Enthusiast
Khan-Dam began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2011
Location: France
Device: iPad, Kindle 3, Kobo Glo, Kobo Aura
nobody can help me ?
Khan-Dam is offline   Reply With Quote
Advert
Old 08-04-2011, 09:07 AM   #3
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I am not sure that I understand all your questions, but I will try to answer anyway.
Quote:
Originally Posted by Khan-Dam View Post
[*]I use tweaks [local_for_sorting] to Know if The hook must be call or not (if value is 'Fr' or not) this tweak are use for other things ?
Do you mean locale_for_sorting? If so, then yes, that tweak is used to control sorting. Different countries sort letters in different orders. See utils/icu.py.
Quote:
[*]I would use new tweaks, what The way to create new tweak with default value?
Put the new tweak into resources/default_tweaks.py. You will see the pattern by looking at the other tweaks.
Quote:
[*]In using tweaks is it necesary to use try except like in source of title_sort routine?
Are you referring to exception handling? If so, then it depends. You have no control over what values the user will put in a tweak. If your code takes that into consideration, then no, you don't need to use an exception block. However, if your code does something like someArray[tweak_value], then you must be prepared for the case that tweak_value is not actually in someArray.
Quote:
another thing i use a string to declare sort article like in tweak [title_sort_articles] = '^(A|The|An)\\s+'
i use french article and it's work find unless L' and D' i think it's a encoding problem butt i don't know how to solve that

my string is :
french_sort_articles = '^(Le|La|Les|L'|De|Du|Des|D'|A|Au|Aux|Ce|Ca|Ces)\\ s+'
The problem is that when does a 'liason', the space after the article goes away. The above regular expression requires a space after the article, which are not there for l' and d'. Instead, use a regular expression such as
Code:
'^(Le |La |Les |L'|De |Du |Des |D'|A |Au |Aux |Ce |Ca |Ces )\\s*'
Also, I think you left off Mon, Ma, M', Mes.
Quote:
the last thing is does the sort process use accent letter like plain letter ( without accent) or not ?
If I understand the question, the answer is that calibre sorts strings using the rules included in the ICU package (http://icu-project.org/). These rules vary, depending on the locale (thus the locale_for_sorting tweak). For example, in French, (I think) Å and A sort together but in Norwegian they sort to the opposite ends of the alphabet. For a good discussion of this, see http://userguide.icu-project.org/collation.

En fin, même s’il est mieux pour la communauté d’écrire en anglaise, s'il y a QQC que j'ai écris que vous ne comprenez pas, vous pouvez poser des questions en français.
chaley is offline   Reply With Quote
Old 08-04-2011, 05:41 PM   #4
Khan-Dam
Enthusiast
Khan-Dam began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2011
Location: France
Device: iPad, Kindle 3, Kobo Glo, Kobo Aura
Ok thanks, i understand all your reply, i try all of this tomorow or sunday !

je poserai mes question en français en plus la prochaine fois.

Merci
Khan-Dam
Khan-Dam is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unutterably Silly I have a question... MJK2111 Lounge 30 07-10-2010 08:25 AM
Classic Few Nook Question and Question on Nook 3G vs WiFi blackonblack Barnes & Noble NOOK 4 07-02-2010 02:07 AM
Looking for another reader question and PRS-600 question lilpretender Which one should I buy? 9 10-24-2009 04:02 AM
iLiad [ILIAD]GTK developpement Olivier78180 iRex Developer's Corner 7 07-14-2008 05:22 PM
Question... Nate the great Amazon Kindle 12 12-14-2007 03:08 PM


All times are GMT -4. The time now is 05:41 PM.


MobileRead.com is a privately owned, operated and funded community.