Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion i18n/NotepadNext_cs_CZ.ts → i18n/NotepadNext_cs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="cs_CZ">
<TS version="2.1" language="cs">
<context>
<name>AuthenticateDialog</name>
<message>
Expand Down
2 changes: 1 addition & 1 deletion i18n/NotepadNext_es_NI.ts → i18n/NotepadNext_es.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="es_NI">
<TS version="2.1" language="es">
<context>
<name>AuthenticateDialog</name>
<message>
Expand Down
2 changes: 1 addition & 1 deletion i18n/NotepadNext_pl_PL.ts → i18n/NotepadNext_pl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="pl_PL">
<TS version="2.1" language="pl">
<context>
<name>AuthenticateDialog</name>
<message>
Expand Down
2 changes: 1 addition & 1 deletion i18n/NotepadNext_ru_RU.ts → i18n/NotepadNext_ru.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<TS version="2.1" language="ru">
<context>
<name>AuthenticateDialog</name>
<message>
Expand Down
2 changes: 1 addition & 1 deletion i18n/NotepadNext_sv_SE.ts → i18n/NotepadNext_sv.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="sv_SE">
<TS version="2.1" language="sv">
<context>
<name>AuthenticateDialog</name>
<message>
Expand Down
2 changes: 1 addition & 1 deletion i18n/NotepadNext_tr_TR.ts → i18n/NotepadNext_tr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="tr_TR">
<TS version="2.1" language="tr">
<context>
<name>AuthenticateDialog</name>
<message>
Expand Down
2 changes: 1 addition & 1 deletion i18n/NotepadNext_uk_UA.ts → i18n/NotepadNext_uk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="uk_UA">
<TS version="2.1" language="uk">
<context>
<name>AuthenticateDialog</name>
<message>
Expand Down
2 changes: 1 addition & 1 deletion src/NotepadNext/TranslationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ QString TranslationManager::FormatLocaleTerritoryAndLanguage(QLocale &locale)
const QString territory = QLocale::territoryToString(locale.territory());
#endif
const QString language = QLocale::languageToString(locale.language());
return QStringLiteral("%1 / %2").arg(language, territory);
return QStringLiteral("%1 (%2)").arg(language, territory);
}

void TranslationManager::loadSystemDefaultTranslation()
Expand Down
4 changes: 2 additions & 2 deletions src/NotepadNext/dialogs/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ void PreferencesDialog::populateTranslationComboBox()
NotepadNextApplication *app = qobject_cast<NotepadNextApplication *>(qApp);

// Add the system default at the top
ui->comboBoxTranslation->addItem(QStringLiteral("%1 (%2)").arg(tr("<System Default>"), QLocale::system().name()), QStringLiteral(""));
ui->comboBoxTranslation->addItem(tr("<System Default>"), QStringLiteral(""));

// TODO: sort this list and keep the system default at the top
for (const auto &localeName : app->getTranslationManager()->availableTranslations())
{
QLocale locale(localeName);
const QString localeDisplay = TranslationManager::FormatLocaleTerritoryAndLanguage(locale);
ui->comboBoxTranslation->addItem(QStringLiteral("%1 (%2)").arg(localeDisplay, localeName), localeName);
ui->comboBoxTranslation->addItem(localeDisplay, localeName);
}

// Select the current one
Expand Down
16 changes: 11 additions & 5 deletions src/i18n.pri
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ for(TS_FILE, TS_FILES) {
# Add the application translation file
TRANSLATIONS += $$TS_FILE

FILE_NAME = $$basename(TS_FILE)

# Extract the locale from the file name (e.g. NotepadNext_pl_PL.ts to pl_PL)
LOCALE = $$str_member($$TS_FILE, -8, -4)
LOCALE = $$replace(FILE_NAME, "NotepadNext_(..)(\\_..)?\\.ts", "\\1\\2")

# Extra translation files that include both the language and translation
# Extra Qt translation files
EXTRA_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qt_$${LOCALE}.qm)
EXTRA_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qtbase_$${LOCALE}.qm)

# Check for files without the territory specified (e.g. pl)
LANGUAGE = $$replace(LOCALE, "(..).*", "\\1")
EXTRA_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qt_$${LANGUAGE}.qm)
EXTRA_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qtbase_$${LANGUAGE}.qm)
greaterThan($$str_size(LOCALE), 2) {
LANGUAGE = $$replace(LOCALE, "(..).*", "\\1")
EXTRA_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qt_$${LANGUAGE}.qm)
EXTRA_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qtbase_$${LANGUAGE}.qm)
}
}

message("EXTRA_TRANSLATIONS: $$EXTRA_TRANSLATIONS")