Make sure we handle untranslated Subsurface correctly

At least on the Mac we otherwise switch to the next language which is not what
the user likely intended.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-10-09 17:55:31 -07:00
parent 1a98e049dc
commit 2d69d4a5ef

View file

@ -85,7 +85,10 @@ void init_ui(int *argcp, char ***argvp)
xslt_path = strdup(getSubsurfaceDataPath("xslt").toAscii().data()); xslt_path = strdup(getSubsurfaceDataPath("xslt").toAscii().data());
QLocale loc; QLocale loc;
if (loc.uiLanguages().first() != "en-US") { // we don't have translations for English - if we don't check for this
// Qt will proceed to load the second language in preference order - not what we want
// on Linux this tends to be en-US, but on the Mac it's just en
if (!loc.uiLanguages().first().startsWith("en")) {
qtTranslator = new QTranslator; qtTranslator = new QTranslator;
if (qtTranslator->load(loc,"qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { if (qtTranslator->load(loc,"qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
application->installTranslator(qtTranslator); application->installTranslator(qtTranslator);