qt: Some translations have leading / trailing whitespace characters #16814

issue ch4ot1c opened this issue on September 5, 2019
  1. ch4ot1c commented at 11:59 PM on September 5, 2019: contributor

    I know translations are managed on Transifex, but I noticed an oddity: some translations contain untrimmed whitespace.

    Do we need a linter / script to handle these cases?

  2. promag commented at 12:48 AM on September 6, 2019: member

    to handle these cases?

    Handle how?

  3. ch4ot1c commented at 2:03 AM on September 6, 2019: contributor

    to handle these cases?

    Handle how?

    By trimming them. It could happen in Transifex, or when copied to the repo.

  4. fanquake added the label GUI on Sep 6, 2019
  5. fanquake added the label Scripts and tools on Sep 6, 2019
  6. fanquake commented at 6:36 AM on September 6, 2019: member

    Not sure if this is something that needs to be fixed or not. @laanwj is probably the right person to ask. In either case, any sort of trimming would probably be added to the update-translations.py script.

  7. laanwj commented at 9:45 AM on September 6, 2019: member

    Honestly I'd leave it alone unless it causes actual problems for users. Resist the temptation to fix what isn't broken and muck around with spaces.

  8. GChuf commented at 12:44 PM on September 12, 2019: contributor

    The script could look for spaces in first/last characters and remove them, I think that would be a good idea, and it's also not complex to implement. Willing to do work if it'll get implemented - but I also have a PR open for the script already which fixes common errors with format specifiers.

  9. laanwj commented at 8:56 AM on October 1, 2019: member

    Closing this, I don't think this is really an issue.

  10. laanwj closed this on Oct 1, 2019

  11. MarcoFalke commented at 4:15 PM on October 1, 2019: member

    I think this should be fixed, but on transifex via https://docs.transifex.com/setup/setting-translation-checks

  12. GChuf commented at 11:13 AM on October 20, 2019: contributor

    FWIW whitespaces were manually fixed on transifex by me (for a whopping 8kB of disk space gained) but I agree with Marco that we should set up translation checks on transifex.

  13. MarcoFalke commented at 11:36 AM on October 20, 2019: member

    Note that some source strings have trailing whitespace, so removing it will cause alignment issues for the translations.

  14. GChuf commented at 12:23 PM on October 20, 2019: contributor

    @MarcoFalke I found exactly one occurence in bitcoin_en.ts, and I'm thinking it's a typo. Alignments are done by qt, I believe?

    source

  15. MarcoFalke commented at 2:58 PM on October 22, 2019: member

    I found more than 50 instances:

    git grep ' </source>'|wc -l
    54
    
  16. GChuf commented at 8:44 PM on October 22, 2019: contributor

    I checked again and there are 3 trailing whitespaces in bitcoin_en.ts in branch 0.19, as opposed to 1 trailing space in master. Your number 54 corresponds to all trailing spaces from all translation files in src/qt/locale in master.

    Strings in question:

    src/qt/locale/bitcoin_en.ts:        <source>Your wallet is about to be encrypted. </source>
    src/qt/locale/bitcoin_en.ts:        <source>Your wallet is now encrypted. </source>
    src/qt/locale/bitcoin_en.ts:        <source>Wallet: </source>
    

    I see absolutely no reason to add a trailing whitespace to the first 2 strings, and as for wallet - you'll notice there are actually 2 strings being translated: wallet and wallet_. So again, I'm guessing they're all typos.

    Trailing whitespaces should never be translated and we should not rely on them for alignment - this could create multiple problems and is an overall bad idea, and I doubt anyone had this idea in mind when appending those 3 whitespaces. Also, translators have no way of seeing trailing whitespaces on transifex (apart from selecting the source string with the mouse manually), which means noone was ever "translating" them.

  17. MarcoFalke commented at 9:01 PM on October 22, 2019: member

    They are not typos, but oversights of putting trailing whitespace used for formatting into the source message:

    $ git grep 'Your wallet is about to be encrypted. "'
    src/qt/askpassphrasedialog.cpp:                                         tr("Your wallet is about to be encrypted. ") + encryption_reminder +
    

    There are two fixes needed here:

    • A transifex check to enforce the trailing whitespace is preserved
    • (optional) remove the trailing whitespace from the translation source message
  18. MarcoFalke locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me