filaraujo / gulp-i18n-localize

localization plugin for gulp
MIT License
8 stars 5 forks source link

how it works? #5

Closed Magicwager closed 6 years ago

Magicwager commented 7 years ago

Can you give me a simple demo to show how it works ? I have set the gulpfile.js like this: gulp.task('i18n', function () { return gulp.src('src//') .pipe(i18n({ delimeters: ['!{', '}!'], locales: ['en','zh_CN'], localeDir: './locale' })) .pipe(gulp.dest('dist')); }); and then I use it in the javascript file like this: console.log(!{'solution'}!), but it doesn't work and show there is no translation.

itmm commented 7 years ago

You have to put your json files into the subdirectories (e.g. ./locale/zh_CN/x.json). If you have key y in file x.json, you have to refer to it as !{ x.y }! in your code.

Hope that helps, it worked for me :-)

marekparal commented 7 years ago

And the way to build json files... only manual?

itmm commented 7 years ago

Yes, that was sufficient for me.

Kind regards, Timm.

Am 21.03.2017 um 14:08 schrieb marekparal notifications@github.com:

And the way to build json files... only manual?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/filaraujo/gulp-i18n-localize/issues/5#issuecomment-288072771, or mute the thread https://github.com/notifications/unsubscribe-auth/AD6aTV3aHT0C44woQ2OYtiSf2AAT5JhUks5rn8vigaJpZM4LoFYf.

filaraujo commented 7 years ago

Thanks for helping @itmm, I added some more documentation that hopefully can help future users.

https://github.com/filaraujo/gulp-i18n-localize#file-structure