Technical Articles
Manage Fiori or OpenUI5 i18n process with this helper tool
Introduction
Hi UI5 developers,
I would like to introduce a helper tool we wrote for ui5 i18n(internationalization) process.
Being open source is an undisputable advantage in web development. I’m glad SAP went open source with ui5 technology and we are here to contribute back. I would like to thank MDP IT Consulting for enabling this work.
In short, it solves one major and three minor problems below and we find it useful as projects get bigger.
- There can be an i18n key in .view.xml which is not defined for a language(or all).
- There is no easy way to see where a property is used.
- There can be unnecessary properties that are unused in views.
- Property files can get disorganised.
This tool creates .help.properties file for each .properties file. Benefits are:
- There are entries at the top of the file for missing properties for each language.
- Usage location is written under each property.
- Unused properties are shown at the top of the file.
- Properties are grouped based on usage locations.
This tool doesn’t modify original property file for safety. We thought that it is better to let users change content manually.
At the time of writing, the tool doesn’t read controller or javascript view files for i18n strings. Maybe in the future we can bring this feature based on our needs and your feedback.(pull request anyone?)
Example
Here is an example *.properties file(click for bigger image)
Here is the result *.help.properties file(click for bigger image)
Usage
Prerequisites: Node.js should be installed which comes with npm(link: Node.js)
Open cmd.exe or linux shell, install package:
npm install -g ui5-i18n-helper
Then go to project directory and execute helper tool with command:
ui5i18n
And that is all! Your *.help.properties files should be created next to *.properties files. You can run this command repeatedly as you change project files.
Thanks for reading!
Hi Fatih,
thanks a lot. Very helpful and time saving tool 🙂
Another useful i18n-help-feature would be, if your programm detects unused i18n texts defined in a specific properties file 😉 Do you accept this challenge?
Thanks & Regards,
Mike
Hi Michael, thank you for your kind words.
Currently it logs unused texts as "#NOT USED". Do you need another feature? Or do you need to specifiy only one properties file and not all files?
Regards,
Fatih