Skip to content
Snippets Groups Projects
Commit 7d507b45 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

translation: fix loading

Change-Id: I5a6647ffca733af93a56767d3db697b86d00f3c7
parent 3dc963d3
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
cd ../install/lrc/lib/cmake/LibRingClient/ cd ../install/lrc
export CMAKE_PREFIX_PATH=$(brew --prefix qt5) export CMAKE_PREFIX_PATH=$(brew --prefix qt5)
export CMAKELRCPATH=`pwd` export CMAKELRCPATH=`pwd`
cd - cd -
......
...@@ -43,16 +43,18 @@ int main(int argc, const char *argv[]) { ...@@ -43,16 +43,18 @@ int main(int argc, const char *argv[]) {
dir.cdUp(); dir.cdUp();
//We need to check if primary language is an English variant (en, en-CA etc...) before installing a translator const auto localeName = QLocale::system().name();
NSString* lang = [[NSLocale preferredLanguages] objectAtIndex:0]; const auto localeLang = localeName.split('_')[0];
if (![lang rangeOfString:@"en"].location != NSNotFound) { auto langPath = dir.absolutePath() + "/Contents/Resources/QtTranslations/lrc_" + localeLang + ".qm";
QTranslator translator; auto localePath = dir.absolutePath() + "/Contents/Resources/QtTranslations/lrc_" + localeName +".qm";
if (translator.load(QLocale::system(), "lrc", "_", dir.absolutePath()+"/Resources/QtTranslations")) { QTranslator lrcTranslatorLang;
app->installTranslator(&translator); QTranslator lrcTranslatorLocale;
} else { if (localeName != localeLang) {
NSLog(@"Couldn't load qt translator"); if (lrcTranslatorLang.load(langPath))
} app->installTranslator(&lrcTranslatorLang);
} }
if (lrcTranslatorLocale.load(localePath))
app->installTranslator(&lrcTranslatorLocale);
GlobalInstances::setPixmapManipulator(std::unique_ptr<Interfaces::ImageManipulationDelegate>(new Interfaces::ImageManipulationDelegate())); GlobalInstances::setPixmapManipulator(std::unique_ptr<Interfaces::ImageManipulationDelegate>(new Interfaces::ImageManipulationDelegate()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment