Collapse whitespace around color tags in translations - #6611
Closed
RasmusKD wants to merge 1 commit into
Closed
Conversation
A color tag is invisible once rendered, so a translation with
whitespace on both sides of one shows a double space in chat, like
the Danish /fly message: 'Set flytilstand <secondary> {0} <primary>for'
renders as 'flytilstand aktiveret for'. Comparing every locale's
rendered strings against the English source finds the same mistake in
about 400 strings across 38 locales, so fixing it string by string on
Crowdin is not realistic, and new translations keep reintroducing it.
Translated formats now collapse whitespace surrounding a primary or
secondary tag to a single space before the format cache. Strings with
the tag flush against a word on either side are unchanged.
Member
|
This fix should be made in crowdin. If you submit fixes to the strings there they will be accepted. Your example shows the translation is wrong, we do not want to be trimming random spaces from translatables where they may be necessary/intended. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Information
This PR fixes double spaces in translated messages.
A color tag is invisible once rendered, so a translation with whitespace on both sides of one shows a double space in chat. Example from the Danish locale:
The space before
<secondary>and the space after it both survive rendering, so this shows asSet flytilstand aktiveret for WhoToldYou.I compared every locale's rendered strings (tags stripped) against the English source: the same mistake appears in roughly 400 strings across 38 locales (pt 35, tr 26, he 25, uk 23, pt_BR 22, ... da 3). Fixing that string by string on Crowdin is not realistic, and new translations keep reintroducing it, so this handles it at render time instead: translated formats collapse whitespace surrounding a primary/secondary tag to a single space before hitting the format cache. Strings with the tag flush against a word on either side are unchanged.
Checked the transformation against the three affected Danish strings (single spaced afterwards) and a clean string (byte-identical), and I'm running the patched build on a Danish-locale server.