File Import Settings

JSON (JavaScript Object Notation)

Context Note, Context Key and Max. target length are not processed for files of more than 10 MB.

To process .ARB files, select the JSON file type when creating a new job.

File Types

  • .JSON

Import Options

  • Parse ICU messages

  • Use HTML subfilter

    Imports HTML tags contained in the file. Tags can then be used with HTML File Import Settings.

    If enabled, HTML characters & and < are converted into entities &amp; and &lt; in the completed file.

  • Convert to Memsource tags

    Apply regular expressions to convert specified text to tags.

  • Import specific keys only (use regexp)

  • Exclude specific keys (use regexp)

  • Context note

    Matching content is displayed in context notes.

  • Max. target length

    Import elements or the maximum target length for each element.

  • Context key

    Constitutes TM context (101% matches) if applicable.

Simple JSON

JSON is short for JavaScript Object Notation. Although originally designed only for JavaScript, it became a standard exchange file format in parallel with XML, YAML, Properties, etc. JSON consists of key-value pairs wrapped in curly brackets. A value can either be a string, a number, or an object (namely one or more key-value pairs wrapped in curly brackets). Simple JSON is just a JSON file with most of its values being plain strings except for pluralization purposes. In this case, strings placed as values will be the ones that end up being translated.

Recommended Import Settings

JSON array is a list of name-value pairs enclosed in square brackets []. JSON object is a list of name-value pairs enclosed in curly braces {}

  • Import specific keys only (use regexp): simple_key|nested.deeply.key

    • To import all values of the array following the sample_collection key: (^|.*/)sample_collection\[.*\]

    • To import all values of the object following the pluralized_key key: (^|.*/)pluralized_key/.*

  • Exclude specific keys only (use regexp): unverified_key

  • Context key:

    • For having the value of the key_with_description key, use: ../key_with_description

    • If not specified or missing, it is formed by parent key/child key

    • JSON keys such as boolean_key cannot be set as Context key.

Example:

{
  "boolean_key": "--- true\n",
  "empty_string_translation": "",
  "key_with_description": "Check it out! This key has a description! (At least in some formats)",
  "key_with_line-break": "This translations contains\na line-break.",
  "nested.deeply.key": "Wow, this key is nested even deeper.",
  "nested.key": "This key is nested inside a namespace.",
  "null_translation": null,
  "pluralized_key": {
    "one": "Only one pluralization found.",
    "other": "Wow, you have %s pluralizations!",
    "zero": "You have no pluralization."
  },
  "sample_collection": [
    "first item",
    "second item",
    "third item"
  ],
  "simple_key": "Just a simple key with a simple message.",
  "unverified_key": "This translation is not yet verified and waits for it. (In some formats we also export this status)"
}

Nested JSON

Nested JSON is simply a JSON file with a fairly big portion of its values being other JSON objects. Compared with Simple JSON, Nested JSON provides higher clarity in that it decouples objects into different layers, making it easier to maintain.

Recommended Import Settings

JSON array is a list of name-value pairs enclosed in square brackets []. JSON object is a list of name-value pairs enclosed in curly braces {}

  • Import specific keys only (use regexp): key_with_line-break|simple_key

    • To import the value of the array following the sample_collection key: (^|.*/)sample_collection\[.*\]

    • To import all values of the object following the pluralized_key key: (^|.*/)pluralized_key/.*

    • To import the value of the first key key: nested/deeply/key

    • To import the value of the second key key: nested/key

    • To import the value of the key key regardless of level: (^|.*/)key

  • Exclude specific keys only (use regexp): unverified_key

  • Context key:

    • For having the value of the key key_with_description, use: ../key_with_description

    • If not specified or missing, it is formed by parent key/child key

    • JSON keys such as boolean_key cannot be set as Context key.

Example:

{
  "boolean_key": "--- true\n",
  "empty_string_translation": "",
  "key_with_description": "Check it out! This key has a description! (At least in some formats)",
  "key_with_line-break": "This translations contains\na line-break.",
  "nested": {
    "deeply": {
      "key": "Wow, this key is nested even deeper."
    },
    "key": "This key is nested inside a namespace."
  },
  "null_translation": null,
  "pluralized_key": {
    "one": "Only one pluralization found.",
    "other": "Wow, you have %s pluralizations!",
    "zero": "You have no pluralization."
  },
  "sample_collection": [
    "first item",
    "second item",
    "third item"
  ],
  "simple_key": "Just a simple key with a simple message.",
  "unverified_key": "This translation is not yet verified and waits for it. (In some formats we also export this status)"
}

