Converting .strings files to .strings.json files

To convert a .strings file to a .strings.json file:

  1. If you're using a Looker version prior to 7.12, turn off the Legacy .strings files for localization legacy feature.
  2. 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.
  3. Name your new .strings.json file. 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 the default_locale in your project's manifest file.
  4. 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: {}
  5. Copy the key-value pairs from your old .strings file and paste them inside the curly braces.
  6. Replace all the equal signs with colons.
  7. Remove any comments; or reformat them as individual comments or as an array of comments, as illustrated next.
  8. 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",
        "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 an array of comments"
    }
}