Use only Qt translation primitives in GUI code#454
Merged
hebasto merged 1 commit intobitcoin-core:masterfrom Oct 22, 2021
Merged
Use only Qt translation primitives in GUI code#454hebasto merged 1 commit intobitcoin-core:masterfrom
hebasto merged 1 commit intobitcoin-core:masterfrom
Conversation
763eb54 to
5908a11
Compare
Use `QObject::tr`, `QT_TR_NOOP`, and `QCoreApplication::translate` as appropriate instead of using `_()` which doesn't get picked up.
5908a11 to
58765a4
Compare
Member
|
Concept ACK. bitcoin/bitcoin#22764 (comment):
|
jarolrod
reviewed
Oct 15, 2021
| InitMessage(splash, title + std::string("\n") + | ||
| (resume_possible ? _("(press q to shutdown and continue later)").translated | ||
| : _("press q to shutdown").translated) + | ||
| (resume_possible ? SplashScreen::tr("(press q to shutdown and continue later)").toStdString() |
Contributor
There was a problem hiding this comment.
Is there a code clarification reason here & L188 to use SplashScreen::tr?
Suggested change
| (resume_possible ? SplashScreen::tr("(press q to shutdown and continue later)").toStdString() | |
| (resume_possible ? QObject::tr("(press q to shutdown and continue later)").toStdString() |
Member
Author
There was a problem hiding this comment.
It's about the context, I thought it was better to have these end up in the QSplashScreen context than QObject which is very general and uninformative.
hebasto
approved these changes
Oct 21, 2021
Member
There was a problem hiding this comment.
ACK 58765a4
My steps to test this PR:
- on master (8a083bc) run
make -C src translateand commit changes - cherry pick this PR commit (58765a4)
- run
make -C src translateagain, and observe the substantial diff in theqt/locale/bitcoin_en.ts:
--- a/src/qt/locale/bitcoin_en.ts
+++ b/src/qt/locale/bitcoin_en.ts
@@ -4203,6 +4203,19 @@ Note: Since the fee is calculated on a per-byte basis, a fee rate of "100
<translation type="unfinished"></translation>
</message>
</context>
+<context>
+ <name>SplashScreen</name>
+ <message>
+ <location filename="../splashscreen.cpp" line="+187"/>
+ <source>(press q to shutdown and continue later)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>press q to shutdown</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
<context>
<name>TrafficGraphWidget</name>
<message>
@@ -5829,5 +5842,15 @@ Go to File > Open Wallet to load a wallet.
<source>Wallet needed to be rewritten: restart %s to complete</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <location filename="../bitcoin.cpp" line="-485"/>
+ <source>Settings file could not be read</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+23"/>
+ <source>Settings file could not be written</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Oct 22, 2021
… code 58765a4 qt: Use only Qt translation primitives in GUI code (W. J. van der Laan) Pull request description: Use `Object::tr`, `QT_TRANSLATE_NOOP`, and `QCoreApplication::translate` as appropriate instead of using `_()` which doesn't get picked up. Replaces bitcoin#22764 Edit: I checked that the strings end up in the appropriate context in `bitcoin_en.ts` after `make translate`: - "Settings file could not be read" "Settings file could not be written" end up in `bitcoin-core` - "(press q to shutdown and continue later)" and "press q to shutdown" end up in `SplashScreen` ACKs for top commit: hebasto: ACK 58765a4 Tree-SHA512: d0cc5901426c47d411d0fe75aac195b9684b51385f74c161da772dbf9f0977f7ad7a0976e17366f49b40718e9b6eb87c3e93306dc845f97adddbc47d00731742
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
Object::tr,QT_TRANSLATE_NOOP, andQCoreApplication::translateas appropriate instead of using_()which doesn't get picked up.Replaces bitcoin/bitcoin#22764
Edit: I checked that the strings end up in the appropriate context in
bitcoin_en.tsaftermake translate:bitcoin-coreSplashScreen