Export
Translations can be exported from Tolgee. You can currently export translations in many different formats, and you can also export only specific translations, e.g., only the ones that are not translated yet.
Exporting from Tolgee
To export translations from Tolgee, select project, and then choose the "Export" item from the sidebar.
Then you can choose the following options:
- States – which translations should be exported. You can choose multiple states.
- Languages – which languages should be exported (all languages are exported by default).
- Format – select the format of the exported file. Currently, we support only JSON and XLIFF formats.
- Namespaces – which namespaces should be exported (all namespaces are exported by default). Learn more about namespaces in this article.
- Nested structure – whether the exported file should be structured as nested objects or not (based on the "." separator in key names). This option is available only for JSON format.
When you are done, click the Export
button and the file will be downloaded.
If you want to specify exactly which keys need to be exported, you can go to Batch operations and export from there.
Exporting via CLI
You can also export translations via Tolgee CLI. To do so, you need to have the Tolgee CLI installed. You can find the installation instructions here.
Then you can use the tolgee pull
command to export translations.
The command exports strings from the platform, and saves them in a folder of your choice. You can use this to download strings from Tolgee before bundling your app for production.
Exporting via API
You can also export translations via REST API, e.g., via the curl
utility:
curl https://app.tolgee.io/v2/projects/export -H "X-API-Key: <Your API key>" --output data.zip
To configure the result options, check the API documentation.
Examples
Disabling nesting in exported files
When exporting to .json, the data is structured to nested objects by default. So the output looks like this.
{
"homepage": {
"title": "Welcome!"
}
}
To change this behavior, provide the structureDelimiter
query parameter.
curl "https://app.tolgee.io/v2/projects/export?structureDelimiter=" -H "X-API-Key: <Your API key>" --output data.zip
When structureDelimiter
is empty, nesting is disabled.
Exporting only specific namespaces
By default, all namespaces are exported. To export only some of them, provide filterNamespace
parameter.
curl "https://app.tolgee.io/v2/projects/export?filterNamespace=ns-1&filterNamespace=ns-2" -H "X-API-Key: <Your API key>" --output data.zip
Including untranslated strings
By default, only non-empty values are exported. To export also null
values, set filterState
parameter.
curl "https://app.tolgee.io/v2/projects/export?filterState=UNTRANSLATED&filterState=TRANSLATED&filterState=REVIEWED" \
-H "X-API-Key: <Your API key>" --output data.zip