如何解决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 举报,一经查实,本站将立刻删除。