With model localization, you can customize how your model's labels and descriptions display according to a user's locale.

Localization doesn't have to be based on geographic location or language. You can use locales to represent other distinguishing factors, such as internal versus external users, or managers versus individual contributors, and customize your labels and descriptions accordingly.

> [!NOTE]
> **Note:** Model localization is not compatible with [project import](https://docs.cloud.google.com/looker/docs/2600/importing-projects).

This page describes the steps for localizing your project:

1. Determine which elements will be localized by [adding labels, group labels, and descriptions to your model](https://docs.cloud.google.com/looker/docs/2600/model-localization#labels).
2. Provide the localization definitions for your project by [creating locale strings files](https://docs.cloud.google.com/looker/docs/2600/model-localization#strings).
3. Enable localization for your project by [adding localization settings to the project's manifest file](https://docs.cloud.google.com/looker/docs/2600/model-localization#manifest).
4. Determine the display for different users by [assigning users to locales](https://docs.cloud.google.com/looker/docs/2600/model-localization#users).

Model localization often occurs in conjunction with an admin who specifies [number format localization](https://docs.cloud.google.com/looker/docs/2600/localizing-number-formatting) and [user-interface language](https://docs.cloud.google.com/looker/docs/2600/supported-user-interface-languages) settings.


## Localizing labels and descriptions in your model

You can localize labels, group labels, and descriptions in your model, including the following:

- `label` for [field](https://docs.cloud.google.com/looker/docs/2600/reference/param-field-label), [model](https://docs.cloud.google.com/looker/docs/2600/reference/param-model-label), [Explore](https://docs.cloud.google.com/looker/docs/2600/reference/param-explore-label), or [view](https://docs.cloud.google.com/looker/docs/2600/reference/param-view-label)
- [`label` for applications](https://docs.cloud.google.com/looker/docs/2600/reference/param-manifest-application#label) in the Looker extension framework
- [`group_label` for Explore](https://docs.cloud.google.com/looker/docs/2600/reference/param-explore-group-label) and [`group_label` for field](https://docs.cloud.google.com/looker/docs/2600/reference/param-field-group-label)
- [`group_item_label` for field](https://docs.cloud.google.com/looker/docs/2600/reference/param-field-group-item-label)
- [`description` for Explore](https://docs.cloud.google.com/looker/docs/2600/reference/param-explore-description) and [`description` for field](https://docs.cloud.google.com/looker/docs/2600/reference/param-field-description)

> [!TIP]
> **Tip:** Localization is not supported for [`dimension_group`](https://docs.cloud.google.com/looker/docs/2600/reference/param-field-dimension-group). Instead, use `group_label` and `group_item_label` at the field level to create your own set of dimensions that can be localized.

You can also create localized [LookML dashboards](https://docs.cloud.google.com/looker/docs/2600/building-lookml-dashboards) in your project. The following LookML dashboard parameters can be localized:

- [`title`](https://docs.cloud.google.com/looker/docs/2600/reference/param-lookml-dashboard#title_(for_dashboard))
- [`description`](https://docs.cloud.google.com/looker/docs/2600/reference/param-lookml-dashboard#description_(for_dashboard))
- [`text`](https://docs.cloud.google.com/looker/docs/2600/reference/param-lookml-dashboard-column-chart#text) (which is a subparameter of the `note` parameter and can be applied to all dashboard element types, besides elements of `type: text`)
- [`comparison_label`](https://docs.cloud.google.com/looker/docs/2600/reference/param-lookml-dashboard-single-value-chart#comparison_label)
- [`single_value_title`](https://docs.cloud.google.com/looker/docs/2600/reference/param-lookml-dashboard-single-value-chart#single_value_title)

To see all fields in your project that can be localized, you can set your project's [localization level](https://docs.cloud.google.com/looker/docs/2600/model-localization#localization_level) to `strict`. With this setting, the Looker IDE returns a LookML validation error for any LookML elements that can be localized but that don't have labels, and for any strings in your LookML model that can be localized but that aren't defined in your locale strings files.

In the following sample LookML, labels are provided for the `flights` view and the `id`, `country`, and `number_of_engines` fields. A description is also provided for the `country` field.


    view: flights {
      label: "flight_info"
      sql_table_name: flightstats.accidents ;;

      dimension: id {
        label: "id"
        primary_key: yes
        type: number
        sql: ${TABLE}.id ;;
      }

      dimension: country {
        label: "country"
        description: "country_of_departure"
        type: string
        map_layer_name: countries
        sql: ${TABLE}.country ;;
      }

      dimension: number_of_engines {
        label: "number_of_engines"
        type: string
        sql: ${TABLE}.number_of_engines ;;
      }

      dimension: location {
        type: string
        sql: ${TABLE}.location ;;
      }
    }

In the examples that follow on this page, we'll localize these values in the strings files using a `permissive` localization level. Notice that the `location` dimension does not have a label, so we can demonstrate how a dimension with no localization is displayed.


## Creating locale strings files

The locale strings files use key-value pairs to define how the labels and descriptions in your model are displayed for each locale. On the left side of each key-value pair is the *localization key*, which is a label or description string from your model. The right side of the key-value pair is where you define how you want that string to be displayed in the Looker UI.

For each locale that you want to use for your project, you need to create a dedicated strings file. Create only one strings file for each locale. You must have a strings file that is named to match the [default locale](https://docs.cloud.google.com/looker/docs/2600/model-localization#default_locale). For example, if you have specified `default_locale: en` in your project's manifest file, you must have a file in your model called `en.strings.json`. Each string must be defined in the *default* locale strings file or it won't be localized.

> [!TIP]
> **Tip:** Model localization doesn't have to be based on geographic location or language. However, if you are using model localization and you also want to use Looker's natively localized dashboard and visualization user interface, you must match the title of the strings file with Looker's [supported locale codes](https://docs.cloud.google.com/looker/docs/2600/supported-user-interface-languages#localizing_the_looker_user_interface).

This example of an `en.strings.json` file will be utilized for all users who have the **Locale** value of `en`. In the following sample LookML, `en` is also specified as the default locale, so all strings must be defined in this file in order to be localized.

    {
      "flight_info": "Flights",
      "id": "Identifier",
      "country_of_departure": "Country of Departure",
      "number_engines": "Number of Engines"
    }

The following table shows what a user with their locale set to `en` would see in the data table of a Looker Explore:

| Flights Identifier | Flights country | Flights Location | Flights Number of Engines |
|---|---|---|---|
| 493 | Congo | Kisangani, Congo | 3 |
| 2167 | Saudi Arabia | Riyadh, Saudi Arabia | 3 |
| 2657 | Austria | Vienna, Austria | 2 |
| 17992 | United States | Kansas City, MO | 2 |
| 18893 | United States | Anchorage, AK | 4 |

Note the following:

- In the [`flights` view sample LookML](https://docs.cloud.google.com/looker/docs/2600/model-localization#view) that's shown earlier on this page, no label was provided for the `location` dimension, so Looker capitalizes the dimension's name and displays it as "Location".
- Localization for the "country" label wasn't defined in the `en.strings.json` file, so Looker displays the label as it is defined in the view file, without capitalizing it: "country".

As another example, we can create an `es_ES.strings.json` file that is utilized for all users with a **Locale** value of `es_ES`:

    {
      "flight_info": "Vuelos",
      "id": "Identificador",
      "country": "País",
      "country_of_departure": "País de Partida",
      "number_engines": "Número de Motores"
    }

The following table shows what a user with their locale set to `es_ES` would see in Looker:

| Vuelos Identificador | Vuelos country | Vuelos Location | Vuelos Número de Motores |
|---|---|---|---|
| 493 | Congo | Kisangani, Congo | 3 |
| 2167 | Saudi Arabia | Riyadh, Saudi Arabia | 3 |
| 2657 | Austria | Vienna, Austria | 2 |
| 17992 | United States | Kansas City, MO | 2 |
| 18893 | United States | Anchorage, AK | 4 |

Note the following:

- As in the previous example, in the original view with labels and descriptions added, no label was provided for the location dimension, so Looker capitalizes and displays the dimension's name as "Location".
- Localization was not defined for the "country" label in the en.strings.json file, which is the default locale strings file. This means that, even though "country" was defined in the es_ES.strings.json file, Looker doesn't localize this string and displays the label as it's defined in the view file: "country".


## Adding localization settings to your project's manifest file

To enable localization for your project, add the [`localization_settings`](https://docs.cloud.google.com/looker/docs/2600/reference/param-manifest-localization-settings) parameter to your project's manifest file.

> [!TIP]
> **Tip:** If your project doesn't already have one, you can [create a manifest file](https://docs.cloud.google.com/looker/docs/2600/ide-folders#creating_files) from the **+** icon at the top of the file browser in the Looker IDE.

In the manifest file, add your localization settings. Here's an example:

    localization_settings: {
      default_locale: en
      localization_level: permissive
    }

### `default_locale`

The `default_locale` parameter specifies the name of the default locale strings file in your project.

The default locale strings file determines which strings from your model are localized. Even if a label or description string is defined in another locale strings file, if isn't defined in the *default* locale strings file, then the Looker UI displays the unlocalized string.

Don't confuse the default locale *for your project* with the default locale *for Looker users* . Your Looker admin can [set a default locale](https://docs.cloud.google.com/looker/docs/2600/admin-panel-general-localization) for your instance. If no default is set, Looker defaults to `en`. If your admin doesn't specifically enter a [**Locale**](https://docs.cloud.google.com/looker/docs/2600/admin-panel-users-users#locale) value for a [user](https://docs.cloud.google.com/looker/docs/2600/admin-panel-users-user-attributes#assigning_values_to_individual_users) or a [user group](https://docs.cloud.google.com/looker/docs/2600/admin-panel-users-user-attributes#assigning_values_to_user_groups) that the user belongs to, Looker assigns the user to the default instance locale. And, if the admin hasn't set a default instance locale, Looker assigns the user to the `en` locale.

For this reason, unless you are sure your Looker admin will be setting the **Locale** value for all your Looker users, you should set your project's `default_locale` parameter to the default locale for your instance (or to `en` if no default has been set), and define the localization for all your labels and descriptions in the `.strings.json` file for that locale.

### `localization_level`

The localization level of your project specifies whether unlocalized elements are allowed in your model:

- Set the localization level to `strict` to require localized labels for all models, Explores, views, and fields in your project. The Looker IDE returns a LookML validation error for any of these elements that don't have labels as well as for any labels and descriptions that aren't defined in the default locale strings file.
- Set the localization level to `permissive` to allow elements without labels, and to allow labels and descriptions that aren't defined in the default localization strings file.

Even if you do want the `strict` localization level, it may be handy to set your project's localization level to `permissive` when you're developing your project to prevent validation errors. Once you've finished localizing all your labels and descriptions, you can set the localization level to `strict` to see any errors.


## Assigning users to a locale

Once you have your locale strings files set up, you can assign users to a locale that corresponds to one of the locale strings files. This can be done at the [instance](https://docs.cloud.google.com/looker/docs/2600/admin-panel-general-localization), [user group](https://docs.cloud.google.com/looker/docs/2600/admin-panel-users-user-attributes#assigning_values_to_user_groups), or [individual user](https://docs.cloud.google.com/looker/docs/2600/admin-panel-users-users#locale) level, using the **Locale** field or `locale` user attribute.

For example, if you want a user to see the labels and descriptions that are defined in the `es_ES.strings.json` file, your Looker admin should set the user's [**Locale**](https://docs.cloud.google.com/looker/docs/2600/admin-panel-users-users#locale) setting to `es_ES`.

Custom locales you create with string files can be entered in the **Locale** field by clicking the field and typing the string filename rather than selecting a built-in locale from the drop-down menu. For more information, see the [Users](https://docs.cloud.google.com/looker/docs/2600/admin-panel-users-users#setting_a_custom_locale) documentation page.

> [!NOTE]
> **Note:** When a locale isn't set for users at the individual or user group level, Looker assigns users to the instance locale. However, if there is no `.strings` file set up for the instance locale, model localization won't work for those users. For that reason, a `.strings` file should be set up for each instance's default locale. You can [learn more about locales in the `default_locale` section](https://docs.cloud.google.com/looker/docs/2600/model-localization#default_locale) or see [**Creating locale strings files**](https://docs.cloud.google.com/looker/docs/2600/model-localization#creating_locale_strings_files).


## Setting locale for signed embed users

You can include a user's locale value in a [signed embed URL](https://docs.cloud.google.com/looker/docs/2600/single-sign-on-embedding#user_attributes_param) just like any other user attribute. The exact format required for signed embeds depends on the programming language that is used to build your signed embed URL script, but the name of the user attribute is `locale`. See the [Signed embedding](https://docs.cloud.google.com/looker/docs/2600/single-sign-on-embedding) documentation page for more information on signed embed URLs and tools for building your signed embed URL.


## Using locale in Liquid variables

As described previously, model localization lets you customize the display of your model's labels and descriptions for different locales. But you can also include localization keys in [Liquid variables](https://docs.cloud.google.com/looker/docs/2600/liquid-variable-reference), which lets you localize your data values as well.

For example, in our default locale strings file named `en.strings.json`, we can create the localization keys `domestic` and `international` with the following entries:

    {
      "domestic": "Domestic",
      "international": "International"
    }

And then in our `es_ES.strings.json` file, we can provide Spanish versions of these localization keys:

    {
      "domestic": "Nacional",
      "international": "Internacional"
    }

From there, we can use the `domestic` and `international` localization keys in Liquid variables to localize the output of a dimension:

    dimension: from_US {
        label: "from_us"
        type: string
        sql: CASE
             WHEN ${TABLE}.country = 'United States' THEN '{{ _localization['domestic'] }}'
             ELSE '{{ _localization['international'] }}'
             END;;
      }

Users with the `en` locale will see the following results:

| Flights Identifier | Flights country | Flights From the US? |
|---|---|---|
| 289 | United States | Domestic |
| 400 | Canada | International |
| 493 | Congo | International |
| 936 | United States | Domestic |

Users with the `es_ES` locale will see the following results:

| Vuelos Identificador | Vuelos País | Vuelos ¿De Los Estados Unidos? |
|---|---|---|
| 289 | United States | Nacional |
| 400 | Canada | Internacional |
| 493 | Congo | Internacional |
| 936 | United States | Nacional |

The users with the `es_ES` locale see the "Domestic" and "International" data localized to "Nacional" and "Internacional", respectively.

You can also use Liquid in [LookML dashboard filters](https://docs.cloud.google.com/looker/docs/2600/reference/param-lookml-dashboard#default_value) and [LookML dashboard element filters](https://docs.cloud.google.com/looker/docs/2600/reference/param-lookml-dashboard-table-chart#filters) to localize the default value in a filter. For example, if a LookML dashboard has a tile using data from this localized model, and there is a filter on that tile defined in LookML as follows:

    filters:
      flights.from_US: "{{ _localization['domestic'] }}"

When a user with the `en` locale explores from that tile on the dashboard, the Explore will be filtered on the value **Domestic** for the **Flights From the US?** field, and the data table in the Explore will include the following results:

| Flights Identifier | Flights country | Flights From the US? |
|---|---|---|
| 289 | United States | Domestic |
| 936 | United States | Domestic |

When a user with the `es_ES` locale explores from that tile on the dashboard, the Explore be filtered on the value **Nacional** for the **Vuelos ¿De Los Estados Unidos?** field, and the data table in the Explore will include the following results:

| Vuelos Identificador | Vuelos País | Vuelos ¿De Los Estados Unidos? |
|---|---|---|
| 289 | United States | Nacional |
| 936 | United States | Nacional |


## Understanding how localization rules apply to extended and refined objects

Be aware that localization rules apply when you are [extending views, Explores, or LookML dashboards](https://docs.cloud.google.com/looker/docs/2600/reusing-code-with-extends), and when you are [refining views or Explores](https://docs.cloud.google.com/looker/docs/2600/lookml-refinements).

If you have extended or refined an object and then added new labels or descriptions, you should provide localization definitions in the locale strings files.

For example, if we have a `flights` view:


    view: flights {
      label: "flight_info"
      sql_table_name: flightstats.accidents ;;
      ...
    }

And then we create a new view that extends the `flights` view:

    include: "/views/flights.view"

    view: flights_enhanced {
      extends: [flights]
      label: "enhanced_flight_info"
    }

In our locale strings files we would need to define both of the view label strings (`"flight_info"` and `"enhanced_flight_info"`). If the project's localization level is set to `strict`, we wouldn't be able to commit any updates until we defined the new labels or descriptions.