In Looker 7.2, using .strings
files for model localization was deprecated in favor of using the .strings.json
format. In Looker 7.12, the legacy feature for .strings
files was removed, requiring that any .strings
localization files be converted to .strings.json
files. To convert a .strings
file to a .strings.json
file:
- If using a Looker version prior to 7.12, turn off the Legacy .strings files for localization legacy feature.
- Create a new
.strings.json
file for your project by clicking the + icon at the top right of your project file list and selecting Create Locale Strings File. - Name your new
.strings.json
file. Recall that the titles of strings files must match the locale code assigned to users or groups who are using that locale and the title of the default locale file must match the value for thedefault_locale
in your project's manifest file. - The snippet that appears in the new
.strings.json
file provides an example of JSON formatting. Delete this example and replace it with a pair of curly braces:{}
- Copy the key-value pairs from your old
.strings
file and paste them inside the curly braces. - Replace all the equal signs with colons.
- Remove any comments; or reformat them as individual comments or an array of comments, as illustrated below.
- Replace all the semicolons with commas.
Typical .strings.json
formatting of the key-value pairs looks like this:
{ "flight_info" : "Flight Info", "id" : "Identifier", "airline" : "Air Carrier" }
To format comments, you can use these formats:
{ "My Comment": { "my_comment_array": [ "The name of this file should be the associated locale code followed by '.strings.json'", "There is one .strings.json file per locale.", "Define your translated strings one key at a time demonstrated below", "Keys can be any string; choose whatever scheme helps you stay organized", "Then, set your Lookml label and description parameters to the desired key values.", "To choose this file as the master key list and as the one to validate against", "set its locale code ('test') as the default_locale in the manifest file" ], "value": "Translation for My Comment" }, "My Key": { "value": "Translation for My Key", "comment": "Define your translated strings with a comment or array of comments as above" } }