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
Contributor

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
@RasmusKD

RasmusKD commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Fair enough, fixed the Danish ones on Crowdin. The reason I tried code was scale: comparing every locale's rendered strings against the English source found this in ~370 strings across 37 locales, and new translations keep reintroducing it. Crowdin's built-in double-space QA check would catch new ones.

@RasmusKD

RasmusKD commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Done as suggested: batch-submitted the fixes on Crowdin, 359 suggestions across 37 languages (a couple were already suggested by others). They'll need proofreader approval per language.

pull Bot pushed a commit to ImDarkLaw/Essentials that referenced this pull request Aug 22, 2026
Fixes the last double-space string from EssentialsX#6611. This one is in the
English source, so Crowdin can't fix it: alertFormat has spaces on both
sides of <reset> and <primary>, so every alert line shows double spaces.
Italian and Korean already write it without them, the rest copied the
source. I'll fix those on Crowdin after.
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