fix(client): silence noisy LangSelector not found console warning (#4021)

## Description: 

Silence noisy console warnings of `LangSelector not found in DOM` on
page hydration.

Previously, `translateText()` queried the DOM very early in the client
rendering/hydration phase before Lit Element had mounted the
`<lang-selector>` element. This resulted in hundreds of noisy warnings
in the browser developer console on page load.

This fix resolves the issue gracefully in Utils.ts: it queries
`getCachedLangSelector()` and immediately returns the key if not found
without polluting the console log with warnings. Once the element is
fully mounted, normal translation and cache updates resume.

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

barfires
This commit is contained in:
Berk
2026-05-27 05:12:00 +03:00
committed by GitHub
parent b086881a4e
commit c35355a490
-1
View File
@@ -428,7 +428,6 @@ export const translateText = (
const langSelector = getCachedLangSelector();
if (!langSelector) {
console.warn("LangSelector not found in DOM");
return key;
}