arathunku / gulp-translator Goto Github PK
View Code? Open in Web Editor NEW*not maintained*
License: MIT License
*not maintained*
License: MIT License
Hello, there is any chance to translator receive a file stream? For example:
gulp.src('app/views/**/*.html')
.pipe(translate(gulp.src('locales/*.yml')))
.pipe(gulp.dest('dist/views/'));
yamljs
is being used in lib/translator.js
but is missing from the dependencies in package.json
.
With this configuration:
en.yml
page:
section:
main_title: "This is my title"
template.html
{{page.section.main_title}}
gulpfile.js
gulp.task('translate', function() {
translations.forEach(function(translation) {
gulp.src(['app/templates/**/*.html')
.pipe(translate('locales/'+ translation +'.yml'))
.pipe(gulp.dest('dist/' + translation));
});
});
gulp-translator
outputs {{page.section.main_title}}
. However, if I change this to camelCase it works fine. Is there a way I can get underscores to work on locales' keys?
I use gulp-translator
with gulp-watch. Everything works fine until I save a corrupt yml
file like:
foo: "bar"
bar: "foo",
In this case yamljs
will crash and everything after it will crash then, too:
Projects/foo-frontend/node_modules/yamljs/lib/Parser.js:410
throw e;
^
Error: Unexpected characters near ",".
I use gulp-translate
like this (with gulp-load-plugins):
.pipe(
plugins.translator(
{
lang: 'de',
localeDirectory: 'dist/tmp/index/'
}
)
)
So how can I catch (and skip) this error to make sure, gulp-watch
is starting over?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.