How do you set the default Locale in O3?


I’m convinced that distributions can set a default locale in O3 (after all, surely that’s how Mekom has been able to have an entirely Khmer distro in Cambodia, and ICRC entirely French and Spanish distros elsewhere) - but @eudson and @dagimm just asked me about this, and I couldn’t find the explicit guidance in our current O3 frontend i18n guidance.

How are folks currently setting a default language in their O3 distro? CC @mksrom @frederic.deniger @ibacher

FYI @larymak we’ll want to be sure the improved translation docs explain this :sweat_smile:

We define the default language in the global property default_locale.

Specifies the default locale. You can specify both the language code(ISO-639) and the country > code(ISO-3166), e.g. ‘en_GB’ or just country: e.g. ‘en’

To be honest didn’t check on our O3 instance ( only tested for O2 instance) but pretty sure it should be supported for O3 :slight_smile:

1 Like

We probably should make O3 respect that property. Currently, we load the locale from:

  • The querystring (?lang=fr)
  • The HTML Tag (see below)
  • The user’s browser (browser request different languages a user can configure via the Accept-Language; the first entry is usually the browser’s default language).

For the HTML tag, we have a setting, part of the build config, called defaultLocale that can be used to specify the default locale.

Once a user logs in, we set the locale based on the backend settings, which should use the GP @frederic.deniger mentions.

Despite the HTML tag thing, by design, this isn’t something you should need to configure in O3 differently from previous versions of OpenMRS. The HTML Tag was just there to deal with the case where the backend is unreachable.