-
Notifications
You must be signed in to change notification settings - Fork 333
Use only Qt translation primitives in GUI code #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use only Qt translation primitives in GUI code #454
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
|
Concept ACK. bitcoin/bitcoin#22764 (comment):
|
| 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a code clarification reason here & L188 to use SplashScreen::tr?
| (resume_possible ? SplashScreen::tr("(press q to shutdown and continue later)").toStdString() | |
| (resume_possible ? QObject::tr("(press q to shutdown and continue later)").toStdString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>… 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
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