# Variable default interface language for new users

**URL:** https://meta.discourse.org/t/variable-default-interface-language-for-new-users/33741
**Category:** Feature
**Created:** [September 25, 2015, 11:38am UTC](https://meta.discourse.org/t/variable-default-interface-language-for-new-users/33741 "2015-09-25T11:38:40Z")
**Posts on this page:** 1
**Showing post:** 14

<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: [November 6, 2015, 6:34am UTC](https://meta.discourse.org/t/variable-default-interface-language-for-new-users/33741/14 "2015-11-06T06:34:03Z")

</div>

I’ve made a plugin for this. [GitHub - scossar/accept-language: A Discourse plugin to set the language for non-logged-in users · GitHub](https://github.com/scossar/accept-language)

The logic is that if the site is visited by a non-logged-in user and the site allows user-locales, the locale is set from the request headers. If there is a logged-in user the locale is set from the user’s effective locale. If there is no logged-in user and user locales are disabled, the locale is set from the site default locale.

> [@sam](#):
>
> keep in mind region locales make this annoying - de-AT vs de

It uses the `http_accept_language` gem to deal with those.

The only problem I am finding with this is when login is required to view any site content, the ‘login required welcome message’ markdown content isn’t translated. The rest of the user interface is translated though.

The problem with the login message is that `SiteText.text_for` method caches it’s content.

---

_[View the full topic](https://meta.discourse.org/t/variable-default-interface-language-for-new-users/33741)._
