diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 61c26d1c1..82a47b403 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -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 diff --git a/gramps/gen/utils/maclocale.py b/gramps/gen/utils/maclocale.py index 5fe013048..212c6a3d8 100644 --- a/gramps/gen/utils/maclocale.py +++ b/gramps/gen/utils/maclocale.py @@ -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 + [defaults, "read", "-g", "AppleLanguages"], + stderr=open("/dev/null"), + 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(";") diff --git a/gramps/plugins/lib/libhtml.py b/gramps/plugins/lib/libhtml.py index 48ac876ea..fe8a333a0 100644 --- a/gramps/plugins/lib/libhtml.py +++ b/gramps/plugins/lib/libhtml.py @@ -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"'