gulp-ng-json2translate
v0.1.3
Published
Inspired by grunt-json-angular-translate. Wrap json file as angular translate module
Downloads
4
Maintainers
Readme
gulp-ng-json2translate
Plugin that wraps json
as an angular translate module.
Inspired by https://github.com/shahata/grunt-json-angular-translate.
What is the result?
See here
Install
npm install gulp-ng-json2translate
Usage
var gulp=require('gulp');
var json2translate=require('gulp-ng-json2translate');
var concat=require('gulp-concat');
gulp.task('locale',function(){
return gulp.src('./locale/*.json')
.pipe(json2translate({
moduleName:'translations'
}))
.pipe(gulp.dest('./build/'));
});
options.moduleName
Type: Sting
Default: translations
The name of the generated AngularJS module.
options.extractLanguage
Type: Function
Custom function to retrieve language out of file name.
The default function can retrieve the language from files like that:
- message_en.json
- message-en.json
- message.en.json
options.hasPreferredLanguage
Type: Boolean
Default: true
The flag that indicates if there will be preferred language statement at the output file.
Tests
npm test
License
Licensed under the MIT license.