在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):arathunku/gulp-translator开源软件地址(OpenSource Url):https://github.com/arathunku/gulp-translator开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):Gulp Translator
UsageFirst, install npm install --save-dev gulp-translator Then, add it to your var translate = require('gulp-translator');
gulp.task('translate', function() {
var translations = ['pl', 'en'];
translations.forEach(function(translation){
gulp.src('app/views/**/*.html')
.pipe(translate(options))
.pipe(gulp.dest('dist/views/' + translation));
});
}); or better, handle errors: gulp.task('translate', function() {
var translations = ['pl', 'en'];
translations.forEach(function(translation){
gulp.src('app/views/**/*.html')
.pipe(
translate(options)
.on('error', function(){
console.error(arguments);
})
)
.pipe(gulp.dest('dist/views/' + translation));
});
}); Options
UsageI'm using angular-like syntax. Expressions in Following examples assume that "title" in locales equals "new TITLE" Example:
If you'd like to use filters(look at the bottom to check available filters) just pass them after like that:
If you're still not sure, please look at tests. APIgulp-translator is called with a string translate(string)stringType: The string is a path to a nameOfTheFile.yml with your locales. Please look at test/locales for examples. Available filters:
User filters:You also can specify your own filters.
Just add them to TODO:
LicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论