Gathering detailed insights and metrics for @ilabdev/translate
Gathering detailed insights and metrics for @ilabdev/translate
Gathering detailed insights and metrics for @ilabdev/translate
Gathering detailed insights and metrics for @ilabdev/translate
npm install @ilabdev/translate
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
@ilabdev/translate
Gulp tasks for translating PHP files
Install @ilabdev/translate
1npm install @ilabdev/translate --save-dev 2 3-- OR -- 4 5yarn add @ilabdev/translate --dev
Include @ilabdev/translate
in your gulpfile.js
NOTE: Make sure you pass gulp
through to the package as shown below. The package sets up gulp tasks and will need it passed through to work.
1require( '@ilabdev/translate' )( gulp )
Add the content from config.sample.js
to your .gulpconfig.js
and adjust as appropriate
1module.exports = { 2 // Other configs here... 3 translate: { 4 process: true, 5 watch: true, 6 logColor: 'black', 7 areas: [ 8 { 9 paths: { 10 src: './**/*.php', 11 watch: './**/*.php', 12 dest: './languages/PACKAGE.pot', 13 }, 14 pipes: { 15 // Put any pipe overrides here 16 src: { 17 allowEmpty: true, 18 }, 19 dest: {}, 20 }, 21 }, 22 ], 23 pipes: { 24 watch: { 25 events: 'all', 26 }, 27 checktextdomain: { 28 /* eslint-disable camelcase */ 29 text_domain: 'PACKAGE', 30 keywords: [ 31 '__:1,2d', 32 '_e:1,2d', 33 '_x:1,2c,3d', 34 '_ex:1,2c,3d', 35 '_n:1,2,4d', 36 '_nx:1,2,4c,5d', 37 '_n_noop:1,2,3d', 38 '_nx_noop:1,2,3c,4d', 39 'esc_html__:1,2d', 40 'esc_html_e:1,2d', 41 'esc_html_x:1,2c,3d', 42 'esc_attr__:1,2d', 43 'esc_attr_e:1,2d', 44 'esc_attr_x:1,2c,3d', 45 ], 46 report_missing: true, 47 report_success: false, 48 report_variable_domain: true, 49 correct_domain: true, 50 create_report_file: false, 51 force: false, 52 /* eslint-enable camelcase */ 53 }, 54 pot: { 55 domain: 'PACKAGE', 56 package: 'Project Name', 57 lastTranslator: 'PACKAGE AUTHOR <PACKAGE@EMAIL.COM>', 58 headers: { 59 'Language-Team': 'PACKAGE AUTHOR <PACKAGE@EMAIL.COM>', 60 }, 61 }, 62 }, 63 }, 64 // Other configs here... 65}
Run gulp translate
to run the translation task, gulp translate:watch
to run the watch task, or add the task as a script and run that with npm
or yarn
process
Type: boolean
Whether to translate PHP files or not
watch
Type: boolean
Whether to watch PHP files for changes or not
loggerColor
Type: string
The logger color to use for any output text. See https://github.com/stgdp/fancy-logger#available-modifiers for colors that can be used
areas
Type: object[]
The areas to be translated. Each area has it's own, isolated settings to allow for separate configs
areas[].paths
Type: object
Path references for the translator
areas[].paths.src
Type: string[]|string
The paths to translated. Passed through to gulp.src
, items can be globs
areas[].paths.watch
Type: string[]|string
The paths to watched. These are combined into a single array and passed through to gulp.watch
areas[].paths.dest
Type: string
The destination file of the .pot
output. Passed through to gulp.dest
, items can be globs
areas[].pipes
Type: object
Options to be passed through to the pipes.
areas[].pipes.src
Type: object
Options to be passed through to the gulp.src
pipe. See https://gulpjs.com/docs/en/api/src/ for more information
areas[].pipes.dest
Type: object
Options to be passed through to the gulp.dest
pipe. See https://gulpjs.com/docs/en/api/dest/ for more information
pipes
Type: object
Options to be passed through to the pipes.
pipes.watch
Type: object
Options to be passed through to the gulp.watch
pipe. See https://gulpjs.com/docs/en/api/watch/ for more information
pipes.checktextdomain
Type: object
Options to be passed through to gulp-checktextdomain
. See https://www.npmjs.com/package/gulp-checktextdomain for more information
pipes.pot
Type: object
Options to be passed through to gulp-wp-pot
. See https://www.npmjs.com/package/gulp-wp-pot for more information
No vulnerabilities found.
No security vulnerabilities found.