> For the complete documentation index, see [llms.txt](https://docs.themeupstudio.com/crimson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.themeupstudio.com/crimson/multilingual/locale-specific-domains.md).

# Locale Specific Domains

Crimson can switch languages using locale-specific domains or subdomains instead of `/{lang}/` paths.

Example:

* Main locale: `https://www.example.com`
* Hindi: `https://hi.example.com`
* Spanish: `https://es.example.com`

This is optional. Crimson still requires a separate Ghost installation per language.

### Variables used

```javascript
USE_LOCALE_DOMAINS: true,
LOCALE_DOMAINS: {
  en: 'www.example.com',
  hi: 'hi.example.com',
  es: 'es.example.com'
},
LOCALE_DOMAIN_HOME_ONLY: false,
LOCALE_DOMAIN_HOME_IGNORE_PATHS: ''
```

#### What each variable does

* `USE_LOCALE_DOMAINS`: When `true`, the language switcher and browser-locale redirect use mapped domains instead of `/{lang}/` paths.
* `LOCALE_DOMAINS`: Maps a language code to its domain or subdomain. Use language codes such as:

  * `en`
  * `hi`
  * `es`

  Map every locale, including the main locale.
* `LOCALE_DOMAIN_HOME_ONLY`: When `false`, Crimson tries to keep the current path while switching locale domains. When `true`, Crimson opens the homepage of the target locale domain instead.
* `LOCALE_DOMAIN_HOME_IGNORE_PATHS`: A comma-separated list of paths that should still keep their path even when `LOCALE_DOMAIN_HOME_ONLY` is `true`.
  * Example: `LOCALE_DOMAIN_HOME_IGNORE_PATHS: 'account, membership, signin, signup, subscribe'`

### Behavior examples

* If `USE_LOCALE_DOMAINS` is `false`:
  * English post: `https://example.com/my-post/`
  * Hindi version: `https://example.com/hi/my-post/`
* If `USE_LOCALE_DOMAINS` is `true` and `LOCALE_DOMAIN_HOME_ONLY` is `false`:
  * English post: `https://www.example.com/my-post/`
  * Hindi version: `https://hi.example.com/my-post/`
* If `USE_LOCALE_DOMAINS` is `true` and `LOCALE_DOMAIN_HOME_ONLY` is `true`:
  * English post: `https://www.example.com/my-post/`
  * Hindi switch target: `https://hi.example.com/`

### Important rules

* Separate Ghost installs are still required.
* Keep slugs the same across languages if you want deep-link switching to work.
* If a translated URL does not exist on the target locale site, visitors can hit a 404.
* Use `LOCALE_DOMAIN_HOME_ONLY: true` if you do not want to depend on matching inner URLs.
* Use domain/subdomain values in `LOCALE_DOMAINS`. Do not rely on path values there.
