Fallback to language only localization #423

Merged
grant-olson merged 1 commits from language_only_localization_fallback into master 2013-08-22 05:04:27 +02:00
10 changed files with 13 additions and 1 deletions

View File

@ -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.