2006-03-11 10:28:58 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-08-17 22:39:54 +05:30
|
|
|
# Copyright (C) 2004-2007 Donald N. Allingham
|
2006-03-11 10:28:58 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2007-06-27 10:20:33 +05:30
|
|
|
# This program is distributed in the hope that it will be useful,
|
2006-03-11 10:28:58 +05:30
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2008-01-22 14:47:46 +05:30
|
|
|
# $Id$
|
2006-03-11 10:28:58 +05:30
|
|
|
|
|
|
|
"""
|
|
|
|
Class handling language-specific selection for date parser and displayer.
|
|
|
|
"""
|
2006-05-15 01:44:59 +05:30
|
|
|
|
|
|
|
# import prerequisites for localized handlers
|
2008-02-19 01:37:09 +05:30
|
|
|
from _DateHandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY,
|
|
|
|
register_datehandler)
|
2006-05-15 01:44:59 +05:30
|
|
|
|
|
|
|
# Import all the localized handlers
|
2009-08-10 20:30:29 +05:30
|
|
|
import _Date_ca
|
2007-12-10 18:40:13 +05:30
|
|
|
import _Date_cs
|
2006-03-11 10:28:58 +05:30
|
|
|
import _Date_de
|
|
|
|
import _Date_es
|
|
|
|
import _Date_fi
|
|
|
|
import _Date_fr
|
2009-08-10 20:30:29 +05:30
|
|
|
import _Date_hr
|
|
|
|
import _Date_it
|
2006-03-11 10:28:58 +05:30
|
|
|
import _Date_lt
|
2007-11-28 01:44:04 +05:30
|
|
|
import _Date_nb
|
2006-03-11 10:28:58 +05:30
|
|
|
import _Date_nl
|
2007-08-17 22:39:54 +05:30
|
|
|
import _Date_pl
|
2007-10-11 21:03:30 +05:30
|
|
|
import _Date_pt
|
2008-02-19 01:37:09 +05:30
|
|
|
import _Date_ru
|
|
|
|
import _Date_sk
|
2009-08-10 20:30:29 +05:30
|
|
|
import _Date_sr
|
2008-02-19 01:37:09 +05:30
|
|
|
import _Date_sv
|
2006-05-15 01:44:59 +05:30
|
|
|
|
|
|
|
# Initialize global parser
|
|
|
|
try:
|
2008-07-17 23:40:32 +05:30
|
|
|
if LANG in LANG_TO_PARSER:
|
2007-06-27 10:20:33 +05:30
|
|
|
parser = LANG_TO_PARSER[LANG]()
|
2006-05-15 01:44:59 +05:30
|
|
|
else:
|
2007-06-27 10:20:33 +05:30
|
|
|
parser = LANG_TO_PARSER[LANG_SHORT]()
|
2006-05-15 01:44:59 +05:30
|
|
|
except:
|
2007-06-27 10:20:33 +05:30
|
|
|
print "Date parser for", LANG, "not available, using default"
|
|
|
|
parser = LANG_TO_PARSER["C"]()
|
2006-05-15 01:44:59 +05:30
|
|
|
|
|
|
|
# Initialize global displayer
|
|
|
|
try:
|
2009-10-08 06:42:51 +05:30
|
|
|
import config
|
|
|
|
val = config.get('preferences.date-format')
|
2006-05-15 01:44:59 +05:30
|
|
|
except:
|
2009-10-08 06:42:51 +05:30
|
|
|
val = 0
|
2006-05-15 01:44:59 +05:30
|
|
|
|
|
|
|
try:
|
2008-07-17 23:40:32 +05:30
|
|
|
if LANG in LANG_TO_DISPLAY:
|
2007-06-27 10:20:33 +05:30
|
|
|
displayer = LANG_TO_DISPLAY[LANG](val)
|
2006-05-15 01:44:59 +05:30
|
|
|
else:
|
2007-06-27 10:20:33 +05:30
|
|
|
displayer = LANG_TO_DISPLAY[LANG_SHORT](val)
|
2006-05-15 01:44:59 +05:30
|
|
|
except:
|
2007-06-27 10:20:33 +05:30
|
|
|
print "Date displayer for", LANG, "not available, using default"
|
|
|
|
displayer = LANG_TO_DISPLAY["C"](val)
|
2006-05-15 01:44:59 +05:30
|
|
|
|
2006-03-11 10:28:58 +05:30
|
|
|
|
2006-05-15 01:44:59 +05:30
|
|
|
# Import utility functions
|
|
|
|
from _DateUtils import *
|