Translations Management API reference
Complete reference documentation for the Translations resource.
Translations
#Translations support localization in Knock. They hold the translated content for a given locale, which you can reference in your message templates with the t Liquid function filter.
You can retrieve, update, and create translations as well as list all translations in a given environment. Translations are identified by their locale code + an optional namespace.
List translations
#Returns a paginated list of translations available in a given environment. The translations are returned in alphabetical order by locale code.
Endpoint
Query parameters
A specific locale code to filter translations for.
A specific namespace to filter translations for.
Optionally specify the returned content format. Supports 'json' and 'po'. Defaults to 'json'.
The environment slug.
The slug of a branch to use. This option can only be used when environment is "development".
Whether to annotate the resource. Only used in the Knock CLI.
Whether to hide uncommitted changes. When true, only committed changes will be returned. When false, both committed and uncommitted changes will be returned.
The cursor to fetch entries after.
The cursor to fetch entries before.
The number of entries to fetch per-page.
Returns
A paginated list of Translation. Contains a list of entries and page information.
A list of entries.
A JSON encoded string containing the key-value pairs of translation references and translation strings.
Indicates whether content is a JSON encoded object string or a string in the PO format.
The timestamp of when the translation was created.
The locale code for the translation object.
An optional namespace for the translation to help categorize your translations.
The timestamp of when the translation was last updated.
The information about a paginated result.
The cursor to fetch entries after. Will only be present if there are more entries to fetch.
The cursor to fetch entries before. Will only be present if there are more entries to fetch before the current page.
The number of entries to fetch per-page.
Get translation
#Retrieve a translation by its locale and namespace, in a given environment.
Endpoint
Path parameters
A specific locale code to filter translations for.
Query parameters
The environment slug.
The slug of a branch to use. This option can only be used when environment is "development".
Optionally specify the returned content format. Supports 'json' and 'po'. Defaults to 'json'.
A specific namespace to filter translations for.
Whether to annotate the resource. Only used in the Knock CLI.
Whether to hide uncommitted changes. When true, only committed changes will be returned. When false, both committed and uncommitted changes will be returned.
Returns
Wraps the Translation response under the translation key.
A translation object.
A JSON encoded string containing the key-value pairs of translation references and translation strings.
Indicates whether content is a JSON encoded object string or a string in the PO format.
The timestamp of when the translation was created.
The locale code for the translation object.
An optional namespace for the translation to help categorize your translations.
The timestamp of when the translation was last updated.
Upsert translation
#Updates a translation of a given locale code + namespace, or creates a new one if it does not yet exist.
Note: this endpoint only operates on translations in the "development" environment.
Endpoint
Path parameters
A locale code of the translation.
Query parameters
The environment slug.
The slug of a branch to use. This option can only be used when environment is "development".
An optional namespace that identifies the translation.
Optionally specify the returned content format. Supports 'json' and 'po'. Defaults to 'json'.
Whether to annotate the resource. Only used in the Knock CLI.
Whether to commit the resource at the same time as modifying it.
The message to commit the resource with, only used if commit is true.
Request body
A translation object with a content attribute used to update or create a translation.
A JSON encoded string containing the key-value pairs of translation references and translation strings.
Indicates whether content is a JSON encoded object string or a string in the PO format.
Returns
Wraps the Translation response under the translation key.
A translation object.
A JSON encoded string containing the key-value pairs of translation references and translation strings.
Indicates whether content is a JSON encoded object string or a string in the PO format.
The timestamp of when the translation was created.
The locale code for the translation object.
An optional namespace for the translation to help categorize your translations.
The timestamp of when the translation was last updated.
Validate translation
#Validates a translation payload without persisting it.
Note: this endpoint only operates on translations in the "development" environment.
Endpoint
Path parameters
The translation's locale code.
Query parameters
The environment slug.
The slug of a branch to use. This option can only be used when environment is "development".
Request body
A translation object with a content attribute used to update or create a translation.
A JSON encoded string containing the key-value pairs of translation references and translation strings.
Indicates whether content is a JSON encoded object string or a string in the PO format.
Returns
Wraps the Translation response under the translation key.
A translation object.
A JSON encoded string containing the key-value pairs of translation references and translation strings.
Indicates whether content is a JSON encoded object string or a string in the PO format.
The timestamp of when the translation was created.
The locale code for the translation object.
An optional namespace for the translation to help categorize your translations.
The timestamp of when the translation was last updated.
Translation
#A translation object.
Attributes
A JSON encoded string containing the key-value pairs of translation references and translation strings.
Indicates whether content is a JSON encoded object string or a string in the PO format.
The timestamp of when the translation was created.
The locale code for the translation object.
An optional namespace for the translation to help categorize your translations.
The timestamp of when the translation was last updated.