grunt-static-i18n
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -50,3 +50,3 @@ /* | ||
}, | ||
src: ['coverage/test/**/*.js'] | ||
src: ['coverage/test/**/*-spec.js'] | ||
}, | ||
@@ -59,3 +59,3 @@ 'html-cov': { | ||
}, | ||
src: ['coverage/test/**/*.js'] | ||
src: ['coverage/test/**/*-spec.js'] | ||
}, | ||
@@ -68,3 +68,3 @@ 'mocha-lcov-reporter': { | ||
}, | ||
src: ['coverage/test/**/*.js'] | ||
src: ['coverage/test/**/*-spec.js'] | ||
} | ||
@@ -71,0 +71,0 @@ }, |
{ | ||
"name": "grunt-static-i18n", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Grunt plugin to translate static assets.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/beck/grunt-static-i18n", |
@@ -80,3 +80,3 @@ # Static Internationalization | ||
cwd: 'app', | ||
src: 'static/*.json', | ||
src: 'static/*.{js,json}', | ||
dest: 'app/i18n' | ||
@@ -110,2 +110,3 @@ }] | ||
* 0.2.0 - quote translated text when rendering javascript | ||
* 0.1.0 - render non-language defaults to destination | ||
@@ -112,0 +113,0 @@ * 0.0.2 - add coverage reporting |
@@ -39,3 +39,3 @@ /* | ||
locales.forEach(function readPo(lang) { | ||
var po = path.join(options.localeDir, lang, 'LC_MESSAGES', 'messages.po'); | ||
var po = path.join(options.localeDir,lang,'LC_MESSAGES','messages.po'); | ||
if (!grunt.file.exists(po)){ | ||
@@ -66,2 +66,5 @@ grunt.log.warn('Translations not found: ' + po); | ||
grunt.verbose.writeln('Gettext', lang, msgid, text); | ||
if (gt.quoteText) { | ||
text = '"' + text.replace(/"/, '\"') + '"'; | ||
} | ||
return text; | ||
@@ -86,2 +89,4 @@ }; | ||
var translated = false; | ||
// json files do not require gettext to return quoted translations | ||
gt.quoteText = path.extname(filepath) !== '.json'; | ||
var compiled = compileTemplate(filepath); | ||
@@ -88,0 +93,0 @@ if (!compiled) { |
@@ -14,3 +14,3 @@ 'use strict'; | ||
cwd: 'app', | ||
src: 'static/*.json', | ||
src: 'static/*.{js,json}', | ||
dest: 'app/i18n' | ||
@@ -17,0 +17,0 @@ }] |
17519
16
369
116