How to provide a translation for the Squidex API and Management UI.
There are several translation files in the repository, but the files used by the API or the management UI are automated using the translation tool. You only have to update the files under
The file structure for source translation files
There are separate files for frontend and backend, one for each language.
The master language is English (
If you want to add a new language you have to do a few manual steps:
- 6.Translate everything.
- 7.Run the translator.
- 8.Provide a PR.
To update the translation for a language you have to do the following steps:
- 1.Fork the source code.
- 2.Edit the corresponding json files with an editor.
- 3.Run the
translate.shfile depending on your operation system.
- 4.Create a pull request.
As you can see the file executes the self developed translation tool which consist
dotnet run translate check-backend ..\..
dotnet run translate check-frontend ..\..
dotnet run translate gen-frontend ..\..
dotnet run translate gen-backend ..\..
The first step is to compare the translation files. It will do the following things:
- 1.The translator tool will loop over all code files (
*.html, *.cshtml, *.cs, *.ts) to analyze which strings are not translated yet. You can try to fix these errors but it needs a lot of in-depth knowledge about the source code and architecture.
- 2.The translator tool will extract all used keys from the code files and compares the keys with the keys from the master language files and prints all keys that do not exist in the master language (missing keys) or exist in the master language file but not in the code files (unused keys). You can try to fix these errors, but it needs a lot of knowledge about the user experience.
- 3.The translator tool compare all the translation files for all other languages with the master language and output all keys that do not exist in language file (missing keys) or exist in the language file but not in the master language file (unused keys). Please try to fix all errors.
- 1.Key is missing: Get the English text from
frontend_en.jsonand translate the text to your language.
- 2.Key is unused: Just remove the label and the translation.
Sometimes the keys are renamed, but you it is easy to spot these cases when you see errors like this
You can just fix all these errors by replacing the prefix
The translator tool will also create the final files. It will take all translations for for all languages and adds missing translations from the master language files.
The frontend files are also generated as json files under
Final frontend files
The backend translations are generated as resx files under
Final backend files