Skip to content

Commit 90e0faa

Browse files
committed
Merge #21694: build: Use XLIFF file to provide more context to Transifex translators
35d5239 Add bitcoin_en.xlf intermediate translation file to the repo (Hennadii Stepanov) 99686b6 qt [experimental]: Add a translation comment and a disambiguation string (Hennadii Stepanov) f959b75 build: Add Qt lconvert tool to depends (Hennadii Stepanov) 2045e4c build: Use XLIFF file to provide more context to Transifex translators (Hennadii Stepanov) Pull request description: Currently, only a class name is provided to the Transifex translators as a context. Neither `disambiguation` parameter of the `tr()` function nor [translator comments](https://doc.qt.io/qt-5/i18n-source-translation.html#translator-comments), being included as XML elements to `*.ts` translation files, are not parsed by the Transifex due to its [limited support](https://docs.transifex.com/formats/qt-ts) of such files. This PR makes possible to provide all of the context details via an intermediate [XLIFF](https://docs.transifex.com/formats/xliff) translation file. With this PR `make -C src translate` produces the `src/qt/locale/bitcoin_en.xlf` file which must be provided to the Transifex as a translation source instead of `src/qt/locale/bitcoin_en.ts`. Closes #21465. An example translatable string with additional `<context>` and `<note>` XML elements: https://github.com/bitcoin/bitcoin/blob/35d52397e72f3ab96a7797148666b501d50b445d/src/qt/locale/bitcoin_en.xlf#L126-L132 ACKs for top commit: laanwj: ACK 35d5239 Tree-SHA512: cc19e3c09501d240153550d75d7697b5f824cb553f4223beaff66be4d3e6f98d7b5bb14f2d1e1d5ad014eaaa498a7f672e7ff0054ced53ace8c1e6f7e49f6d8a
2 parents 0180453 + 35d5239 commit 90e0faa

File tree

8 files changed

+6355
-318
lines changed

8 files changed

+6355
-318
lines changed

.tx/config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ host = https://www.transifex.com
33

44
[bitcoin.qt-translation-021x]
55
file_filter = src/qt/locale/bitcoin_<lang>.ts
6-
source_file = src/qt/locale/bitcoin_en.ts
6+
source_file = src/qt/locale/bitcoin_en.xlf
77
source_lang = en

build-aux/m4/bitcoin_qt.m4

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
225225
BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt5 rcc5 rcc], $qt_bin_path)
226226
BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt5 lrelease5 lrelease], $qt_bin_path)
227227
BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes)
228+
BITCOIN_QT_PATH_PROGS([LCONVERT], [lconvert-qt5 lconvert5 lconvert], $qt_bin_path, yes)
228229
229230
MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)'
230231
case $host in
@@ -258,7 +259,10 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
258259
AC_MSG_ERROR([libQtDBus not found. Install libQtDBus or remove --with-qtdbus.])
259260
fi
260261
if test "x$LUPDATE" = x; then
261-
AC_MSG_WARN([lupdate is required to update qt translations])
262+
AC_MSG_WARN([lupdate tool is required to update Qt translations.])
263+
fi
264+
if test "x$LCONVERT" = x; then
265+
AC_MSG_WARN([lconvert tool is required to update Qt translations.])
262266
fi
263267
],[
264268
bitcoin_enable_qt=no

depends/packages/qt.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,23 @@ define $(package)_config_cmds
261261
qtbase/bin/qmake -o qttranslations/Makefile qttranslations/qttranslations.pro && \
262262
qtbase/bin/qmake -o qttranslations/translations/Makefile qttranslations/translations/translations.pro && \
263263
qtbase/bin/qmake -o qttools/src/linguist/lrelease/Makefile qttools/src/linguist/lrelease/lrelease.pro && \
264-
qtbase/bin/qmake -o qttools/src/linguist/lupdate/Makefile qttools/src/linguist/lupdate/lupdate.pro
264+
qtbase/bin/qmake -o qttools/src/linguist/lupdate/Makefile qttools/src/linguist/lupdate/lupdate.pro && \
265+
qtbase/bin/qmake -o qttools/src/linguist/lconvert/Makefile qttools/src/linguist/lconvert/lconvert.pro
265266
endef
266267

267268
define $(package)_build_cmds
268269
$(MAKE) -C qtbase/src $(addprefix sub-,$($(package)_qt_libs)) && \
269270
$(MAKE) -C qttools/src/linguist/lrelease && \
270271
$(MAKE) -C qttools/src/linguist/lupdate && \
272+
$(MAKE) -C qttools/src/linguist/lconvert && \
271273
$(MAKE) -C qttranslations
272274
endef
273275

274276
define $(package)_stage_cmds
275277
$(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \
276278
$(MAKE) -C qttools/src/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install_target && \
277279
$(MAKE) -C qttools/src/linguist/lupdate INSTALL_ROOT=$($(package)_staging_dir) install_target && \
280+
$(MAKE) -C qttools/src/linguist/lconvert INSTALL_ROOT=$($(package)_staging_dir) install_target && \
278281
$(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets
279282
endef
280283

src/Makefile.qt.include

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ $(srcdir)/qt/bitcoinstrings.cpp: FORCE
356356
translate: $(srcdir)/qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) qt/bitcoin.cpp $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
357357
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
358358
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts $(srcdir)/qt/locale/bitcoin_en.ts
359+
@test -n $(LCONVERT) || echo "lconvert is required for updating translations"
360+
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LCONVERT) -o $(srcdir)/qt/locale/bitcoin_en.xlf -i $(srcdir)/qt/locale/bitcoin_en.ts
359361

360362
$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
361363
@test -f $(RCC)

src/qt/addressbookpage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ void AddressBookPage::on_exportButton_clicked()
309309

310310
if(!writer.write()) {
311311
QMessageBox::critical(this, tr("Exporting Failed"),
312-
tr("There was an error trying to save the address list to %1. Please try again.").arg(filename));
312+
//: %1 is a name of the file (e.g., "addrbook.csv") that the bitcoin addresses were exported to.
313+
tr("There was an error trying to save the address list to %1. Please try again.", "An error message.").arg(filename));
313314
}
314315
}
315316