React-Intl Simple JSON

React-Intl is a JavaScript library designed to simplify internationalization (i18n) and (localization) primarily for applications developed in React. By default, React-Intl uses .js files to store its localized content.

Recommended Import Settings

JSON array is a list of name-value pairs enclosed in square brackets []

  • Import specific keys only (use regexp): key_with_line-break|nested.deeply.key

    • To import all values of the array following the sample_collection key: (^|.*/)sample_collection\[.*\]

  • Exclude specific keys only (use regexp): unverified_key

  • Context key:

    • For having the value of the key_with_description key, use: ../key_with_description

    • If not specified or missing, it is formed by parent key/child key

    • JSON keys such as boolean_key cannot be set as Context key.

Example:

{
  "boolean_key": "--- true\n",
  "empty_string_translation": "",
  "key_with_description": "Check it out! This key has a description! (At least in some formats)",
  "key_with_line-break": "This translations contains\na line-break.",
  "nested.deeply.key": "I'm a deeply nested key.",
  "nested.key": "This key is nested inside a namespace.",
  "null_translation": null,
  "pluralized_key.one": "Only one kitten found.",
  "pluralized_key.other": "Wow, you have %s kittens!",
  "pluralized_key.zero": "You have no kittens.",
  "sample_collection": [
    "first item",
    "second item",
    "third item"
  ],
  "simple_key": "Simple key, simple message, so simple.",
  "unverified_key": "This translation is not yet verified and waits for it. (In some formats we also export this status)"
}

React-Intl Nested JSON

React-Intl is a JavaScript library designed to simplify internationalization (i18n) and (localization) primarily for applications developed in React. By default, React-Intl uses .js files to store its localized content.

Recommended Import Settings

JSON array is a list of name-value pairs enclosed in square brackets []. JSON object is a list of name-value pairs enclosed in curly braces {}

  • Import specific keys only (use regexp): key_with_line-break|simple_key

    • To import all values of the array following the sample_collection key: (^|.*/)sample_collection\[.*\]

    • To import all values of the object following the pluralized_key key: (^|.*/)pluralized_key/.*

    • To import the value of the first key key: nested/deeply/key

    • To import the value of the second key key: nested/key

    • To import the value of the key key regardless of level: (^|.*/)key

  • Exclude specific keys only (use regexp): unverified_key

  • Context key:

    • For having the value of the key_with_description key, use: ../key_with_description

    • If not specified or missing, it is formed by parent key/child key

    • JSON keys such as boolean_key cannot be set as Context key.

Example:

{
  "boolean_key": "--- true\n",
  "empty_string_translation": "",
  "key_with_description": "Check it! This key has a description! (At least in some formats it does)",
  "key_with_line-break": "This translations contains\na line-break.",
  "nested": {
    "deeply": {
      "key": "Hey, this key is nested even deeper."
    },
    "key": "This key is nested inside a namespace."
  },
  "null_translation": null,
  "pluralized_key": {
    "one": "Only one pluralization found.",
    "other": "Wow, you have %s pluralizations!",
    "zero": "You have no pluralization."
  },
  "sample_collection": [
    "first item",
    "second item",
    "third item"
  ],
  "simple_key": "A simple key with a simple message.",
  "unverified_key": "Translation is not yet verified and waits for it. (In some formats we also export this status)"
}

Chrome JSON i18n

Localized strings for Chrome extensions are stored in a JSON file often named messages.json. Chrome JSON files have a slightly different structure than JSON files used for localization on other platforms. For Chrome JSON, strings that need translation are placed in the sub-key message nested under each unit key-value pair. A description may also be added to each key-value pair.

Recommended Import Settings

JSON object is a list of name-value pairs enclosed in curly braces {}.

  • Import specific keys only (use regexp): .*/message|.*/content

    • To import only the first value of the message key: prompt_for_name/message

    • To import all values of the object following the user key: .*/user/.*

  • Exclude specific keys only (use regexp): .*/example

  • Context note:

    • For having the value of the description key: ../description

    • If not specified or missing, it is formed by parent key/child key

    • JSON key such as prompt_for_name cannot be set as Context note.

  • Convert to Memsource tags: \$[^\$]+\$

Example:

{
  "prompt_for_name": {
    "message": "What's your name?",
    "description": "Ask for the user's name"
  },
  "hello": {
    "message": "Hello, $USER$",
    "description": "Greet the user",
    "placeholders": {
      "user": {
        "content": "$1",
        "example": "Cira"
      }
    }
  },
  "bye": {
    "message": "Goodbye, $USER$. Come back to $OUR_SITE$ soon!",
    "description": "Say goodbye to the user",
    "placeholders": {
      "our_site": {
        "content": "Example.com"
      },
      "user": {
        "content": "$1",
        "example": "Cira"
      }
    }
  }
}

