# Lang attribute doesn't change when changing locale on profile

**URL:** <https://meta.discourse.org/t/lang-attribute-doesnt-change-when-changing-locale-on-profile/52830>\
**Category:** Feature\
**Created:** [Novembre 12, 2016, 4:12 UTC](https://meta.discourse.org/t/lang-attribute-doesnt-change-when-changing-locale-on-profile/52830 "2016-11-12T16:12:07Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [Novembre 13, 2016, 11:13 UTC](https://meta.discourse.org/t/lang-attribute-doesnt-change-when-changing-locale-on-profile/52830/10 "2016-11-13T23:13:35Z")

</div>

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.

```js
<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>

```

---

_[View the full topic](https://meta.discourse.org/t/lang-attribute-doesnt-change-when-changing-locale-on-profile/52830)._