src/qt/bitcoinstrings.cpp

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,53 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
1717
"-maxtxfee is set very high! Fees this large could be paid on a single "
1818
"transaction."),
1919
QT_TRANSLATE_NOOP("bitcoin-core", ""
20+
"Cannot downgrade wallet from version %i to version %i. Wallet version "
21+
"unchanged."),
22+
QT_TRANSLATE_NOOP("bitcoin-core", ""
2023
"Cannot obtain a lock on data directory %s. %s is probably already running."),
2124
QT_TRANSLATE_NOOP("bitcoin-core", ""
2225
"Cannot provide specific connections and have addrman find outgoing "
2326
"connections at the same."),
2427
QT_TRANSLATE_NOOP("bitcoin-core", ""
25-
"Cannot upgrade a non HD split wallet without upgrading to support pre split "
26-
"keypool. Please use version 169900 or no version specified."),
28+
"Cannot upgrade a non HD split wallet from version %i to version %i without "
29+
"upgrading to support pre-split keypool. Please use version %i or no version "
30+
"specified."),
2731
QT_TRANSLATE_NOOP("bitcoin-core", ""
2832
"Distributed under the MIT software license, see the accompanying file %s or "
2933
"%s"),
3034
QT_TRANSLATE_NOOP("bitcoin-core", ""
3135
"Error reading %s! All keys read correctly, but transaction data or address "
3236
"book entries might be missing or incorrect."),
3337
QT_TRANSLATE_NOOP("bitcoin-core", ""
38+
"Error: Dumpfile format record is incorrect. Got \"%s\", expected \"format\"."),
39+
QT_TRANSLATE_NOOP("bitcoin-core", ""
40+
"Error: Dumpfile identifier record is incorrect. Got \"%s\", expected \"%s\"."),
41+
QT_TRANSLATE_NOOP("bitcoin-core", ""
42+
"Error: Dumpfile version is not supported. This version of bitcoin-wallet "
43+
"only supports version 1 dumpfiles. Got dumpfile with version %s"),
44+
QT_TRANSLATE_NOOP("bitcoin-core", ""
3445
"Error: Listening for incoming connections failed (listen returned error %s)"),
3546
QT_TRANSLATE_NOOP("bitcoin-core", ""
3647
"Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -"
3748
"fallbackfee."),
3849
QT_TRANSLATE_NOOP("bitcoin-core", ""
50+
"File %s already exists. If you are sure this is what you want, move it out "
51+
"of the way first."),
52+
QT_TRANSLATE_NOOP("bitcoin-core", ""
3953
"Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay "
4054
"fee of %s to prevent stuck transactions)"),
4155
QT_TRANSLATE_NOOP("bitcoin-core", ""
4256
"More than one onion bind address is provided. Using %s for the automatically "
4357
"created Tor onion service."),
4458
QT_TRANSLATE_NOOP("bitcoin-core", ""
59+
"No dump file provided. To use createfromdump, -dumpfile=<filename> must be "
60+
"provided."),
61+
QT_TRANSLATE_NOOP("bitcoin-core", ""
62+
"No dump file provided. To use dump, -dumpfile=<filename> must be provided."),
63+
QT_TRANSLATE_NOOP("bitcoin-core", ""
64+
"No wallet file format provided. To use createfromdump, -format=<format> must "
65+
"be provided."),
66+
QT_TRANSLATE_NOOP("bitcoin-core", ""
4567
"Please check that your computer's date and time are correct! If your clock "
4668
"is wrong, %s will not work properly."),
4769
QT_TRANSLATE_NOOP("bitcoin-core", ""
@@ -96,10 +118,13 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
96118
"Unable to rewind the database to a pre-fork state. You will need to "
97119
"redownload the blockchain"),
98120
QT_TRANSLATE_NOOP("bitcoin-core", ""
99-
"Warning: Private keys detected in wallet {%s} with disabled private keys"),
121+
"Unknown wallet file format \"%s\" provided. Please provide one of \"bdb\" or "
122+
"\"sqlite\"."),
100123
QT_TRANSLATE_NOOP("bitcoin-core", ""
101-
"Warning: The network does not appear to fully agree! Some miners appear to "
102-
"be experiencing issues."),
124+
"Warning: Dumpfile wallet format \"%s\" does not match command line specified "
125+
"format \"%s\"."),
126+
QT_TRANSLATE_NOOP("bitcoin-core", ""
127+
"Warning: Private keys detected in wallet {%s} with disabled private keys"),
103128
QT_TRANSLATE_NOOP("bitcoin-core", ""
104129
"Warning: We do not appear to fully agree with our peers! You may need to "
105130
"upgrade, or other nodes may need to upgrade."),
@@ -109,7 +134,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
109134
QT_TRANSLATE_NOOP("bitcoin-core", "%s is set very high!"),
110135
QT_TRANSLATE_NOOP("bitcoin-core", "-maxmempool must be at least %d MB"),
111136
QT_TRANSLATE_NOOP("bitcoin-core", "A fatal internal error occurred, see debug.log for details"),
112-
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
113137
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -%s address: '%s'"),
114138
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot set -peerblockfilters without -blockfilterindex."),
115139
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write to data directory '%s'; check permissions."),
@@ -122,6 +146,8 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Could not parse asmap file %s"),
122146
QT_TRANSLATE_NOOP("bitcoin-core", "Disk space is too low!"),
123147
QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"),
124148
QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"),
149+
QT_TRANSLATE_NOOP("bitcoin-core", "Dump file %s does not exist."),
150+
QT_TRANSLATE_NOOP("bitcoin-core", "Error creating %s"),
125151
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"),
126152
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"),
127153
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading %s"),
@@ -131,9 +157,17 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error loading %s: Wallet requires newer versi
131157
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"),
132158
QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"),
133159
QT_TRANSLATE_NOOP("bitcoin-core", "Error reading from database, shutting down."),
160+
QT_TRANSLATE_NOOP("bitcoin-core", "Error reading next record from wallet database"),
134161
QT_TRANSLATE_NOOP("bitcoin-core", "Error upgrading chainstate database"),
162+
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Couldn't create cursor into database"),
135163
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low for %s"),
164+
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Dumpfile checksum does not match. Computed %s, expected %s"),
165+
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Got key that was not hex: %s"),
166+
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Got value that was not hex: %s"),
136167
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Keypool ran out, please call keypoolrefill first"),
168+
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Missing checksum"),
169+
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Unable to parse version %u as a uint32_t"),
170+
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Unable to write record to new wallet"),
137171
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."),
138172
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to rescan the wallet during initialization"),
139173
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to verify database"),
@@ -143,6 +177,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Importing..."),
143177
QT_TRANSLATE_NOOP("bitcoin-core", "Incorrect or no genesis block found. Wrong datadir for network?"),
144178
QT_TRANSLATE_NOOP("bitcoin-core", "Initialization sanity check failed. %s is shutting down."),
145179
QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"),
180+
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -i2psam address or hostname: '%s'"),
146181
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -onion address or hostname: '%s'"),
147182
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address or hostname: '%s'"),
148183
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid P2P permission: '%s'"),
@@ -159,7 +194,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Need to specify a port with -whitebind: '%s'"
159194
QT_TRANSLATE_NOOP("bitcoin-core", "No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>."),
160195
QT_TRANSLATE_NOOP("bitcoin-core", "Not enough file descriptors available."),
161196
QT_TRANSLATE_NOOP("bitcoin-core", "Prune cannot be configured with a negative value."),
162-
QT_TRANSLATE_NOOP("bitcoin-core", "Prune mode is incompatible with -blockfilterindex."),
163197
QT_TRANSLATE_NOOP("bitcoin-core", "Prune mode is incompatible with -txindex."),
164198
QT_TRANSLATE_NOOP("bitcoin-core", "Pruning blockstore..."),
165199
QT_TRANSLATE_NOOP("bitcoin-core", "Reducing -maxconnections from %d to %d, because of system limitations."),
@@ -180,7 +214,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Specified -walletdir \"%s\" is not a director
180214
QT_TRANSLATE_NOOP("bitcoin-core", "Specified blocks directory \"%s\" does not exist."),
181215
QT_TRANSLATE_NOOP("bitcoin-core", "Starting network threads..."),
182216
QT_TRANSLATE_NOOP("bitcoin-core", "The source code is available from %s."),
183-
QT_TRANSLATE_NOOP("bitcoin-core", "The specified config file %s does not exist\n"),
217+
QT_TRANSLATE_NOOP("bitcoin-core", "The specified config file %s does not exist"),
184218
QT_TRANSLATE_NOOP("bitcoin-core", "The transaction amount is too small to pay the fee"),
185219
QT_TRANSLATE_NOOP("bitcoin-core", "The wallet will avoid paying less than the minimum relay fee."),
186220
QT_TRANSLATE_NOOP("bitcoin-core", "This is experimental software."),
@@ -197,6 +231,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer. %s is
197231
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to create the PID file '%s': %s"),
198232
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to generate initial keys"),
199233
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to generate keys"),
234+
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to open %s for writing"),
200235
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to start HTTP server. See debug log for details."),
201236
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -blockfilterindex value %s."),
202237
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown address type '%s'"),

0 commit comments

Comments
 (0)