Terminology
A guide to the key terminology used in the General Translation libraries
Overview
Throughout these docs, we use various terms to describe the different concepts in the General Translation libraries.
This page highlights some of the key terms we use.
Key terms
Locale
A locale is a code used to identify a specific language.
See the locale strings page for a more detailed explanation.
For example, en-US is the locale for English (United States).
Throughout these docs, we often use the terms “locale” and “language code” interchangeably.
Language
When we refer to a language in the context of using it with code, we actually mean the locale (or the language code).
For example, when we say “provide the language in the call to setLocale”, we actually mean “provide the locale in the call to setLocale”.
If we say “French is a supported language”, we actually mean “fr is a supported locale”.
Dictionary
A dictionary is a JSON file that contains a set of (potentially nested) key–value pairs.
The keys are used as references, and the values are strings, either in the original language or in a translated language.
{
"greeting": "Hello, world!",
"farewell": "Goodbye, World!",
"dashboard": {
"title": "Dashboard",
"description": "Welcome to the dashboard"
}
}The keys are human‑readable references used to look up translated content within your app.
These dictionaries follow conventional structures and usage, similar to translation files in other i18n libraries.
A source dictionary can also be a .js or .ts file, meaning it can import from other files.
A dictionary containing translated content can only be a .json file.
Source Dictionary
A source dictionary is a dictionary that contains content in the default locale for your app.
Translated Dictionary
A translated dictionary is a dictionary that contains content for a specific locale that differs from the default locale.
The keys are the same as the source dictionary, and the values are the translated strings.
If you have your own translated dictionaries, you can load them using the loadDictionary function.
Inline content
Inline content is content that’s written directly in your app’s code, and not stored separately in something like a JSON or dictionary file.
This includes:
<T>componentsuseGThooksgetGTfunction
Source Content
Source content is the content in the default locale for your app. It includes anything written in your app’s default language.
Specifically for gt-next and gt-react, source content includes all translatable content for your app, including your app’s source dictionary and any inline content.
Source Template
The source template refers to the specific data format used to store source content.
{
["Unique identifier for the source content"]: "...Content..."
}The unique identifier for the source content is either a hash of the source content or a user-defined unique identifier.
Depending on the type of source content, the corresponding value can be a string, array, or object (strings and arrays for dictionaries, and objects for <T> components).
Translations
Throughout these docs, we use the noun “translations” to refer to the translated content produced from translating source content.
Translations are generated directly from your source template.
The loadTranslations function allows you to customise where these translations are stored. This function expects the JSON files to have the same format as the source template.
Use the CLI generate command to create these data files from your source content.
Note:
A translation is different from a translated dictionary. Dictionaries can be nested and use human-readable references as keys.
Translations, by contrast, are flat and typically use non-human-readable hashes as keys.
Translations are what is stored on the GT CDN.
If we refer to translations in the context of JSON, MDX, or MD files, we mean the direct translations of the original source files.
How is this guide?