I am building an angular app, with internationalization using angular-gettext. I would like to know how to better automate the workflow when updating the translation files.
Currently it is the following: - running "grunt" (generation of pot file + translation files) - opening all "po" files in poedit - in poedit, update po file with the new "pot" file - update translations in poedit & save - run grunt again
Is there a way to have something better? Like, is it possible to apply the pot file to all "po" files using a grunt command?
Here is my gruntfile currently. Thanks a lot
module.exports = function(grunt)
{
grunt.initConfig({
nggettext_extract: {
pot: {
files: {
'po/template.pot': ['www/app/**/*.html']
}
},
},
nggettext_compile: {
all: {
options: {
module: 'app'
},
files: {
'www/resources/translations.js': ['po/*.po']
}
},
}
});
grunt.loadNpmTasks('grunt-angular-gettext');
// Default task(s).
grunt.registerTask('default', ['nggettext_extract', 'nggettext_compile']);
}
Actually there is a way to do this!
We wrote grunt tasks to call command line gettext utilities. They are also available for windows here.
Basically you need to call
msgmerge
with the po file and the pot file to update it. See the online documentation formsgmerge
to see what you may need. It's pretty slick once you get it going.