arathunku / gulp-translator

*not maintained*
MIT License
11 stars 12 forks source link

Allow for underscores or dashes in locale keys. #1

Closed enrique-ramirez closed 9 years ago

enrique-ramirez commented 10 years ago

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?

NumminorihSF commented 9 years ago

Default pattern is /\{{2}([\w\.\s\"\']+\s?\|\s?translate[\w\s\|]*)\}{2}/g. I tested it few minutes ago. It forks with '_'. Your fail is in no '|translate' after pattern.

p.s. issue is 1 year old. may be somebody need to close it =).