0.0.2 • Published 9 years ago
karma-ng-i18n-preprocessor v0.0.2
karma-ng-i18n-preprocessor
Preprocessor to use any valid i18n config from JADE file to AngularJS templates.
Installation
Installation is simple using the following:
npm install karma-ng-i18n-preprocessor --save-dev
Configuration
// 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"
}
}
});
};
Example
Locales file
// en.json
{
"lblTest": "Hello"
}
Before
span(id="lblTest") #{__("lblTest")}
After
span(id="lblTest") Hello
You can use other preprocessors together with ng-stripScript
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.