Hi everyone!
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
The CLI tools expects a list of target languages.
Also the source i18n file should be English.
ui5-translator spanish,german,italian
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:
https://dev.to/rushankhan1/build-a-cli-with-node-js-4jbi
--Edit 20/07/2023
I updated the library.
To get the latest version simply do:
npm update -g @facuferrer86/ui5-translator
I removed the dependency on
https://www.npmjs.com/package/@vitalets/google-translate-api and replaced it with
https://www.npmjs.com/package/google-translate-api-x
Also, all translations are now executed in bulk rather than in series. I was reaching a threshold of too many calls, so I now call once every 60 seconds. It's slower.. but effective.