Revert "enable deferred translation of date format strings"
This reverts commit 715cce27f4a40fe9c0c95e8ed44ed94e890368f6.
This commit is contained in:
parent
0599539d09
commit
1c4d27c2a9
@ -44,10 +44,6 @@ from . import _grampslocale
|
|||||||
from ..utils.grampslocale import GrampsLocale
|
from ..utils.grampslocale import GrampsLocale
|
||||||
from ._datestrings import DateStrings
|
from ._datestrings import DateStrings
|
||||||
|
|
||||||
# _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh
|
|
||||||
def _T_(value): # enable deferred translations (see Python docs 22.1.3.4)
|
|
||||||
return value
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# DateDisplay
|
# DateDisplay
|
||||||
@ -57,31 +53,33 @@ class DateDisplay:
|
|||||||
"""
|
"""
|
||||||
Base date display class.
|
Base date display class.
|
||||||
"""
|
"""
|
||||||
|
_locale = GrampsLocale(lang='en_US', languages='en')
|
||||||
|
|
||||||
_tformat = _grampslocale.tformat
|
_tformat = _grampslocale.tformat
|
||||||
|
|
||||||
|
_ = _grampslocale.glocale.translation.sgettext
|
||||||
formats = (
|
formats = (
|
||||||
# format 0 - must always be ISO
|
# format 0 - must always be ISO
|
||||||
_T_("YYYY-MM-DD (ISO)"),
|
_("YYYY-MM-DD (ISO)"),
|
||||||
|
|
||||||
# format # 1 - must always be locale-preferred numerical format
|
# format # 1 - must always be locale-preferred numerical format
|
||||||
# such as YY.MM.DD, MM-DD-YY, or whatever your locale prefers.
|
# such as YY.MM.DD, MM-DD-YY, or whatever your locale prefers.
|
||||||
# This should be the format that is used under the locale by
|
# This should be the format that is used under the locale by
|
||||||
# strftime() for '%x'.
|
# strftime() for '%x'.
|
||||||
# You may translate this as "Numerical", "System preferred", or similar.
|
# You may translate this as "Numerical", "System preferred", or similar.
|
||||||
_T_("date format|Numerical"),
|
_("date format|Numerical"),
|
||||||
|
|
||||||
# Full month name, day, year
|
# Full month name, day, year
|
||||||
_T_("Month Day, Year"),
|
_("Month Day, Year"),
|
||||||
|
|
||||||
# Abbreviated month name, day, year
|
# Abbreviated month name, day, year
|
||||||
_T_("MON DAY, YEAR"),
|
_("MON DAY, YEAR"),
|
||||||
|
|
||||||
# Day, full month name, year
|
# Day, full month name, year
|
||||||
_T_("Day Month Year"),
|
_("Day Month Year"),
|
||||||
|
|
||||||
# Day, abbreviated month name, year
|
# Day, abbreviated month name, year
|
||||||
_T_("DAY MON YEAR")
|
_("DAY MON YEAR")
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
.. note:: Will be overridden if a locale-specific date displayer exists.
|
.. note:: Will be overridden if a locale-specific date displayer exists.
|
||||||
@ -92,6 +90,7 @@ class DateDisplay:
|
|||||||
This ``formats`` must agree with
|
This ``formats`` must agree with
|
||||||
:meth:`~_display_calendar`/:meth:`~_display_gregorian`.
|
:meth:`~_display_calendar`/:meth:`~_display_gregorian`.
|
||||||
"""
|
"""
|
||||||
|
del _
|
||||||
|
|
||||||
newyear = ("", "Mar1", "Mar25", "Sep1")
|
newyear = ("", "Mar1", "Mar25", "Sep1")
|
||||||
|
|
||||||
@ -729,4 +728,4 @@ class DateDisplayEn(DateDisplay):
|
|||||||
|
|
||||||
display = DateDisplay.display_formatted
|
display = DateDisplay.display_formatted
|
||||||
|
|
||||||
_locale = GrampsLocale(languages='en') # no register_datehandler here
|
_locale = DateDisplay._locale # normally set in register_datehandler
|
||||||
|
@ -34,7 +34,6 @@ import time
|
|||||||
# Gramps modules
|
# Gramps modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
|
||||||
from ..lib.date import Date
|
from ..lib.date import Date
|
||||||
from . import LANG_TO_DISPLAY, LANG, parser, displayer
|
from . import LANG_TO_DISPLAY, LANG, parser, displayer
|
||||||
|
|
||||||
@ -43,22 +42,14 @@ from . import LANG_TO_DISPLAY, LANG, parser, displayer
|
|||||||
# Convenience functions
|
# Convenience functions
|
||||||
#
|
#
|
||||||
#--------------------------------------------------------------
|
#--------------------------------------------------------------
|
||||||
def get_date_formats(flocale=glocale):
|
def get_date_formats():
|
||||||
"""
|
"""
|
||||||
Return the list of supported formats for date parsers and displayers.
|
Return the list of supported formats for date parsers and displayers.
|
||||||
The UI language formats will be used unless another locale is fed in.
|
|
||||||
|
|
||||||
:param flocale: allow deferred translation of date formats
|
|
||||||
:type flocale: a :class:`.GrampsLocale` instance
|
|
||||||
"""
|
"""
|
||||||
# trans_text is a defined keyword (see po/update_po.py, po/genpot.sh)
|
|
||||||
trans_text = flocale.translation.sgettext
|
|
||||||
try:
|
try:
|
||||||
return tuple(trans_text(fmt)
|
return LANG_TO_DISPLAY[LANG].formats
|
||||||
for fmt in LANG_TO_DISPLAY[flocale.lang].formats)
|
|
||||||
except:
|
except:
|
||||||
return tuple(trans_text(fmt)
|
return LANG_TO_DISPLAY["C"].formats
|
||||||
for fmt in LANG_TO_DISPLAY['C'].formats)
|
|
||||||
|
|
||||||
def set_format(value):
|
def set_format(value):
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user