咕噜咕噜:从一个 HTML 制作多个多语言 HTML



用于gruntgrunt-preprocess来准备我的html文件。

如何制作多个多语言 html 文件(每个文件都有其语言的翻译)我应该使用的工具吗?以前考虑grunt-xgettext

找到了 2 个不错的grunt插件:grunt-text-replacegrunt.template 。刚刚使用了第二个并从外部 json 文件中加载data部分:

      template: {
        'process-en-html': {
            'options': {
                'data': grunt.file.readJSON('translates/en.json'),
            },
            'files': {
               ...
            }
        }
    }

对于每种语言,请使用通用 HTML 配置及其自己的 JSON 文件

最新更新