mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add en_US translation for plurals
This way in the en_US locale we no longer get shown the odd "dive(s)" and instead get correct singular and plural forms. Most of the patch is just a reindentation as it removes the if clause that used to do the special case of NOT loading a translation for the en_US case. Right now we start with a trivial en_US translation file. My guess is that this will be overwritten once we do the next round of "new strings, new translations". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6e785a7bfc
commit
ba2b5d8505
4 changed files with 38 additions and 23 deletions
|
@ -40,32 +40,27 @@ void init_qt_late()
|
|||
QString uiLang = uiLanguage(&loc);
|
||||
QLocale::setDefault(loc);
|
||||
|
||||
// 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 (!uiLang.startsWith("en") || uiLang.startsWith("en-GB")) {
|
||||
qtTranslator = new QTranslator;
|
||||
QString translationLocation;
|
||||
qtTranslator = new QTranslator;
|
||||
QString translationLocation;
|
||||
#if defined(Q_OS_ANDROID)
|
||||
translationLocation = QLatin1Literal("assets:/translations");
|
||||
translationLocation = QLatin1Literal("assets:/translations");
|
||||
#elif defined(Q_OS_IOS)
|
||||
translationLocation = QLatin1Literal(":/translations/");
|
||||
translationLocation = QLatin1Literal(":/translations/");
|
||||
#else
|
||||
translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
#endif
|
||||
if (qtTranslator->load(loc, "qt", "_", translationLocation)) {
|
||||
application->installTranslator(qtTranslator);
|
||||
} else {
|
||||
qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << translationLocation;
|
||||
}
|
||||
ssrfTranslator = new QTranslator;
|
||||
if (ssrfTranslator->load(loc, "subsurface", "_") ||
|
||||
ssrfTranslator->load(loc, "subsurface", "_", translationLocation) ||
|
||||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
|
||||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
|
||||
application->installTranslator(ssrfTranslator);
|
||||
} else {
|
||||
qDebug() << "can't find Subsurface localization for locale" << uiLang;
|
||||
}
|
||||
if (qtTranslator->load(loc, "qt", "_", translationLocation)) {
|
||||
application->installTranslator(qtTranslator);
|
||||
} else {
|
||||
qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << translationLocation;
|
||||
}
|
||||
ssrfTranslator = new QTranslator;
|
||||
if (ssrfTranslator->load(loc, "subsurface", "_") ||
|
||||
ssrfTranslator->load(loc, "subsurface", "_", translationLocation) ||
|
||||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
|
||||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
|
||||
application->installTranslator(ssrfTranslator);
|
||||
} else {
|
||||
qDebug() << "can't find Subsurface localization for locale" << uiLang;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue