Skip to content

fix(crowdin): preserve whitespace within translation pipeline - #382

Merged
ReenigneArcher merged 2 commits into
masterfrom
codex/fix-crowdin-whitespace-rendering
Nov 7, 2026
Merged

ReenigneArcher merged 2 commits into
masterfrom
codex/fix-crowdin-whitespace-rendering

Conversation

@ReenigneArcher

Copy link
Copy Markdown
Member

Description

Multiline text around links and inline code loses its boundary spaces when Crowdin renders missing translations. The repair observer then competes with the renderer until the freeze-prevention guard stops repairing the text. In the announcement preview, this produces theLizardByte organization, ThemerrDB/are, and andKokoStreamTV.

Preserve the source boundary whitespace inside the translation pipeline, before i18nextify caches and renders the result. Register a postprocessor for translated strings and wrap the missing-key parser, which i18next calls after postprocessing. Preserve existing handlers, processors, arguments, return values, and initialization context.

Remove the whitespace repair observer and detached-node snapshots. Retain the deferred script loading from #359 and the code-block exclusions from #366; the fix no longer introduces a competing observer that can starve the Doxygen event loop.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

  • Added regression cases for multiline boundaries before and after inline elements, translated and missing-key text, instant translations, nonbreaking spaces, tabs, punctuation, handler forwarding, and idempotent installation. Confirmed the new regression tests fail against the original implementation.
  • Added a Doxygen regression asserting no whitespace MutationObserver is installed, processing does not rewrite the DOM, and platform retries terminate. Existing deferred-loading, script-failure, and code-block exclusion tests remain.
  • npm run test:unit -- --runInBand: 74 tests across 7 suites passed, with 100% statements, branches, functions, and lines.
  • npm run test:lint, npm run build, and git diff --check: passed.
  • Additional local integration check using the live Crowdin bundle in JSDOM and the exact preview article HTML: original code reproduced all three broken joins; fixed code preserved the boundaries through repeated rerenders, a German translation, and restoration to English.
  • Additional local integration check using generated Doxygen HTML and the live Crowdin renderer: five language/highlighter updates preserved preformatted and .fragment markup; DOM mutations settled and timer heartbeats ran.
  • These integration checks exercised the actual renderer in JSDOM; they are not full graphical-browser performance profiling. Hosted checks are pending.
  • Consumers must update their pinned shared-web version after this fix is released.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3287309) to head (40f58f5).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #382   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          196       153   -43     
  Branches        52        41   -11     
=========================================
- Hits           196       153   -43     
Files with missing lines Coverage Δ
src/js/crowdin.js 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3287309...40f58f5. Read the comment docs.

@sonarqubecloud

sonarqubecloud Bot commented Nov 7, 2026

Copy link
Copy Markdown

@ReenigneArcher
ReenigneArcher merged commit 0a3b8a9 into master Nov 7, 2026
15 checks passed
@ReenigneArcher
ReenigneArcher deleted the codex/fix-crowdin-whitespace-rendering branch November 7, 2026 03:04
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.

1 participant