Hi ,
I have set the default locale to fr and I changed the language to Arabic on my profile.
when I check the html while on Arabic page I get lang="fr" as attribute for html tag.
The reason why I want it to change is to display a correct font for Arabic using CSS
It would make it possible to change font-family or font-size based on the user-locale. I don’t know if there are many forums that would need that. It can be done easily with a plugin.
This is working for me. Warning, I broke my development site while trying to figure this out. I think this is safe, but maybe someone else can take a look at it.
<script type="text/discourse-plugin" version="0.3">
let currentUser = api.getCurrentUser();
if (currentUser) {
let username = currentUser.username;
api.container.lookup('store:main').find('user', username).then(function (user) {
let userLocale = user.get('locale');
if ('ar' === userLocale) {
let st = document.createElement('style');
st.innerHTML = "html {font-family: 'Noto Naskh Arabic', serif !important; }";
document.head.appendChild(st);
}
});
}
</script>