Changeset ba2b5d85 in subsurface


Ignore:
Timestamp:
Jun 22, 2017, 4:19:23 AM (5 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
1d2bcff
Parents:
6e785a7
git-author:
Dirk Hohndel <dirk@…> (06/22/17 03:38:09)
git-committer:
Dirk Hohndel <dirk@…> (06/22/17 04:19:23)
Message:

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@…>

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • core/qt-init.cpp

    rb368ecd rba2b5d85  
    4141        QLocale::setDefault(loc);
    4242
    43         // we don't have translations for English - if we don't check for this
    44         // Qt will proceed to load the second language in preference order - not what we want
    45         // on Linux this tends to be en-US, but on the Mac it's just en
    46         if (!uiLang.startsWith("en") || uiLang.startsWith("en-GB")) {
    47                 qtTranslator = new QTranslator;
    48                 QString translationLocation;
     43        qtTranslator = new QTranslator;
     44        QString translationLocation;
    4945#if defined(Q_OS_ANDROID)
    50                 translationLocation = QLatin1Literal("assets:/translations");
     46        translationLocation = QLatin1Literal("assets:/translations");
    5147#elif defined(Q_OS_IOS)
    52                 translationLocation = QLatin1Literal(":/translations/");
     48        translationLocation = QLatin1Literal(":/translations/");
    5349#else
    54                 translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
     50        translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
    5551#endif
    56                 if (qtTranslator->load(loc, "qt", "_", translationLocation)) {
    57                         application->installTranslator(qtTranslator);
    58                 } else {
    59                         qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << translationLocation;
    60                 }
    61                 ssrfTranslator = new QTranslator;
    62                 if (ssrfTranslator->load(loc, "subsurface", "_") ||
    63                     ssrfTranslator->load(loc, "subsurface", "_", translationLocation) ||
    64                     ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
    65                     ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
    66                         application->installTranslator(ssrfTranslator);
    67                 } else {
    68                         qDebug() << "can't find Subsurface localization for locale" << uiLang;
    69                 }
     52        if (qtTranslator->load(loc, "qt", "_", translationLocation)) {
     53                application->installTranslator(qtTranslator);
     54        } else {
     55                qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << translationLocation;
     56        }
     57        ssrfTranslator = new QTranslator;
     58        if (ssrfTranslator->load(loc, "subsurface", "_") ||
     59            ssrfTranslator->load(loc, "subsurface", "_", translationLocation) ||
     60            ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
     61            ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
     62                application->installTranslator(ssrfTranslator);
     63        } else {
     64                qDebug() << "can't find Subsurface localization for locale" << uiLang;
    7065        }
    7166}
  • packaging/ios/Subsurface-mobile/translations.qrc

    r42eee8a rba2b5d85  
    77        <file>translations/subsurface_de_DE.qm</file>
    88        <file>translations/subsurface_en_GB.qm</file>
     9        <file>translations/subsurface_en_US.qm</file>
    910        <file>translations/subsurface_es_ES.qm</file>
    1011        <file>translations/subsurface_et_EE.qm</file>
  • translations/CMakeLists.txt

    r7e099d5a rba2b5d85  
    1414        subsurface_el_GR.ts
    1515        subsurface_en_GB.ts
     16        subsurface_en_US.ts
    1617        subsurface_es_ES.ts
    1718        subsurface_et_EE.ts
Note: See TracChangeset for help on using the changeset viewer.