Merge pull request #423 from grant-olson/language_only_localization_fallback

Fallback to language only localization
This commit is contained in:
Jonathan Warren 2013-08-21 20:04:26 -07:00
commit 28b6b743e3
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.