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 = []
|
||||
else:
|
||||
language = [l for l in languages
|
||||
if l in get_available_translations()]
|
||||
if l in self.get_available_translations()]
|
||||
|
||||
if mac():
|
||||
from . import maclocale
|
||||
@ -274,7 +274,7 @@ class GrampsLocale(object):
|
||||
self.language = []
|
||||
if languages and len(languages) > 0:
|
||||
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:
|
||||
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):
|
||||
"""
|
||||
@ -95,18 +95,21 @@ def mac_setup_localization(glocale, lang, language):
|
||||
languages = subprocess.Popen(
|
||||
[defaults, "read", "-app", "Gramps", "AppleLanguages"],
|
||||
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:
|
||||
pass
|
||||
|
||||
if len(languages) == 0 or (len(languages) == 1 and languages[0] == ""):
|
||||
# try:
|
||||
languages = subprocess.Popen(
|
||||
[defaults, "read", "-g", "AppleLanguages"],
|
||||
stderr=open("/dev/null"),
|
||||
stdout=subprocess.PIPE).communicate()[0].strip("()\n").split(",\n")
|
||||
# except OSError:
|
||||
# pass
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
if not sys.version_info[0] < 3:
|
||||
languages = languages.decode("utf-8")
|
||||
languages.strip("()\n").split(",\n")
|
||||
usable = []
|
||||
for lang in languages:
|
||||
lang = lang.strip().strip('"').replace("-", "_", 1)
|
||||
@ -144,7 +147,7 @@ def mac_setup_localization(glocale, lang, language):
|
||||
except OSError:
|
||||
return (locale, calendar, currency)
|
||||
|
||||
div = default_locale.split("@")
|
||||
div = default_locale.split(b"@")
|
||||
locale = div[0]
|
||||
if len(div) > 1:
|
||||
div = div[1].split(";")
|
||||
|
@ -202,7 +202,7 @@ class Html(list):
|
||||
if title is not None:
|
||||
head += (Html('title', title, inline=True, indent=True))
|
||||
if html5:
|
||||
head += Html('meta', charset="utf-8", indent=True)
|
||||
head += Html('meta', charset=encoding, indent=True)
|
||||
else:
|
||||
meta1 = 'http-equiv="content-type" content="text/html;charset=%s"'
|
||||
meta2 = 'http-equiv="Content-Style-Type" content="text/css"'
|
||||
|
Loading…
Reference in New Issue
Block a user