Go i18n JSON

Go-i18n is an internationalization library designed for Golang. Its supported localization file formats include JSON, YAML, TOML, etc. JSON files used by go-i18n are different from those of other localization/internationalization platforms in that go-18n JSON often exists as a JSON array consisting of a series JSON objects. Each JSON object represents a string that needs translation identified by keys such as ID.

Recommended Import Settings

JSON object is a list of name-value pairs enclosed in curly braces {}.

  • Import specific keys only (use regexp): .*/translation

    • To import all values of the object following the translation key: .*/translation/.*

    • To import only values of the second object following the translation key: .*\[2\]/translation/.*

    • To import the value of one key of the object following the translation key: .*/translation/one

    • To import the value of one key in the 5th translation key: .*\[5\]/translation/one

    • To import the value of other keys in objects following the translation key: (^|.*/)translation/other

    • To import the value of other key in the 2nd object following the translation key: .*\[2\]/translation/other

  • Exclude specific keys only (use regexp): .*/other

  • Context key:

    • For having the value of the id key, use: ../id

    • If not specified or missing, it is formed by parent key/child key

    • JSON keys such as one cannot be set as Context key.

  • Convert to Memsource tags: \{\{[^\}]+\}\}

Example:

[
{
    "id": "d_days",
    "translation": {
      "one": "{{.Count}} day",
      "other": "{{.Count}} days"
    }
  },
  {
    "id": "my_height_in_meters",
    "translation": {
      "one": "I am {{.Count}} meter tall.",
      "other": "I am {{.Count}} meters tall."
    }
  },
  {
    "id": "person_greeting",
    "translation": "Hello {{.Person}}"
  },
  {
    "id": "person_unread_email_count",
    "translation": {
      "one": "{{.Person}} has {{.Count}} unread email.",
      "other": "{{.Person}} has {{.Count}} unread emails."
    }
  },
  {
    "id": "person_unread_email_count_timeframe",
    "translation": {
      "one": "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}.",
      "other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}."
    }
  },
  {
    "id": "program_greeting",
    "translation": "Hello world"
  },
  {
    "id": "your_unread_email_count",
    "translation": {
      "one": "You have {{.Count}} unread email.",
      "other": "You have {{.Count}} unread emails."
    }
  }
]

i18n-node-2 JSON

I18n-node-2 is a library based on Node.js that works with Express.js. I18n-node-2 integrates with applications by providing immediate string extraction. i18n-node-2 is all that is required to wrap strings pending translation with the default _(“…”) method. While running, i18n-node-2 automatically generates multiple JSON files depending on predefined locales. I18n-node-2 uses the auto-generated JSON format to store translatable data. Prior to translation, perform a sanity check of the files. As i18n-node-2 supports pluralization, ensure all variables remain unchanged during translation.

Recommended Import Settings

JSON array is a list of name-value pairs enclosed in square brackets []. JSON object is a list of name-value pairs enclosed in curly braces {}

  • Import specific keys only (use regexp): simple_key|nested.deeply.key

    • To import all values of the array following the sample_collection key: (^|.*/)sample_collection\[.*\]

    • To import all values of the object following the pluralized_key key: (^|.*/)pluralized_key/.*

  • Exclude specific keys only (use regexp): unverified_key

  • Context key:

    • For having the value of the key_with_description key, use: ../key_with_description

    • If not specified or missing, it is formed by parent key/child key

    • JSON keys such as boolean_key cannot be set as Context key.

Example:

{
  "boolean_key": "--- true\n",
  "empty_string_translation": "",
  "key_with_description": "Check it out! This key has a description! (At least in some formats)",
  "key_with_line-break": "This translations contains\na line-break.",
  "nested.deeply.key": "I'm a deeply nested key.",
  "nested.key": "This key is nested inside a namespace.",
  "null_translation": null,
  "pluralized_key": {
    "one": "Only one pluralization found.",
    "other": "Wow, you have %s pluralizations!",
    "zero": "You have no pluralization."
  },
  "sample_collection": [
    "first item",
    "second item",
    "third item"
  ],
  "simple_key": "simple key, simple message, so simple.",
  "unverified_key": "This translation is not yet verified and waits for it. (In some formats we also export this status)"
}
Was this article helpful?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.