diff options
-rw-r--r-- | core/qt-init.cpp | 41 | ||||
-rw-r--r-- | packaging/ios/Subsurface-mobile/translations.qrc | 1 | ||||
-rw-r--r-- | translations/CMakeLists.txt | 1 | ||||
-rw-r--r-- | translations/subsurface_en_US.ts | 18 |
4 files changed, 38 insertions, 23 deletions
diff --git a/core/qt-init.cpp b/core/qt-init.cpp index 9eebd8421..1e74e9b07 100644 --- a/core/qt-init.cpp +++ b/core/qt-init.cpp @@ -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; } } diff --git a/packaging/ios/Subsurface-mobile/translations.qrc b/packaging/ios/Subsurface-mobile/translations.qrc index 7a6bade70..43f841814 100644 --- a/packaging/ios/Subsurface-mobile/translations.qrc +++ b/packaging/ios/Subsurface-mobile/translations.qrc @@ -6,6 +6,7 @@ <file>translations/subsurface_de_CH.qm</file> <file>translations/subsurface_de_DE.qm</file> <file>translations/subsurface_en_GB.qm</file> + <file>translations/subsurface_en_US.qm</file> <file>translations/subsurface_es_ES.qm</file> <file>translations/subsurface_et_EE.qm</file> <file>translations/subsurface_fi_FI.qm</file> diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index effa9812f..64a1e6bed 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -13,6 +13,7 @@ set(TRANSLATION_FILES subsurface_de_DE.ts subsurface_el_GR.ts subsurface_en_GB.ts + subsurface_en_US.ts subsurface_es_ES.ts subsurface_et_EE.ts subsurface_fi_FI.ts diff --git a/translations/subsurface_en_US.ts b/translations/subsurface_en_US.ts new file mode 100644 index 000000000..d859792c3 --- /dev/null +++ b/translations/subsurface_en_US.ts @@ -0,0 +1,18 @@ +<?xml version="1.0" ?><!DOCTYPE TS><TS language="en_US" version="2.1"> +<context> + <name>LocationFilterDelegate</name> + <message numerus="yes"> + <location filename="../desktop-widgets/modeldelegates.cpp" line="504"/> + <source>, %n dive(s) here)</source> + <translation><numerusform>, %n dive here)</numerusform><numerusform>, %n dives here)</numerusform></translation> + </message> +</context> +<context> + <name>QObject</name> + <message numerus="yes"> + <location filename="../core/qthelper.cpp" line="997"/> + <source>(%n dive(s))</source> + <translation><numerusform>(%n dive)</numerusform><numerusform>(%n dives)</numerusform></translation> + </message> +</context> +</TS> |