parent
26b78c17af
commit
06732b1b5d
@ -35,6 +35,7 @@ import logging
|
|||||||
# Gramps modules
|
# Gramps modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
from ..utils.grampslocale import GrampsLocale
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.sgettext
|
_ = glocale.translation.sgettext
|
||||||
# import prerequisites for localized handlers
|
# import prerequisites for localized handlers
|
||||||
@ -72,16 +73,20 @@ from . import _date_uk
|
|||||||
from . import _date_zh_CN
|
from . import _date_zh_CN
|
||||||
from . import _date_zh_TW
|
from . import _date_zh_TW
|
||||||
|
|
||||||
|
# the following makes sure we use the LC_TIME value for date display & parsing
|
||||||
|
dlocale = GrampsLocale(lang=glocale.calendar)
|
||||||
|
|
||||||
|
|
||||||
# Initialize global parser
|
# Initialize global parser
|
||||||
try:
|
try:
|
||||||
if LANG in LANG_TO_PARSER:
|
if LANG in LANG_TO_PARSER:
|
||||||
parser = LANG_TO_PARSER[LANG](plocale=glocale)
|
parser = LANG_TO_PARSER[LANG](plocale=dlocale)
|
||||||
else:
|
else:
|
||||||
parser = LANG_TO_PARSER[LANG_SHORT](plocale=glocale)
|
parser = LANG_TO_PARSER[LANG_SHORT](plocale=dlocale)
|
||||||
except:
|
except:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
_("Date parser for '%s' not available, using default") % LANG)
|
_("Date parser for '%s' not available, using default") % LANG)
|
||||||
parser = LANG_TO_PARSER["C"](plocale=glocale)
|
parser = LANG_TO_PARSER["C"](plocale=dlocale)
|
||||||
|
|
||||||
# Initialize global displayer
|
# Initialize global displayer
|
||||||
try:
|
try:
|
||||||
@ -92,13 +97,13 @@ except:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if LANG in LANG_TO_DISPLAY:
|
if LANG in LANG_TO_DISPLAY:
|
||||||
displayer = LANG_TO_DISPLAY[LANG](val, blocale=glocale)
|
displayer = LANG_TO_DISPLAY[LANG](val, blocale=dlocale)
|
||||||
else:
|
else:
|
||||||
displayer = LANG_TO_DISPLAY[LANG_SHORT](val, blocale=glocale)
|
displayer = LANG_TO_DISPLAY[LANG_SHORT](val, blocale=dlocale)
|
||||||
except:
|
except:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
_("Date displayer for '%s' not available, using default") % LANG)
|
_("Date displayer for '%s' not available, using default") % LANG)
|
||||||
displayer = LANG_TO_DISPLAY["C"](val, blocale=glocale)
|
displayer = LANG_TO_DISPLAY["C"](val, blocale=dlocale)
|
||||||
|
|
||||||
|
|
||||||
# Import utility functions
|
# Import utility functions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user