Socket
Socket
Sign inDemoInstall

grunt-i18n-templates

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-i18n-templates - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

2

package.json
{
"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>"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc