Preprocessor to use any valid i18n config from JADE file to AngularJS templates.
Installation is simple using the following:
npm install karma-ng-i18n-preprocessor --save-dev
// karma.conf.js
module.exports = function(config) {
config.set({
files: [
'content/shared/views/**/*.jade'
],
preprocessors: {
'content/shared/views/**/*.jade': 'ng-i18n'
},
ngi18nPreprocessor: {
i18n : {
"directory" : "./test/mocks/content"
}
}
});
};
// en.json
{
"lblTest": "Hello"
}
span(id="lblTest") #{__("lblTest")}
span(id="lblTest") Hello
npm install karma-ng-jade2js-preprocessor --save-dev
npm install karma-ng-stripscript-preprocessor --save-dev
// karma.conf.js
preprocessors: {
'content/shared/views/**/*.jade': ['ng-i18n','ng-jade2js','ng-stripScript']
}
For more information on Karma see the homepage.