Skip to content

Collapse whitespace around color tags in translations - #6611

Closed
RasmusKD wants to merge 1 commit into
EssentialsX:2.xfrom
RasmusKD:fix-tag-whitespace-double-space
Closed

Collapse whitespace around color tags in translations#6611
RasmusKD wants to merge 1 commit into
EssentialsX:2.xfrom
RasmusKD:fix-tag-whitespace-double-space

Conversation

@RasmusKD

@RasmusKD RasmusKD commented Aug 16, 2026

Copy link
Copy Markdown

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:

flyMode=<primary>Set flytilstand <secondary> {0} <primary>for {1}<primary>.

The space before <secondary> and the space after it both survive rendering, so this shows as Set 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.

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.
@pop4959

pop4959 commented Aug 16, 2026

Copy link
Copy Markdown
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.

@pop4959 pop4959 closed this Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants