ui5-translator CLI tool
I’ve always found it frustrating to have to maintain several i18n files by hand. Maybe when you need to support 2 languages is not a big deal. But when you have to support 4 or more, you can easily add the entry on the main i18n file but forget to update the said entry on the other i18n languages.
With this in mind I created a nodejs based CLI ui5-translator tool to ease the developer experience.
Just to give a demonstration of it’s features I created a test project. project2 using the basic Project Template on BAS.
To begin, run the installer on the root of the UI5 Application project.
The CLI tool will look for the i18n file on ./webapp/i18n/i18n.properties
npm install -g @facuferrer86/ui5-translator
Note: The CLI tool looks for translations on 3 sources:
- Previously created i18n files with already translated entries.
- SAP Translation HUB.
- Google Translator.
If it can’t find the prior it will look it on the following source.
All languages on iso639-2 are supported.
Please do share feedbacks or thoughts in a comment section and feel free to follow me for more content updates.
Also, do follow SAPUI5 environment Topic page (https://community.sap.com/topics/ui5)
If you are interested in building your own CLI tools on nodejs look at:
Thanks for publishing such informative blog.
However when I'm trying to execute the mentioned commands I'm getting below error.
bash: ui5-translator: command not found
Any suggestions, how to overcome it?
Try to install it with -g or else run it npx ui5-translator...
Hope it helps you
Thanks Santiago, it works now.
Thanks Santiago for noticing! I just modified the post to reflect this
excellent helper! maybe you could align the translation process with the similarly cut ui5 tooling task https://github.com/ui5-community/ui5-ecosystem-showcase/tree/main/packages/ui5-task-i18ncheck - then we‘d have both a cli and a task working by the same principle!
I like that idea very much. I'll look into it!
There is also already https://blogs.sap.com/2021/01/21/ui5-tooling-custom-task-using-sap-translation-hub-for-i18n-of-ui5-apps/ and https://github.com/DerGuteWolf/ui5-task-translationhub
Hi @Facundo Ferrer,
I am getting below error while using this module.
So the cli uses under the hood this library @vitalets/google-translate-api. It seems that the response format has changed, there is an open issue on the library about it.