Default_locale on localization settings

Knowledge Drop

Last tested: Feb 12, 2021
 

The default_locale is a parameter defined on the localization settings on the manifest file. It is important not to get confused with the instance locale we define on the admin page, even so they work together when se set custom localization.

Considering the scenario where we have a en.strings.json file with key-value pairs defined for the dimension id, the localization_settings on the manifest file with default_locale: en, and the instance locale defined as en as well.

orders.view

dimension: id {

label: "ide"

primary_key: yes

type: number

sql: ${TABLE}.id ;;

}

en.strings.json

{

"ide": "identifier"

}

manifest file

localization_settings: {

default_locale: en

localization_level: permissive

}

1) If we assign a locale (pt_BR) to the user on the User settings, and we don't have a string file create yet on that project for that locale. The user could get an error on the explore saying Invalid locale for user "locale_name", not defined in project. No custom localisation would be applied here, and the field would be capitalised.

image.png

We would also get some lookml errors when validating our code: Invalid locale for user "locale_name", not defined in project.

2) If we do have a string file created on the project (on the example, a pt_BR one) and we don't have that specific key-value pair (dimension id) in the pt_BR string file, the user would see what is set for the locale instance, and once we have the locale instance equal to the default_locale on the manifest file as recommended on our docs, and we have a label for the id field and a key-value pairs defined for that field on the en.strings.json, we would be able to see the value defined on the en.strings.json here, on this case: identifier. This is the result for: User locale: pt_BR, instance locale: en, default_locale: en, id key-value defined on en.strings.json, but not defined on pt_BR.

image.png

3) Remember, if we have key-value pairs defined on any other string file that is not the default_locale one, we need to define the key-value pairs also on the default_locale string value. For example, if we set the city label on the pt_BR.string.json file, and don't have a pair for city on the en.strings.json one, the field city will not be localized.

pt_BR.string.json

{

"city" : "Cidade"

}

image.png

 

On this case, we would need to have a key-value city also defined on the en.strings.json.

en.string.json

{

"ide": "identifier",

"city": "City"

}

image.png

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 01:15 PM
Updated by: