In my application, I change the language by clicking buttons. Now I want to change and make some words uppercase depending on that language's uppercase rules. I tried to do this by changing the <html/>
lang attribute dynamically. My language options are turkish and english
To change the html tag, I use react-helmet and to translate the words I use react-i18next . It seems like working for some codes, but for some words, uppercase rules apply depending on the previous language.
<Helmet htmlAttributes={{lang: currentlySelectedLanguage}} />
function getHeader(){
return[
{ id: headerOne, label: t("kit")}
]
}
t is a translator function from react-i18n
. This function checks the translation json file of currentlySelectedLanguage and writes its value as the label.
Header item has text-transform:uppercase
in its css class.
In turkish, there are two types of letters: i -> İ and ı -> I.
When I select english
, happens but instead of writing KIT
, I get KİT
. Which is uppercase rule for turkish, not english.
When I select turkish
, happens but then I get KIT
, but it should be KİT
, which is also uppercase rule for english