From c1bc80c73912c581d8f6aca18288c85c73e343a8 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 7 Nov 2004 03:02:24 +0000 Subject: [PATCH] * src/DateHandler.py: handle en_GB, en_AU and en_CA locales svn: r3710 --- ChangeLog | 3 +++ src/DateHandler.py | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index faec6b9b2..7f13cee72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2004-11-06 Don Allingham + * src/DateHandler.py: handle en_GB, en_AU and en_CA locales + 2004-11-05 Don Allingham * src/ImageSelect.py: Add date/place property to media objects * src/ReadXML.py: Add date/place property to media objects diff --git a/src/DateHandler.py b/src/DateHandler.py index 93cb331d4..422ed23f8 100644 --- a/src/DateHandler.py +++ b/src/DateHandler.py @@ -45,19 +45,27 @@ import DateDisplay # Constants # #------------------------------------------------------------------------- -_lang = os.environ.get('LANG','C') +_lang = os.environ.get('LANG','C').split('.')[0] _lang_to_parser = { - 'C' : DateParser.DateParser, - 'en_US' : DateParser.DateParser, - 'en_GB' : DateParser.DateParser, + 'C' : DateParser.DateParser, + 'en_US' : DateParser.DateParser, + 'en_GB' : DateParser.DateParser, + 'en_AU' : DateParser.DateParser, + 'en_CA' : DateParser.DateParser, + 'en_SE' : DateParser.DateParser, + 'en' : DateParser.DateParser, } _lang_to_display = { - 'C' : DateDisplay.DateDisplay, - 'en_US' : DateDisplay.DateDisplay, - 'en_GB' : DateDisplay.DateDisplay, + 'C' : DateDisplay.DateDisplay, + 'en_US' : DateDisplay.DateDisplay, + 'en_GB' : DateDisplay.DateDisplay, + 'en_AU' : DateDisplay.DateDisplay, + 'en_CA' : DateDisplay.DateDisplay, + 'en_SE' : DateDisplay.DateDisplay, + 'en' : DateDisplay.DateDisplay, } #------------------------------------------------------------------------- @@ -69,6 +77,7 @@ def create_parser(): try: return _lang_to_parser[_lang]() except: + print "Date parser for",_lang,"not available" return DateParser.DateParser() def create_display(): @@ -76,6 +85,7 @@ def create_display(): val = GrampsGconfKeys.get_date_format(_lang_to_display[_lang].formats) return _lang_to_display[_lang](val) except: + print "Date displayer for",_lang,"not available" return DateDisplay.DateDisplay(3) def get_date_formats():