用于grunt
和grunt-preprocess
来准备我的html文件。
如何制作多个多语言 html 文件(每个文件都有其语言的翻译)我应该使用的工具吗?以前考虑grunt-xgettext
找到了 2 个不错的grunt
插件:grunt-text-replace
和 grunt.template
。刚刚使用了第二个并从外部 json 文件中加载data
部分:
template: {
'process-en-html': {
'options': {
'data': grunt.file.readJSON('translates/en.json'),
},
'files': {
...
}
}
}
对于每种语言,请使用通用 HTML 配置及其自己的 JSON 文件