GrampsLocale: Correct some differences with trunk
Thanks to Paul Franklin for pointing these out. svn: r21637
This commit is contained in:
parent
901ec7dc5c
commit
cfea1e98dc
@ -199,7 +199,7 @@ class GrampsLocale(object):
|
|||||||
language = []
|
language = []
|
||||||
else:
|
else:
|
||||||
language = [l for l in languages
|
language = [l for l in languages
|
||||||
if l in get_available_translations()]
|
if l in self.get_available_translations()]
|
||||||
|
|
||||||
if mac():
|
if mac():
|
||||||
from . import maclocale
|
from . import maclocale
|
||||||
@ -274,7 +274,7 @@ class GrampsLocale(object):
|
|||||||
self.language = []
|
self.language = []
|
||||||
if languages and len(languages) > 0:
|
if languages and len(languages) > 0:
|
||||||
self.language = [l for l in languages
|
self.language = [l for l in languages
|
||||||
if l in get_available_translations()]
|
if l in self.get_available_translations()]
|
||||||
if len(self.language) == 0:
|
if len(self.language) == 0:
|
||||||
self.language = self._GrampsLocale__first_instance.language
|
self.language = self._GrampsLocale__first_instance.language
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ locale, leaving $LANGUAGE unset (which is the same as setting it to
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, subprocess
|
import sys, os, subprocess
|
||||||
|
|
||||||
def mac_setup_localization(glocale, lang, language):
|
def mac_setup_localization(glocale, lang, language):
|
||||||
"""
|
"""
|
||||||
@ -95,18 +95,21 @@ def mac_setup_localization(glocale, lang, language):
|
|||||||
languages = subprocess.Popen(
|
languages = subprocess.Popen(
|
||||||
[defaults, "read", "-app", "Gramps", "AppleLanguages"],
|
[defaults, "read", "-app", "Gramps", "AppleLanguages"],
|
||||||
stderr=open("/dev/null"),
|
stderr=open("/dev/null"),
|
||||||
stdout=subprocess.PIPE).communicate()[0].strip("()\n").split(",\n")
|
stdout=subprocess.PIPE).communicate()[0]
|
||||||
|
if not sys.version_info[0] < 3:
|
||||||
|
languages = languages.decode("utf-8")
|
||||||
|
languages.strip("()\n").split(",\n")
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if len(languages) == 0 or (len(languages) == 1 and languages[0] == ""):
|
if len(languages) == 0 or (len(languages) == 1 and languages[0] == ""):
|
||||||
# try:
|
|
||||||
languages = subprocess.Popen(
|
languages = subprocess.Popen(
|
||||||
[defaults, "read", "-g", "AppleLanguages"],
|
[defaults, "read", "-g", "AppleLanguages"],
|
||||||
stderr=open("/dev/null"),
|
stderr=open("/dev/null"),
|
||||||
stdout=subprocess.PIPE).communicate()[0].strip("()\n").split(",\n")
|
stdout=subprocess.PIPE).communicate()[0]
|
||||||
# except OSError:
|
if not sys.version_info[0] < 3:
|
||||||
# pass
|
languages = languages.decode("utf-8")
|
||||||
|
languages.strip("()\n").split(",\n")
|
||||||
usable = []
|
usable = []
|
||||||
for lang in languages:
|
for lang in languages:
|
||||||
lang = lang.strip().strip('"').replace("-", "_", 1)
|
lang = lang.strip().strip('"').replace("-", "_", 1)
|
||||||
@ -144,7 +147,7 @@ def mac_setup_localization(glocale, lang, language):
|
|||||||
except OSError:
|
except OSError:
|
||||||
return (locale, calendar, currency)
|
return (locale, calendar, currency)
|
||||||
|
|
||||||
div = default_locale.split("@")
|
div = default_locale.split(b"@")
|
||||||
locale = div[0]
|
locale = div[0]
|
||||||
if len(div) > 1:
|
if len(div) > 1:
|
||||||
div = div[1].split(";")
|
div = div[1].split(";")
|
||||||
|
@ -202,7 +202,7 @@ class Html(list):
|
|||||||
if title is not None:
|
if title is not None:
|
||||||
head += (Html('title', title, inline=True, indent=True))
|
head += (Html('title', title, inline=True, indent=True))
|
||||||
if html5:
|
if html5:
|
||||||
head += Html('meta', charset="utf-8", indent=True)
|
head += Html('meta', charset=encoding, indent=True)
|
||||||
else:
|
else:
|
||||||
meta1 = 'http-equiv="content-type" content="text/html;charset=%s"'
|
meta1 = 'http-equiv="content-type" content="text/html;charset=%s"'
|
||||||
meta2 = 'http-equiv="Content-Style-Type" content="text/css"'
|
meta2 = 'http-equiv="Content-Style-Type" content="text/css"'
|
||||||
|
Loading…
Reference in New Issue
Block a user