From 8895676317fb2dace0be431abf1e385ba1caf8e4 Mon Sep 17 00:00:00 2001 From: "Grant T. Olson" Date: Tue, 20 Aug 2013 08:41:28 -0400 Subject: [PATCH] Fallback to language only localization --- src/bitmessageqt/__init__.py | 14 +++++++++++++- .../{bitmessage_de_DE.pro => bitmessage_de.pro} | 0 .../{bitmessage_de_DE.qm => bitmessage_de.qm} | Bin .../{bitmessage_de_DE.ts => bitmessage_de.ts} | 0 .../{bitmessage_fr_BE.pro => bitmessage_fr.pro} | 0 .../{bitmessage_fr_BE.qm => bitmessage_fr.qm} | Bin .../{bitmessage_fr_BE.ts => bitmessage_fr.ts} | 0 .../{bitmessage_ru_RU.pro => bitmessage_ru.pro} | 0 .../{bitmessage_ru_RU.qm => bitmessage_ru.qm} | Bin .../{bitmessage_ru_RU.ts => bitmessage_ru.ts} | 0 10 files changed, 13 insertions(+), 1 deletion(-) rename src/translations/{bitmessage_de_DE.pro => bitmessage_de.pro} (100%) rename src/translations/{bitmessage_de_DE.qm => bitmessage_de.qm} (100%) rename src/translations/{bitmessage_de_DE.ts => bitmessage_de.ts} (100%) rename src/translations/{bitmessage_fr_BE.pro => bitmessage_fr.pro} (100%) rename src/translations/{bitmessage_fr_BE.qm => bitmessage_fr.qm} (100%) rename src/translations/{bitmessage_fr_BE.ts => bitmessage_fr.ts} (100%) rename src/translations/{bitmessage_ru_RU.pro => bitmessage_ru.pro} (100%) rename src/translations/{bitmessage_ru_RU.qm => bitmessage_ru.qm} (100%) rename src/translations/{bitmessage_ru_RU.ts => bitmessage_ru.ts} (100%) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 378989e0..2d002385 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -3405,8 +3405,20 @@ def run(): app = QtGui.QApplication(sys.argv) translator = QtCore.QTranslator() + lang_countrycode = str(locale.getdefaultlocale()[0]) + translation = "translations/bitmessage_" + lang_countrycode + + if not os.path.isfile(translation + ".pro"): + # Don't have fully localized translation, try language only + lang = lang_countrycode[0:2] + translation = "translations/bitmessage_" + lang + + if not os.path.isfile(translation + ".pro"): + # Don't have language either, default to 'Merica USA! USA! + translation = "translations/bitmessage_en_US" + try: - translator.load("translations/bitmessage_" + str(locale.getdefaultlocale()[0])) + translator.load(translation) #translator.load("translations/bitmessage_fr_BE") # test French except: # The above is not compatible with all versions of OSX. diff --git a/src/translations/bitmessage_de_DE.pro b/src/translations/bitmessage_de.pro similarity index 100% rename from src/translations/bitmessage_de_DE.pro rename to src/translations/bitmessage_de.pro diff --git a/src/translations/bitmessage_de_DE.qm b/src/translations/bitmessage_de.qm similarity index 100% rename from src/translations/bitmessage_de_DE.qm rename to src/translations/bitmessage_de.qm diff --git a/src/translations/bitmessage_de_DE.ts b/src/translations/bitmessage_de.ts similarity index 100% rename from src/translations/bitmessage_de_DE.ts rename to src/translations/bitmessage_de.ts diff --git a/src/translations/bitmessage_fr_BE.pro b/src/translations/bitmessage_fr.pro similarity index 100% rename from src/translations/bitmessage_fr_BE.pro rename to src/translations/bitmessage_fr.pro diff --git a/src/translations/bitmessage_fr_BE.qm b/src/translations/bitmessage_fr.qm similarity index 100% rename from src/translations/bitmessage_fr_BE.qm rename to src/translations/bitmessage_fr.qm diff --git a/src/translations/bitmessage_fr_BE.ts b/src/translations/bitmessage_fr.ts similarity index 100% rename from src/translations/bitmessage_fr_BE.ts rename to src/translations/bitmessage_fr.ts diff --git a/src/translations/bitmessage_ru_RU.pro b/src/translations/bitmessage_ru.pro similarity index 100% rename from src/translations/bitmessage_ru_RU.pro rename to src/translations/bitmessage_ru.pro diff --git a/src/translations/bitmessage_ru_RU.qm b/src/translations/bitmessage_ru.qm similarity index 100% rename from src/translations/bitmessage_ru_RU.qm rename to src/translations/bitmessage_ru.qm diff --git a/src/translations/bitmessage_ru_RU.ts b/src/translations/bitmessage_ru.ts similarity index 100% rename from src/translations/bitmessage_ru_RU.ts rename to src/translations/bitmessage_ru.ts