Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-31-2011, 04:05 PM   #1
Khan-Dam
Enthusiast
Khan-Dam began at the beginning.
 
Posts: 37
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 http://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 04:14 PM.
Khan-Dam is offline   Reply With Quote
Old 08-04-2011, 05:58 AM   #2
Khan-Dam
Enthusiast
Khan-Dam began at the beginning.
 
Posts: 37
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
Old 08-04-2011, 10:07 AM   #3
chaley
"chaley", not "charley"
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: 5,783
Karma: 1212746
Join Date: Jan 2010
Location: France
Device: Many android devices
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, 06:41 PM   #4
Khan-Dam
Enthusiast
Khan-Dam began at the beginning.
 
Posts: 37
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 02:08 AM.


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