gulp-i18n-at-once
Perform integrated I18N processes for Polymer i18n-behavior at once (experimental)
Polymer CLI/polymer-build style projects with the project root as its source root.
Note: Currently only applicable toInstall
npm install --save-dev gulp-i18n-at-once
Integrated I18N Processes
- scan - Scan HTMLs and construct localizable attributes repository
- basenameSort - Sort source files according to their base names; Bundle files come first.
- dropDefaultJSON - Drop default JSON files to avoid overwriting new ones
- preprocess - Preprocess Polymer templates for I18N
- tmpJSON - Store extracted JSON in the temporary folder .tmp
- importXliff - Import XLIFF into JSON
- leverage - Merge changes in default JSON into localized JSON
- exportXliff - Generate bundles and export XLIFF
- feedback - Update JSON and XLIFF in sources
Usage
Applied to the gulpfile.js
from generator-polymer-init-custom-build
for Polymer CLI
/*** @license* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt* Code distributed by Google as part of the polymer project is also* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt** Based on: https://github.com/Polymer/polymer-build/blob/master/test/test-project/gulpfile.js*/ 'use strict'; const del = ;const gulp = ;const gulpif = ;const imagemin = ;const logging = ;const mergeStream = ; // Got problems? Try logging 'em// logging.setVerbose(); const polymer = ;const PolymerProject = polymerPolymerProject;const fork = polymerforkStream;const addServiceWorker = polymeraddServiceWorker; const polymerJSON = ;const project = polymerJSON; // ========================================== BEGINconst debug = ;const i18nAtOnce = ; let options = xliffOptions: xliffStates: 'add' : 'new' 'replace': 'needs-translation' 'needs-adaptation' 'needs-l10n' '' 'review' : 'needs-review-translation' 'needs-review-adaptation' 'needs-review-l10n' 'default': 'translated' 'signed-off' 'final' '[source~=nonTargets]' '[approved]' patterns: 'nonTargets': /^$/ 'annotationsAndTags': /^$/ 'annotations': /^$/ 'numbers': /^[0-9.]{1,}$/ 'tags': /^<[-a-zA-Z]{1,}>$/ ;// ========================================== END // Clean build directorygulp; gulp; gulp; gulp;
API
i18nAtOnce(options)
options
object
TBD