Fallback to language only localization

This commit is contained in:
Grant T. Olson 2013-08-20 08:41:28 -04:00
parent 7772484da9
commit 8895676317
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.