Giter VIP home page Giter VIP logo

gulp-translator's People

Contributors

arathunku avatar numminorihsf avatar raphaelluchini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gulp-translator's Issues

Translator receive a stream?

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/'));

Allow for underscores or dashes in locale keys.

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?

How to catch parser error

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.