oreqizer / gulp-i1337n

DEPRECATED. Static i18n for Gulp! :fire:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-i1337n

Build Status codecov styled with prettier npm (scoped)

A gulp plugin for static translations. Uses babylon under the hood.

Install

yarn add gulp-i1337n --dev

Usage

Replaces calls of a function (default __) with a string from the given translations object.

const gulp = require('gulp');
const i1337n = require('gulp-i1337n');

gulp.task('default', () =>
  gulp
    .src('src/app.js')
    .pipe(i1337n({ hello: 'World!' }))
    .pipe(gulp.dest('dist'))
);

Turns this:

function greet() {
  console.log(__('hello'));
}

Into this:

function greet() {
  console.log('World!');
}

API

Simply pipe the package's export.

i1337n(translations[, options])

translations

Your object of translations. Keys are replaced with values. Value must be a string.

options (optional)

Two properties:

  • func (string) - the function name to search for, default __
  • strict (boolean) - should the plugin fail on missing translation

License

MIT

About

DEPRECATED. Static i18n for Gulp! :fire:


Languages

Language:JavaScript 100.0%