* src/Utils.py: add xml:lang generation function
* src/docgen/AbiWord2Doc.py: set locale * src/docgen/OpenOfficeDoc: set locale using xml_lang() * src/plugins/NavWebPage.py: set locale svn: r5509
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2005-12-08 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Utils.py: add xml:lang generation function
|
||||||
|
* src/docgen/AbiWord2Doc.py: set locale
|
||||||
|
* src/docgen/OpenOfficeDoc: set locale using xml_lang()
|
||||||
|
* src/plugins/NavWebPage.py: set locale
|
||||||
|
|
||||||
2005-12-08 Alex Roitman <shura@gramps-project.org>
|
2005-12-08 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/Utils.py (probably_alive): return False if any event
|
* src/Utils.py (probably_alive): return False if any event
|
||||||
of the person happened over 150 years ago; (too_old): add
|
of the person happened over 150 years ago; (too_old): add
|
||||||
|
@@ -77,6 +77,15 @@ def fix_encoding(value):
|
|||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
import locale
|
||||||
|
|
||||||
|
def xml_lang():
|
||||||
|
(loc,enc) = locale.getlocale()
|
||||||
|
if loc == None:
|
||||||
|
return ""
|
||||||
|
else:
|
||||||
|
return loc.replace('_','-')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# force_unicode
|
# force_unicode
|
||||||
|
@@ -37,6 +37,7 @@ import Errors
|
|||||||
import PluginMgr
|
import PluginMgr
|
||||||
import ImgManip
|
import ImgManip
|
||||||
import GrampsMime
|
import GrampsMime
|
||||||
|
import Utils
|
||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ class AbiWordDoc(BaseDoc.BaseDoc):
|
|||||||
self.f.write('fileformat="1.1" xmlns:math="http://www.w3.org/1998/Math/MathML" ')
|
self.f.write('fileformat="1.1" xmlns:math="http://www.w3.org/1998/Math/MathML" ')
|
||||||
self.f.write('xmlns:awml="http://www.abisource.com/awml.dtd" xmlns="http://www.abisource.com/awml.dtd" ')
|
self.f.write('xmlns:awml="http://www.abisource.com/awml.dtd" xmlns="http://www.abisource.com/awml.dtd" ')
|
||||||
self.f.write('xmlns:xlink="http://www.w3.org/1999/xlink" version="1.9.1" xml:space="preserve" ')
|
self.f.write('xmlns:xlink="http://www.w3.org/1999/xlink" version="1.9.1" xml:space="preserve" ')
|
||||||
self.f.write('props="lang:en-US; dom-dir:ltr">\n')
|
self.f.write('props="lang:%s; dom-dir:ltr">\n' % Utils.xml_lang())
|
||||||
|
|
||||||
# metadata section
|
# metadata section
|
||||||
self.f.write('<metadata>\n')
|
self.f.write('<metadata>\n')
|
||||||
@@ -324,8 +325,6 @@ class AbiWordDoc(BaseDoc.BaseDoc):
|
|||||||
#
|
#
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
|
|
||||||
import Utils
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
prog = GrampsMime.get_application("application/x-abiword")
|
prog = GrampsMime.get_application("application/x-abiword")
|
||||||
mtype = GrampsMime.get_description('application/x-abiword')
|
mtype = GrampsMime.get_description('application/x-abiword')
|
||||||
|
@@ -44,6 +44,7 @@ import PluginMgr
|
|||||||
import ImgManip
|
import ImgManip
|
||||||
import FontScale
|
import FontScale
|
||||||
import GrampsMime
|
import GrampsMime
|
||||||
|
import Utils
|
||||||
from ReportUtils import pt2cm
|
from ReportUtils import pt2cm
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@@ -103,12 +104,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
assert(self.init_called==False)
|
assert(self.init_called==False)
|
||||||
self.init_called = True
|
self.init_called = True
|
||||||
|
|
||||||
current_locale = locale.getlocale()
|
self.lang = Utils.xml_lang()
|
||||||
self.lang = current_locale[0]
|
|
||||||
if self.lang:
|
|
||||||
self.lang = self.lang.replace('_','-')
|
|
||||||
else:
|
|
||||||
self.lang = "en-US"
|
|
||||||
|
|
||||||
self.cntnt.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
self.cntnt.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||||
self.cntnt.write('<office:document-content ')
|
self.cntnt.write('<office:document-content ')
|
||||||
@@ -998,7 +994,6 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
print_label = None
|
print_label = None
|
||||||
try:
|
try:
|
||||||
import Utils
|
|
||||||
|
|
||||||
mprog = GrampsMime.get_application(_apptype)
|
mprog = GrampsMime.get_application(_apptype)
|
||||||
mtype = GrampsMime.get_description(_apptype)
|
mtype = GrampsMime.get_description(_apptype)
|
||||||
|
@@ -260,7 +260,8 @@ class BasePage:
|
|||||||
of.write('"-//W3C//DTD XHTML 1.0 Strict//EN" ')
|
of.write('"-//W3C//DTD XHTML 1.0 Strict//EN" ')
|
||||||
of.write('"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
|
of.write('"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
|
||||||
of.write('<html xmlns="http://www.w3.org/1999/xhtml" ')
|
of.write('<html xmlns="http://www.w3.org/1999/xhtml" ')
|
||||||
of.write('xml:lang="en" lang="en">\n<head>\n')
|
xmllang = Utils.xml_lang()
|
||||||
|
of.write('xml:lang="%s" lang="%s">\n<head>\n' % (xmllang,xmllang))
|
||||||
of.write('<title>%s - %s</title>\n' % (self.title_str, title))
|
of.write('<title>%s - %s</title>\n' % (self.title_str, title))
|
||||||
of.write('<meta http-equiv="Content-Type" content="text/html; ')
|
of.write('<meta http-equiv="Content-Type" content="text/html; ')
|
||||||
of.write('charset=%s" />\n' % self.encoding)
|
of.write('charset=%s" />\n' % self.encoding)
|
||||||
|
Reference in New Issue
Block a user