我正在构建一个angular应用程序,使用angular-gettext进行国际化。我想知道在更新翻译文件时如何更好地自动化工作流程。
目前它是这样的:-运行" grunt“(生成pot文件+翻译文件)-在poedit中打开所有的" po”文件-在poedit中,用新的"pot“文件更新po文件-在poedit中更新翻译并保存-再次运行grunt
有没有更好的方法?例如,是否可以使用grunt命令将pot文件应用于所有"po“文件?
这是我目前的gruntfile。非常感谢
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']);
}发布于 2015-04-20 21:55:42
poedit没有命令行参数来执行“从pot文件更新”功能。所以我不认为这是可能的。
发布于 2015-05-22 00:33:46
实际上,有一种方法可以做到这一点!
我们编写了grunt任务来调用命令行gettext实用程序。它们也可用于windows here。
基本上,您需要使用po文件和pot文件调用msgmerge来更新它。请参阅msgmerge的online documentation以了解您可能需要的内容。一旦你开始使用它,它就会变得相当流畅。
https://stackoverflow.com/questions/29329857
复制相似问题