Skip to content

Commit

Permalink
Updated the i18n csv and tot he new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Mar 4, 2014
1 parent 0368aaa commit 6742e12
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/i18n/i18n.csv
@@ -1,4 +1,3 @@
,String code,English,French,Afrikaans,Albanian,Arabic,Armenian,Bulgarian,Chinese,Chinese (Simplified),Czech,Dutch,Estonian,German,Greek,Hindi,Hungarian,Icelandic,Indonesian,Italian,Japanese,Korean,Latvian,Lithuanian,Polish,Portuguese,Portuguese (Brazilian),Russian,Slovak,Spanish,Thai,Turkish,Ukrainian,Vietnamese
Language code (ISO 639-1),lang-code,en,fr,af,sq,ar,hy,bg,zh,zh-Hans,cs,nl,et,de,el,hi,hu,is,id,it,ja,ko,lv,lt,pl,pt,pt-BR,ru,sk,es,th,tr,uk,vi Language code (ISO 639-1),lang-code,en,fr,af,sq,ar,hy,bg,zh,zh-Hans,cs,nl,et,de,el,hi,hu,is,id,it,ja,ko,lv,lt,pl,pt,pt-BR,ru,sk,es,th,tr,uk,vi
Language code (ISO 639-2/T),lang-code-iso-639-2,eng,fra,afr,sqi,ara,hye,bul,zho,zho-Hans,cze,nld,est,deu,ell,hin,hun,isl,ind,ita,jpn,kor,lav,lit,pol,por,por-BR,rus,slk,spa,tha,tur,ukr,vie Language code (ISO 639-2/T),lang-code-iso-639-2,eng,fra,afr,sqi,ara,hye,bul,zho,zho-Hans,cze,nld,est,deu,ell,hin,hun,isl,ind,ita,jpn,kor,lav,lit,pol,por,por-BR,rus,slk,spa,tha,tur,ukr,vie
Language direction,lang-dir,ltr,ltr,ltr,ltr,rtl,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr Language direction,lang-dir,ltr,ltr,ltr,ltr,rtl,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr,ltr
Expand Down
38 changes: 18 additions & 20 deletions tasks/i18n.js
Expand Up @@ -39,29 +39,27 @@ module.exports = function(grunt) {
"record", "record",
function(row, index) { function(row, index) {
//Skip the header row //Skip the header row
if (index > 0) { var i,
var i, len = row.length;
len = row.length; // Copy and load the files on the line with the ISO 639-1 code
// Copy and load the files on the line with the ISO 639-1 code if (index === 0) {
if (index === 1) { grunt.log.write("Creating i18n dictionary files\n");
grunt.log.write("Creating i18n dictionary files\n");
for (i = 2; i < len; i += 1) {
var filename = options.dest + row[i] + ".js";
wetLanguages[i - 2] = row[i];
langFiles[i] = basei18n;
outputNames[i] = filename;
}
}
//Replace the language strings with a fallback to the English if the token is missing
for (i = 2; i < len; i += 1) { for (i = 2; i < len; i += 1) {
var match = new RegExp("@" + row[1] + "@", "g"); var filename = options.dest + row[i] + ".js";
var replacement = row[i] === "" ? row[2] : row[i]; wetLanguages[i - 2] = row[i];
//TODO: Normalize quoting once translations can be changed in terms of escape character langFiles[i] = basei18n;
replacement = replacement.replace(/"/g, "\\\""); outputNames[i] = filename;
replacement = replacement.replace(/\\'/g, "'");
langFiles[i] = langFiles[i].replace(match, replacement);
} }
} }
//Replace the language strings with a fallback to the English if the token is missing
for (i = 2; i < len; i += 1) {
var match = new RegExp("@" + row[1] + "@", "g");
var replacement = row[i] === "" ? row[2] : row[i];
//TODO: Normalize quoting once translations can be changed in terms of escape character
replacement = replacement.replace(/"/g, "\\\"");
replacement = replacement.replace(/\\'/g, "'");
langFiles[i] = langFiles[i].replace(match, replacement);
}
} }
).on( ).on(
"end", "end",
Expand Down

0 comments on commit 6742e12

Please sign in to comment.