Skip to content
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

wallet: Translate [default wallet] string in progress messages #31296

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Nov 15, 2024

Noticed while reviewing #31287 (comment) that the [default wallet] part of progress messages remains untranslated while the rest of the string is translated.

Fix this in all places where CWallet::ShowProgress (which has a cancel button) and Chain::showProgress (which doesn't have a cancel button) are called by making "default wallet" into a translated string.

Noticed while reviewing bitcoin#31287
(bitcoin#31287 (comment)) that the
[default wallet] part of progress messages remains untranslated while the rest
of the string is translated. Fix this in all places where Wallet::ShowProgress
(which has a cancel button) and chain::showProgress (which doesn't have a
cancel button) are called by making "default wallet" into a translated string.

To minimize scope of this bugfix, this introduces a new wallet DisplayName()
method which behaves differently than the existing GetDisplayName() method. The
existing method will be cleaned up in the following commit.
@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 15, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31296.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK hebasto

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31061 (refactor: Check translatable format strings at compile-time by maflcko)
  • #30343 (wallet, logging: Replace WalletLogPrintf() with LogInfo() by ryanofsky)
  • #30221 (wallet: Ensure best block matches wallet scan state by achow101)
  • #28710 (Remove the legacy wallet and BDB dependency by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto
Copy link
Member

hebasto commented Nov 16, 2024

Concept ACK.

@maflcko
Copy link
Member

maflcko commented Nov 17, 2024

What are the steps to test this with sqlite? If it isn't needed after the bdb removal, it can probably be skipped?

The GetDisplayName() method name was confusing because it suggested the return
value could be used for display, while documentation and implementation
indicated it only meant to be used for logging. Also the name didn't suggest
that it was formatting the wallet names, which made it harder understand how
messages were formatted in the places it was called. Fix these issues by
splitting up the GetDisplayName() method and replacing it with LogName() /
DisplayName() methods.

This commit is a refactoring that does not change any behavior.
@ryanofsky
Copy link
Contributor Author

re: #31296 (comment)

What are the steps to test this with sqlite? If it isn't needed after the bdb removal, it can probably be skipped?

Not sure if this will always be the case, but it is currently possible to create an sqlite wallet with no name with bitcoin-cli -regtest createwallet "".

Regardless of the details of the bug though, I think the real problem is that the GetDisplayName() method name suggests it should be used to get wallet names for display while the code comment and implementation suggest it's only meant be used for logging. So I updated the bugfix and added a second refactoring commit to this PR to clean up the interface and prevent this type of problem in the future. That might motivate the PR more beyond the current bugfix.

Updated 87152db -> ebb77ab (pr/dtran.1 -> pr/dtran.2, compare) adding some refactoring after the bugfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants