GruntFiles替换翻译内容

问题描述

我用grunt更改翻译的日期格式。

也就是说,当我使用欧洲语言时,我使用以下日期格式“ dd-MM-yyyy”,当使用美国格式时,我使用以下格式“ MM-dd-yyyy”。

我还使用翻译模式 i18n angularTranslate ,它们都依赖json文件。

如果我艰苦的任务可以很好地完成对i18n的更改,那么我不知道在angularTranslate方面该怎么做。

这是gruntfiles.js中的函数

translation: {
                files:
                    [...],options:{
                    process: function(content){
                        var replaceDateFormat = /common.dateFormat=dd-MM-yyyy/;
                        var newDateFormat = "common.dateFormat=MM-dd-yyyy";
                        content = content.replace(replaceDateFormat,newDateFormat);
                        return content;
                    }
                }

当我在i18n中进行更改时,上面的示例工作正常

file.european.json

common.dateFormat=dd-MM-yyyy

file.us.json (咕gr声之后)

common.dateFormat=MM-dd-yyyy

现在我想使用以下json格式执行相同的方法

file.european.json

{
  "COMMON": {
     "DATEFORMAT": "dd-MM-yyyy"
   }
}

file.us.json

 {
      "COMMON": {
         "DATEFORMAT": "MM-dd-yyyy"
       }
    }

您对此问题有解决方案吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)