Provide a sort_order tweak

This commit is contained in:
Charles Haley 2010-12-04 13:06:35 +00:00
parent f8920d18bb
commit 7f6c1712e1
2 changed files with 17 additions and 1 deletions

View File

@ -217,3 +217,15 @@ generate_cover_foot_font = None
# open_viewer, do_nothing, edit_cell. Default: open_viewer.
# Example: doubleclick_on_library_view = 'do_nothing'
doubleclick_on_library_view = 'open_viewer'
# Language to use when sorting. Setting this tweak will force sorting to use the
# collating order for the specified language. This might be useful if you run
# calibre in English but want sorting to work in the language where you live.
# Set the tweak to the desired ISO 639-1 language code, in lower case.
# You can find the list of supported locales at
# http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/nls/rbagsicusortsequencetables.htm
# Default: locale_for_sorting = '' -- use the language calibre displays in
# Example: locale_for_sorting = 'fr' -- sort using French rules.
# Example: locale_for_sorting = 'nb' -- sort using Norwegian rules.
locale_for_sorting = ''

View File

@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en'
from functools import partial
from calibre.constants import plugins
from calibre.utils.config import tweaks
_icu = _collator = None
@ -32,7 +33,10 @@ def load_collator():
if _collator is None:
icu = load_icu()
if icu is not None:
_collator = icu.Collator(get_lang())
if tweaks['locale_for_sorting']:
_collator = icu.Collator(tweaks['locale_for_sorting'])
else:
_collator = icu.Collator(get_lang())
return _collator