> For the complete documentation index, see [llms.txt](https://docs.elentra.org/ejs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elentra.org/ejs/1.1/guide/internationalization/locales.md).

# Locales

## Introduction

EJS uses the concept of **locales** to represent a language and region combination. This allows for nuanced support for multiple dialects of a common language (such as American English vs Canadian English).

## Locale codes

Each locale is represented by a **locale code**: a lowercase language code and an uppercase country code, separated by a hyphen (e.g. en-US for American English).

## Supported locales

The following locales are currently supported.  You may define other locales in your [module](/ejs/1.1/guide/modules.md), but the application will not be able to load them at this time.

* **en-US:** English - United States
* **en-CA:** English - Canada
* **fr-CA:** French - Canada
* **es-ES:** Spanish - Spain

Additional locales will be added in each release.

## Active locale

The **active locale** determines which [language packs](/ejs/1.1/guide/internationalization/language-packs.md) are loaded and applied.  When the active locale is changed, the associated language pack from the active [module](/ejs/1.1/guide/modules.md) will be loaded and applied.

### Changing the active locale

From inside a [component](/ejs/1.1/guide/modules/components.md), you may use the `$setLocale()` [instance method](/ejs/1.1/guide/modules/components.md#instance-methods) to change the active locale.

{% code title="MyComponent.vue" %}

```markup
<template>
    <button @click="$setLocale('fr-CA')">fr-CA</button>
</template>

<script>
    module.exports = {
        name: 'my-component',
        mounted() {
            this.$setLocale('fr-CA');
        }
    };
</script>
```

{% endcode %}

## Default locale

An application must also specify a **default locale**.  If an active locale has not been specified, the default locale will become the active locale. &#x20;

When performing a translation, if a [string resource](/ejs/1.1/guide/escl/string-resources.md) is not available for the active locale, the translator will attempt to locate the string resource for the default locale as a fall-back.  If the string resource isn't found in either the active or default locale, the resource identifier is returned.

If the `i18n-warnings` [flag](/ejs/1.1/guide/environments/configuration.md) has been enabled, a warning will be issued for a missing resource in the active locale, and an error if the resource is also missing from the default locale.
