tolgee-platform
tolgee-platform copied to clipboard
Import translations fails when namespace contains a dot
Running the push
cli command, trying to push translations with namespaces containing a dot .
the "Applying changes..." step fails returning this error message: "Some of the imported languages weren't recognized. Please create a language with corresponding tag in the Tolgee Platform". After some debugging i noticed that the "/v2/projects/{projectId}/import/apply" request fails returning a statusCode 400 and this response: { code: 'existing_language_not_selected', params: null }
.
The folder structure i'm trying to push is: (i'm trying to have user-specific translations using the fallbackNs param set to "common")
- common
- en.json
- it.json
- [email protected]
- en.json
- it.json
- [email protected]
- en.json
- it.json
I've tried to create the namespaces and some translations on the platform and the pull cli command works perfectly.
Thanks
Hey! Interesting issue! 🚀
Do you have languages with tags en
and it
created in the platform?
Can you maybe share the data you're trying to import, so I can test it locally?
Hey! Thanks for the super quick response! I'm not actually using any tags in the platform, here you can find the test data translations.zip
I'm not actually using any tags in the platform, here you can find the test data
This is what we call language tag: https://en.wikipedia.org/wiki/IETF_language_tag
sorry 😅 i thought you were talking about tolgee tags
yes, i have already set up the project with this 2 languages
Oh, I see; it really doesn't automatically pair the languages for some files.
What you can do as a workaround is manually assign the existing languages to the import languages.
Think of import language as a storage for all the translations imported from a single file/namespace in a single language. Tolgee creates this storage when you upload a new file, so you can modify the target existing language later.
You can use these endpoints to set the language manually:
First, you have to get the import result: https://tolgee.io/api#tag/Import/operation/getImportResult_1
The result tells you whether the import language was paired with the existing one. If not, existingLanguageId
is null.
In that case, you need to get the id of the desired existing language (by calling) https://tolgee.io/api#tag/Languages/operation/getAll_8
In the response, you'll find a language ID you want to select for the import language, so you can call this one https://tolgee.io/api#tag/Import/operation/selectExistingLanguage_1
to pair the import language to the existing language.
The links take you to the docs. They're not the actual endpoint URLs.
Thanks