From 65f779489dd5d247ccf9f5c270c637ebaca0076a Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Tue, 26 Apr 2022 18:16:35 +0530 Subject: [PATCH] partial bitcoin#21694: Use XLIFF file to provide more context to Transifex translators Excludes 35d52397e72f3ab96a7797148666b501d50b445d --- .tx/config | 4 ++-- build-aux/m4/bitcoin_qt.m4 | 6 +++++- depends/packages/qt.mk | 5 ++++- src/Makefile.qt.include | 2 ++ src/qt/addressbookpage.cpp | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.tx/config b/.tx/config index 42bde1a5ed..f20b64d17e 100644 --- a/.tx/config +++ b/.tx/config @@ -1,7 +1,7 @@ [main] host = https://www.transifex.com -[dash.qt-translation-012x] +[dash.qt-translation-018x] file_filter = src/qt/locale/dash_.ts -source_file = src/qt/locale/dash_en.ts +source_file = src/qt/locale/dash_en.xlf source_lang = en diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index 0df2694756..5ec125511b 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -221,6 +221,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt5 rcc5 rcc], $qt_bin_path) BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt5 lrelease5 lrelease], $qt_bin_path) BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes) + BITCOIN_QT_PATH_PROGS([LCONVERT], [lconvert-qt5 lconvert5 lconvert], $qt_bin_path, yes) BITCOIN_QT_CHECK([ AC_CACHE_CHECK([whether $RCC accepts --format-version option], @@ -269,7 +270,10 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ AC_MSG_ERROR([libQtDBus not found. Install libQtDBus or remove --with-qtdbus.]) fi if test "x$LUPDATE" = x; then - AC_MSG_WARN([lupdate is required to update qt translations]) + AC_MSG_WARN([lupdate tool is required to update Qt translations.]) + fi + if test "x$LCONVERT" = x; then + AC_MSG_WARN([lconvert tool is required to update Qt translations.]) fi ],[ bitcoin_enable_qt=no diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 6a3c667f6b..bf13d1e3a7 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -251,13 +251,15 @@ define $(package)_config_cmds qtbase/bin/qmake -o qttranslations/Makefile qttranslations/qttranslations.pro && \ qtbase/bin/qmake -o qttranslations/translations/Makefile qttranslations/translations/translations.pro && \ qtbase/bin/qmake -o qttools/src/linguist/lrelease/Makefile qttools/src/linguist/lrelease/lrelease.pro && \ - qtbase/bin/qmake -o qttools/src/linguist/lupdate/Makefile qttools/src/linguist/lupdate/lupdate.pro + qtbase/bin/qmake -o qttools/src/linguist/lupdate/Makefile qttools/src/linguist/lupdate/lupdate.pro && \ + qtbase/bin/qmake -o qttools/src/linguist/lconvert/Makefile qttools/src/linguist/lconvert/lconvert.pro endef define $(package)_build_cmds $(MAKE) -C qtbase/src $(addprefix sub-,$($(package)_qt_libs)) && \ $(MAKE) -C qttools/src/linguist/lrelease && \ $(MAKE) -C qttools/src/linguist/lupdate && \ + $(MAKE) -C qttools/src/linguist/lconvert && \ $(MAKE) -C qttranslations endef @@ -265,6 +267,7 @@ define $(package)_stage_cmds $(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \ $(MAKE) -C qttools/src/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install_target && \ $(MAKE) -C qttools/src/linguist/lupdate INSTALL_ROOT=$($(package)_staging_dir) install_target && \ + $(MAKE) -C qttools/src/linguist/lconvert INSTALL_ROOT=$($(package)_staging_dir) install_target && \ $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets endef diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index a419bd8afe..5fc6b047be 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -406,6 +406,8 @@ $(srcdir)/qt/dashstrings.cpp: FORCE translate: $(srcdir)/qt/dashstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) qt/dash.cpp $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) @test -n $(LUPDATE) || echo "lupdate is required for updating translations" $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -I$(srcdir) -locations relative -no-obsolete -ts $(srcdir)/qt/locale/dash_en.ts + @test -n $(LCONVERT) || echo "lconvert is required for updating translations" + $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LCONVERT) -o $(srcdir)/qt/locale/dash_en.xlf -i $(srcdir)/qt/locale/dash_en.ts $(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM) @test -f $(RCC) diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 1010a99217..bbb46ca14c 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -321,7 +321,8 @@ void AddressBookPage::on_exportButton_clicked() if(!writer.write()) { QMessageBox::critical(this, tr("Exporting Failed"), - tr("There was an error trying to save the address list to %1. Please try again.").arg(filename)); + //: %1 is a name of the file (e.g., "addrbook.csv") that the bitcoin addresses were exported to. + tr("There was an error trying to save the address list to %1. Please try again.", "An error message.").arg(filename)); } }