From 611cb1f94c59c14cad9aca5038cc13dd0143da85 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 29 Jun 2017 06:25:49 -0400 Subject: [PATCH 1/4] i18n: QT_TRANSLATIONS_DIR hasn't been set since Qt 5.3. None of the Qt translations are found, nor shipped along with the Calamares translations; it depends on the translations of Qt on the live system. The mechanism was broken, anyway, by the split into qt_.qm and qtbase_.qm, and the introduction for QPT for the translation of standard button texts. Just drop the special code looking for Qt translations and the rcc hacks that entails. FIXES #336 --- lang/translations.cmake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lang/translations.cmake b/lang/translations.cmake index dddad3149..fc18f4f11 100644 --- a/lang/translations.cmake +++ b/lang/translations.cmake @@ -7,12 +7,6 @@ macro(add_calamares_translations language) set( calamares_i18n_qrc_content "${calamares_i18n_qrc_content}\n" ) foreach( lang ${CALAMARES_LANGUAGES} ) set( calamares_i18n_qrc_content "${calamares_i18n_qrc_content}calamares_${lang}.qm\n" ) - if( NOT lang STREQUAL "en" AND EXISTS ${QT_TRANSLATIONS_DIR}/qt_${lang}.qm ) - file( COPY ${QT_TRANSLATIONS_DIR}/qt_${lang}.qm DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) - set( calamares_i18n_qrc_content "${calamares_i18n_qrc_content}qt_${lang}.qm\n" ) - endif() - - # build explicitly enabled languages list( APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/calamares_${lang}.ts" ) endforeach() From 75b5303b49f3fb2eb9f2de408875ca8126b5ead1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 29 Jun 2017 06:29:29 -0400 Subject: [PATCH 2/4] i18n: stop trying to install Qt translations --- src/libcalamares/utils/CalamaresUtils.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtils.cpp b/src/libcalamares/utils/CalamaresUtils.cpp index 9df222217..db748ec94 100644 --- a/src/libcalamares/utils/CalamaresUtils.cpp +++ b/src/libcalamares/utils/CalamaresUtils.cpp @@ -47,7 +47,6 @@ static bool s_isAppDataDirOverridden = false; static QTranslator* s_brandingTranslator = nullptr; static QTranslator* s_translator = nullptr; -static QTranslator* s_qtTranslator = nullptr; static QString s_translatorLocaleName; @@ -207,25 +206,6 @@ installTranslator( const QLocale& locale, QCoreApplication::installTranslator( translator ); s_translator = translator; - // Qt translations - translator = new QTranslator( parent ); - if ( translator->load( QString( ":/lang/qt_" ) + localeName ) ) - { - qDebug() << "Translation: Qt: Using system locale:" << localeName; - } - else - { - qDebug() << "Translation: Qt: Using default locale, system locale one not found:" << localeName; - } - - if ( s_qtTranslator ) - { - QCoreApplication::removeTranslator( s_qtTranslator ); - delete s_qtTranslator; - } - QCoreApplication::installTranslator( translator ); - s_qtTranslator = translator; - s_translatorLocaleName = localeName; } From 4885b4afec73c8b821607341f59764d4b454afa6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jul 2017 05:23:58 -0400 Subject: [PATCH 3/4] i18n: reduce noise-only commits from Transifex --- ci/txpull.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/txpull.sh b/ci/txpull.sh index 44a7d846b..624da0bd4 100755 --- a/ci/txpull.sh +++ b/ci/txpull.sh @@ -10,16 +10,22 @@ git config --global http.sslVerify false export QT_SELECT=5 tx pull --force --source --all + git add --verbose lang/calamares*.ts git commit --author='Calamares CI ' --message='[core] Automatic merge of Transifex translations' | true +# Transifex updates the PO-Created timestamp also when nothing interesting +# has happened, so drop the files which have just 1 line changed (the +# PO-Created line). This applies only to modules which use po-files. +git diff --numstat src/modules | awk '($1==1 && $2==1){print $3}' | xargs git checkout -- + for MODULE_DIR in `find src/modules -maxdepth 1 -mindepth 1 -type d`; do FILES=(${MODULE_DIR}/*.py) if [ ${#FILES[@]} -gt 0 ]; then MODULE_NAME=$(basename ${MODULE_DIR}) if [ -d ${MODULE_DIR}/lang ]; then # Convert PO files to MO files - for POFILE in `find . -name "*.po"` ; do + for POFILE in `find ${MODULE_DIR} -name "*.po"` ; do msgfmt -o ${POFILE/.po/.mo} $POFILE done git add --verbose ${MODULE_DIR}/lang/* From 9b3af4aac3b3335594ff9d0a8b3f0ac8cceb2624 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jul 2017 05:40:53 -0400 Subject: [PATCH 4/4] i18n: translate yes/no buttons, don't rely on Qt translations --- src/libcalamaresui/ViewManager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 98476767c..7c9f1897d 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -94,12 +94,16 @@ ViewManager::ViewManager( QObject* parent ) if ( !( m_currentStep == m_steps.count() -1 && m_steps.last()->isAtEnd() ) ) { - int response = QMessageBox::question( m_widget, + QMessageBox mb( QMessageBox::Question, tr( "Cancel installation?" ), tr( "Do you really want to cancel the current install process?\n" "The installer will quit and all changes will be lost." ), QMessageBox::Yes | QMessageBox::No, - QMessageBox::No ); + m_widget ); + mb.setDefaultButton( QMessageBox::No ); + mb.button( QMessageBox::Yes )->setText( tr( "&Yes" ) ); + mb.button( QMessageBox::No )->setText( tr( "&No" ) ); + int response = mb.exec(); if ( response == QMessageBox::Yes ) qApp->quit(); }