gulp-ng-json2translate

0.1.3 • Public • Published

gulp-ng-json2translate

Built with Gulp

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:

  1. message_en.json
  2. message-en.json
  3. 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.

Package Sidebar

Install

npm i gulp-ng-json2translate

Weekly Downloads

1

Version

0.1.3

License

MIT

Last publish

Collaborators

  • felixmosh