Refactor language attribute handling in LanguageProvider to ensure correct translation application and avoid unnecessary updates.
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / compose (push) Has been cancelled

This commit is contained in:
2026-07-19 00:52:55 +03:00
parent 7a7c2837b2
commit 9c1de36163

View File

@@ -259,7 +259,8 @@ export function LanguageProvider({ children }: { children: ReactNode }) {
if (!stored) { stored = new Map(); attributeOriginals.current.set(element, stored) }
if (!stored.has(attribute)) stored.set(attribute, value)
const original = stored.get(attribute) ?? value
element.setAttribute(attribute, language === 'ru' ? translate(original) : original)
const translated = language === 'ru' ? translate(original) : original
if (value !== translated) element.setAttribute(attribute, translated)
}
}
applying = false