* src/DisplayModels.py (column_change): Use localized time string.

* src/PeopleModel.py (column_change): Use localized time string.
* src/RelLib.py (get_change_display): Use localized time string.


svn: r4526
This commit is contained in:
Alex Roitman
2005-05-10 03:34:50 +00:00
parent 0ba4449318
commit f4d716f280
4 changed files with 44 additions and 7 deletions

View File

@@ -1,6 +1,10 @@
2005-05-09 Alex Roitman <shura@gramps-project.org> 2005-05-09 Alex Roitman <shura@gramps-project.org>
* doc/gramps-manual/C/authors.xml: Update. * doc/gramps-manual/C/authors.xml: Update.
* src/DisplayModels.py (column_change): Use localized time string.
* src/PeopleModel.py (column_change): Use localized time string.
* src/RelLib.py (get_change_display): Use localized time string.
2005-05-09 Baruch Even <baruch@ev-en.org> 2005-05-09 Baruch Even <baruch@ev-en.org>
* src/plugins/GraphViz.py (parse_user_options): Use 'justyears'. * src/plugins/GraphViz.py (parse_user_options): Use 'justyears'.

View File

@@ -17,6 +17,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -25,6 +26,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import time import time
from gettext import gettext as _ from gettext import gettext as _
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -44,6 +46,14 @@ import DateHandler
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ] _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
#-------------------------------------------------------------------------
#
# Localized constants
#
#-------------------------------------------------------------------------
_date_format = locale.nl_langinfo(locale.D_T_FMT)
_codeset = locale.nl_langinfo(locale.CODESET)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# BaseModel # BaseModel
@@ -281,7 +291,8 @@ class SourceModel(BaseModel):
return unicode(data[4]) return unicode(data[4])
def column_change(self,data): def column_change(self,data):
return unicode(time.asctime(time.localtime(data[8]))) return unicode(time.strftime(_date_format,time.localtime(data[8])),
_codeset)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -364,7 +375,8 @@ class PlaceModel(BaseModel):
return u'' return u''
def column_change(self,data): def column_change(self,data):
return unicode(time.asctime(time.localtime(data[11]))) return unicode(time.strftime(_date_format,time.localtime(data[11])),
_codeset)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -423,4 +435,5 @@ class MediaModel(BaseModel):
return unicode(data[0]) return unicode(data[0])
def column_change(self,data): def column_change(self,data):
return unicode(time.asctime(time.localtime(data[8]))) return unicode(time.strftime(_date_format,time.localtime(data[8])),
_codeset)

View File

@@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2004 Donald N. Allingham # Copyright (C) 2000-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -47,6 +47,14 @@ import pango
from RelLib import * from RelLib import *
import NameDisplay import NameDisplay
#-------------------------------------------------------------------------
#
# Localized constants
#
#-------------------------------------------------------------------------
_date_format = locale.nl_langinfo(locale.D_T_FMT)
_codeset = locale.nl_langinfo(locale.CODESET)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# constants # constants
@@ -280,7 +288,9 @@ class PeopleModel(gtk.GenericTreeModel):
return data[_ID_COL] return data[_ID_COL]
def column_change(self,data,node): def column_change(self,data,node):
return time.asctime(time.localtime(data[_CHANGE_COL])) return unicode(time.strftime(_date_format,
time.localtime(data[_CHANGE_COL])),
_codeset)
def column_gender(self,data,node): def column_gender(self,data,node):
return _GENDER[data[_GENDER_COL]] return _GENDER[data[_GENDER_COL]]

View File

@@ -34,6 +34,7 @@ from gettext import gettext as _
import os import os
import time import time
import re import re
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -48,13 +49,20 @@ import DateHandler
# Confidence levels # Confidence levels
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
CONF_VERY_HIGH = 4 CONF_VERY_HIGH = 4
CONF_HIGH = 3 CONF_HIGH = 3
CONF_NORMAL = 2 CONF_NORMAL = 2
CONF_LOW = 1 CONF_LOW = 1
CONF_VERY_LOW = 0 CONF_VERY_LOW = 0
#-------------------------------------------------------------------------
#
# Localized constants
#
#-------------------------------------------------------------------------
_date_format = locale.nl_langinfo(locale.D_T_FMT)
_codeset = locale.nl_langinfo(locale.CODESET)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Base classes # Base classes
@@ -231,7 +239,9 @@ class PrimaryObject(BaseObject):
""" """
if self.change: if self.change:
return time.asctime(time.localtime(self.change)) return unicode(time.strftime(_date_format,
time.localtime(self.change)),
_codeset)
else: else:
return '' return ''