angular-gettext-tools
angular-gettext-tools copied to clipboard
Compiling from multiple files
I have a use-case for this, for example I have default translations which are generated using .extract, but also I have custom translations which can't be extracted from the code and those are added manually (in separate *.po file).
For example, there is list of items which has description where several values need to be interpolated like name or some other value. But, there are some special items which have totally different description and don't fit the pattern, so in order to avoid IFs I just define that special description for that particular item in that separate manually created *.po file (with the key 123.description for example). Currently, if I point .compile to those files only the last one will be generated. So, I have *.po files like this:
- /default/en.po
- /default/zh.po
- /custom/en.po
- /custom/zh.po
After compiling I'll get translations only for the last one that has been taken by the .compile, and I would like to have translations merged, meaning to have translations from /default/en.po and /custom/en.po into one single en.js (or en.json)
Does it make sense to have this support within this plugin, or there should be separate plugin which would deal with this?
At this moment I'm using gulp version and I'm altering output of the .compile in a way that I'm caching outputs and merge them in dedicated function, but it's a bit dirty and I don't like it...
I built a gulp module you could use: https://github.com/SebastianRolf/gulp-concat-po-modules
It merges .po files from several directories into one file per language, so you would get /i18n/en.po /i18n/zh.po
form your example.
That's really cool! I'll try it out once I have time, thanks :)
It would be great if this was supported in the core, and another package wasn't necessary to do this.