I am not sure that I understand all your questions, but I will try to answer anyway.
Quote:
Originally Posted by Khan-Dam
[*]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.