Fixed Translation Bug On Task Completeness Question#7208
Open
PiRaNg-1256 wants to merge 1 commit into
Open
Conversation
…entElement.lang and set lang = en as default
|
sumitdahal7
requested changes
May 12, 2026
Collaborator
sumitdahal7
left a comment
There was a problem hiding this comment.
Thanks for the fix. This is worth doing since setting the document lang helps prevent browser auto-translation issues and improves accessibility.
A couple of changes before merge:
- Please normalize the locale before assigning it to
document.documentElement.lang. Some supported
locales use underscores internally, e.g.nl_NLandzh_TW, but HTMLlangexpects BCP 47 tags like
nl-NLandzh-TW.
document.documentElement.lang = locale ? locale.replace(/_/g, '-') : 'en';- App.js already has a root wrapper with lang={locale}. Please either apply the same normalized value
there too, or remove the div-level lang if is now the source of truth. - Please remove the package-lock.json change. This repo uses Yarn (frontend/yarn.lock), and this fix
should not require dependency changes.
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.



What type of PR is this?
Bug Fix
Related Issue
Fixes #7108
Describe this PR
This PR fixes a reported "bizarre" translation issue where Czech users saw incorrect terms like "JOB STATUS" (instead of TASK STATUS), "Again" (instead of Yes), and "Yes" (instead of No).
Root Cause: The application was missing the lang attribute on the element. This caused browsers (specifically Chrome) to attempt auto-detection of the page language. In some cases, the browser incorrectly guessed the language or attempted to auto-translate short strings (like "Ano"/"Ne") into English using incorrect mappings, leading to hallucinations like "Again" and "Yes".
Solution:
index.html: Added a default lang="en" to the tag.
App.js: Added a useEffect hook to dynamically update document.documentElement.lang whenever the application locale changes. This informs the browser exactly what language is being displayed, preventing inappropriate auto-translation triggers.
Review Guide
Open the application and change the language to Czech (or any other language).
Inspect the page source/DOM using Developer Tools.
Verify that the tag has the correct lang attribute (e.g., ).
Switch back to English and verify it updates to .