grunt-i18n-templates
Advanced tools
Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "grunt-i18n-templates", | ||
"description": "i18n for front-end templates.", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"homepage": "https://github.com/M-jerez/i18nTemplates", | ||
@@ -6,0 +6,0 @@ "main": "tasks/i18nTemplates.js", |
@@ -165,4 +165,8 @@ # grunt-i18nTemplates | ||
## Release History | ||
`0.1.4` fix bug that overrides the values stored in the locales files. | ||
`0.1.3` Improve Log Info and update Readme. | ||
`0.1.2` fix bugs. | ||
`0.1.0` first working version. |
@@ -175,6 +175,6 @@ /** | ||
var defnum = " " + Object.keys(this.defLines).length; | ||
console.log("---------------------------------------------"); | ||
console.log("Parsed " + fnum.green + " files. Found " + defnum.blue + " locale definitions."); | ||
console.log("\nGenerated Templates files: \n" + self.generatedTemplates); | ||
console.log("\nGenerated Locales files: \n" + self.generatedLocales); | ||
console.log("-------------------------------------"); | ||
console.log("Parsed " + fnum.cyan + " files, found " + defnum.blue + " locale definitions."); | ||
console.log("Templates => " + self.generatedTemplates); | ||
console.log("Localizations => " + self.generatedLocales); | ||
} | ||
@@ -247,3 +247,3 @@ | ||
definitions += ""; | ||
console.log("file " + fileName.green + "; found " + definitions.blue + " locale definitions.") | ||
console.log("file " + fileName.cyan + ", found " + definitions.blue + " locale definitions.") | ||
}; | ||
@@ -273,3 +273,3 @@ | ||
console.log("Key '" + key + " in " | ||
+ lang + self.localesSuffix + "' Not found, used the value from the original template."); | ||
+ lang + self.localesSuffix + "' Not found, using value from the template."); | ||
} | ||
@@ -289,5 +289,7 @@ return sentence; | ||
this.overrideNewLocales = function overrideNewLocales() { | ||
var processed = false; | ||
Object.keys(this.locales).forEach(function (lang) { | ||
if (lang !== "original") { | ||
var fName = path.join(self.localesDest, lang + self.localesSuffix); | ||
processed = true; | ||
var fName = path.join(self.localesDest, lang +"_"+self.localesSuffix); | ||
try { | ||
@@ -300,5 +302,11 @@ var old = grunt.file.readJSON(fName); | ||
// if the file does not exist locales is just not override. | ||
console.log(fileNotFound); | ||
console.log("locale not found: ". fName); | ||
} | ||
} | ||
}); | ||
if(!processed){ | ||
grunt.fail.warn("Not possible to read values from previous locales, " + | ||
"aborting operation to avoid erase any locale file." , 3); | ||
} | ||
}; | ||
@@ -317,3 +325,6 @@ | ||
grunt.file.write(fName, JSON.stringify(self.templates[lang], null, '\t')); | ||
self.generatedTemplates += (prefix + self.templatesSuffix).green + " ; "; | ||
if(prefix === "") | ||
self.generatedTemplates += (prefix + self.templatesSuffix).underline.cyan + " , "; | ||
else | ||
self.generatedTemplates += (prefix + self.templatesSuffix).cyan + " , "; | ||
}); | ||
@@ -320,0 +331,0 @@ }; |
{ | ||
"test:hello": "hello world" | ||
"test:hello": "hello hghfgf" | ||
} |
{ | ||
"test": "<!DOCTYPE html>\r\n<html>\r\n<head lang=\"en\">\r\n <meta charset=\"UTF-8\">\r\n <title></title>\r\n</head>\r\n<body>\r\n hello world\r\n</body>\r\n</html>" | ||
"test": "<!DOCTYPE html>\r\n<html>\r\n<head lang=\"en\">\r\n <meta charset=\"UTF-8\">\r\n <title></title>\r\n</head>\r\n<body>\r\n hello hghfgf\r\n</body>\r\n</html>" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26638
437
172