Rename translation files

This commit is contained in:
Janek Bevendorff 2021-09-28 10:29:02 +02:00 committed by Janek Bevendorff
parent c198541b6f
commit d375ad14d7
41 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@
host = https://www.transifex.com host = https://www.transifex.com
[keepassxc.keepassxc] [keepassxc.keepassxc]
source_file = share/translations/keepassx_en.ts source_file = share/translations/keepassxc_en.ts
file_filter = share/translations/keepassx_<lang>.ts file_filter = share/translations/keepassxc_<lang>.ts
source_lang = en source_lang = en
type = QT type = QT

View File

@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
file(GLOB TRANSLATION_FILES *.ts) file(GLOB TRANSLATION_FILES *.ts)
get_filename_component(TRANSLATION_EN_ABS keepassx_en.ts ABSOLUTE) get_filename_component(TRANSLATION_EN_ABS keepassxc_en.ts ABSOLUTE)
list(REMOVE_ITEM TRANSLATION_FILES keepassx_en.ts) list(REMOVE_ITEM TRANSLATION_FILES keepassxc_en.ts)
list(REMOVE_ITEM TRANSLATION_FILES ${TRANSLATION_EN_ABS}) list(REMOVE_ITEM TRANSLATION_FILES ${TRANSLATION_EN_ABS})
message(STATUS "Including translations...\n") message(STATUS "Including translations...\n")
@ -35,7 +35,7 @@ set(QM_FILES ${QM_FILES} ${QTBASE_TRANSLATIONS})
install(FILES ${QM_FILES} DESTINATION ${DATA_INSTALL_DIR}/translations) install(FILES ${QM_FILES} DESTINATION ${DATA_INSTALL_DIR}/translations)
# Add keepassx_en.qm as a fallback for uncommon english locales # Add keepassx_en.qm as a fallback for uncommon english locales
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/keepassx_en_US.qm DESTINATION ${DATA_INSTALL_DIR}/translations RENAME keepassx_en.qm) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/keepassxc_en_US.qm DESTINATION ${DATA_INSTALL_DIR}/translations RENAME keepassxc_en.qm)
add_custom_target(translations DEPENDS ${QM_FILES}) add_custom_target(translations DEPENDS ${QM_FILES})
add_dependencies(${PROGNAME} translations) add_dependencies(${PROGNAME} translations)

View File

@ -69,9 +69,9 @@ bool Translator::installTranslator(const QStringList& languages, const QString&
for (const auto& language : languages) { for (const auto& language : languages) {
QLocale locale(language); QLocale locale(language);
QScopedPointer<QTranslator> translator(new QTranslator(qApp)); QScopedPointer<QTranslator> translator(new QTranslator(qApp));
if (translator->load(locale, "keepassx_", "", path)) { if (translator->load(locale, "keepassxc_", "", path)) {
return QCoreApplication::installTranslator(translator.take()); return QCoreApplication::installTranslator(translator.take());
} else if (translator->load(locale, "keepassx_", "", QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { } else if (translator->load(locale, "keepassxc_", "", QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
return QCoreApplication::installTranslator(translator.take()); return QCoreApplication::installTranslator(translator.take());
} }
} }
@ -109,7 +109,7 @@ QList<QPair<QString, QString>> Translator::availableLanguages()
QList<QPair<QString, QString>> languages; QList<QPair<QString, QString>> languages;
languages.append(QPair<QString, QString>("system", "System default")); languages.append(QPair<QString, QString>("system", "System default"));
QRegularExpression regExp("^keepassx_([a-zA-Z_]+)\\.qm$", QRegularExpression::CaseInsensitiveOption); QRegularExpression regExp("^keepassxc_([a-zA-Z_]+)\\.qm$", QRegularExpression::CaseInsensitiveOption);
const QStringList fileList = QDir(resources()->dataPath("translations")).entryList(); const QStringList fileList = QDir(resources()->dataPath("translations")).entryList();
for (const QString& filename : fileList) { for (const QString& filename : fileList) {
QRegularExpressionMatch match = regExp.match(filename); QRegularExpressionMatch match = regExp.match(filename);