# Task OP-12581 - How should the initial selected language be managed?

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-12581

## Details

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Date |  |
| Priority | Medium |
| Target versions | 13.0.0 |
| Category |  |
| Labels |  |

## Description

A question regarding <mention class="mention" data-id="36933" data-type="work_package" data-text="###36933">###36933</mention> and the way default language and available languages should be managed:

Here is how it currently works: We have the two settings **default language** and **available languages**.

**Default language** can be configured in Administration \> Users and permissions \> Settings \> Default language dropdown. Any supported language can be selected. It can also be set with an environment variable. It will be used for non-logged in users, or for users having set their language to `(auto)` and having the browser-language configured to a non-supported language.

**Available languages** is available from Administration \> System settings \> Display \> Available languages checkboxes list. It lists all supported languages. The user will be able to choose its preferred language among the ones being checked. It can also be set with an environment variable.

Currently, if the default language is not listed in the available languages, then it will fall back to English.

With <mention class="mention" data-id="36933" data-type="work_package" data-text="##36933">##36933</mention>, there will be this behavior:

  - Upon the first configuration of the installation, the `default_language` setting is queried for:
      - packaged installation: part of the wizard (before the seeding)
      - docker: Providable as an environment variable
      - kubernetes: Providable as an environment variable
  - When seeding, the `default_language` determines the locale in which the seeding is carried out.

If we keep things the way they currently work, the installation can be done in a language which is not in the available languages, meaning the demo data will be in a language, while the rest of the application will be displayed in English.

We have some options to move forward:

  - whatever default language is selected when the app is initialized, add it to the list of available languages. Said another way: the list of languages a user can pick from is (default language + available languages).
  - Block startup of application if default language is not in the list of available languages (and invite the user to configure the list of available languages to add this one). It is is an invalid state and the app should not start.
  - Remove the available languages setting and let users pick any language supported.

Before continuing with <mention class="mention" data-id="36933" data-type="work_package" data-text="##36933">##36933</mention>, I'd like this topic to be addressed by the product team.

Other questions related to languages:

1.  The language is chosen from 3 places when someone visits a page:
      - the user preference
      - if user preference is not set or is set to an unavailable language, then it reads the language sent by the browser 
      - if the browser language is not sent or is unavailable, then it uses the default language configured in OpenProject
      - then if that language is not in the list of available languages, it uses English. Even if English is not checked in the list of available languages.
      - Maybe we could add a check when the available languages and default language are set to ensure both are compatible.
2.  The `(auto)` choice proposed to the user in their profile settings is available only if all available languages are ticked. When `(auto)` is selected, the language will be chosen from the browser language.
      - Why is this `(auto)` choice not available when fewer available languages are ticked? This could be useful.
