Skip to content

Commit

Permalink
Getting ready for npm
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-seville committed Feb 26, 2013
1 parent 5246adb commit 2b0fdbd
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
node_modules
node_modules
example/real
4 changes: 0 additions & 4 deletions example/real/en.json

This file was deleted.

18 changes: 0 additions & 18 deletions example/real/en.xml

This file was deleted.

4 changes: 0 additions & 4 deletions example/real/fr.json

This file was deleted.

18 changes: 0 additions & 18 deletions example/real/fr.xml

This file was deleted.

1 change: 0 additions & 1 deletion example/real/test.html

This file was deleted.

25 changes: 24 additions & 1 deletion lib/extract.js
Expand Up @@ -15,7 +15,7 @@ module.exports = function(options){
//Set up i18n configs
i18n.configure({
locales:options.languageArray,
register: global,
//register: global,
updateFiles: false,
extension: options.extension || '.json',
readFcn: function(language){
Expand Down Expand Up @@ -47,6 +47,28 @@ module.exports = function(options){
return transStr;
}
);
handlebars.registerHelper('I18ns',
function(str){

var transStr = str;// (i18n !== undefined ? i18n.__.apply(this,arguments) : str);

translations[i18n.getLocale()][str] = transStr;
return transStr;


}
);
handlebars.registerHelper('I18np',
function(str){

var transStr = str;// (i18n !== undefined ? i18n.__n.apply(this,arguments) : str);

translations[i18n.getLocale()][str] = transStr;
return transStr;


}
);

//now we apply the template so that i18n can generate the files
for(var j=0;j<options.languageArray.length;j++){
Expand All @@ -56,6 +78,7 @@ module.exports = function(options){
for(var k=0;k<handlebarsTemplates.length;k++){
//we don't need to keep this result
var result = handlebarsTemplates[k](options.translations[currLang]);

}
}
return translations;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -8,10 +8,10 @@
"url": ""
},
"main": "Gruntfile.js",
"dependencies":{
"dependencies": {
"handlebars": "*",
"i18n": "git://github.com/alex-seville/i18n-node.git",
"grunt": "*",
"grunt-contrib-jshint": "*"
"grunt-contrib-jshint": "*"
}
}
}

0 comments on commit 2b0fdbd

Please sign in to comment.