translation-loader
Advanced tools
Comparing version 1.1.0 to 1.1.1
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
@@ -10,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "translation-loader", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Webpack loader that localizes HTML templates and JSON files by injecting translated content.", | ||
@@ -36,15 +36,15 @@ "keywords": [ | ||
"@types/minimatch": "^3.0.3", | ||
"chalk": "^2.3.2", | ||
"gulp-translate": "^1.5.5", | ||
"loader-utils": "^1.1.0", | ||
"chalk": "^2.4.2", | ||
"gulp-translate": "^1.5.8", | ||
"loader-utils": "^1.2.3", | ||
"minimatch": "^3.0.4" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^8.0.1", | ||
"globs": "^0.1.3", | ||
"@types/node": "^10.12.18", | ||
"globs": "^0.1.4", | ||
"html-loader": "^0.5.5", | ||
"json-loader": "^0.5.7", | ||
"typescript": "^2.8.1", | ||
"webpack": "^4.5.0", | ||
"webpack-cli": "^2.0.14" | ||
"typescript": "^3.2.2", | ||
"webpack": "^4.28.4", | ||
"webpack-cli": "^3.2.1" | ||
}, | ||
@@ -51,0 +51,0 @@ "scripts": { |
@@ -10,3 +10,3 @@ translation-loader | ||
This is built on top of the core functionality of [gulp-translate](https://www.npmjs.com/package/gulp-translate), allowing that same workflow to be used together in a Webpack build process, in which templates and JSON files will be localized as they are loaded by Webpack. | ||
This leverages the core functionality of [gulp-translate](https://www.npmjs.com/package/gulp-translate), allowing that exact same workflow to be used in a Webpack build process, with no dependency on Gulp. | ||
@@ -81,3 +81,4 @@ Please refer to the documentation for [gulp-translate](https://www.npmjs.com/package/gulp-translate) for details on capabilities and configuration. | ||
// To build for the specified locale, set the import file path. | ||
translateConfig.importFilePath = `./translation/import/${env.locale}.json`; | ||
translateConfig.importFilePath = | ||
translateConfig.importFilePath.replace("{locale}", env.locale); | ||
@@ -158,5 +159,5 @@ // Set the output file name so we get a bundle for each locale. | ||
// The path to the import file from which content should be imported. | ||
// This will be set depending on the locale being imported. | ||
importFilePath: undefined, | ||
// The path to the import file from which content should be imported, | ||
// where '{locale}' should be replaced with the locale code. | ||
importFilePath: "./translation/import/{locale}.json", | ||
@@ -202,9 +203,9 @@ // Options for 'translation-loader' and the export script. | ||
* `npm build`<br> | ||
* `npm run build`<br> | ||
This will produce a build for the base locale, which could be e.g. `en-US`. | ||
* `npm build --env.locale=en-GB`<br> | ||
* `npm run build --env.locale=en-GB`<br> | ||
This will produce a build localized for the `en-GB` locale, where the contents of your templates and JSON files is replaced with the translated content. | ||
* `npm translate-export`<br> | ||
* `npm run translate-export`<br> | ||
This will export the contents of your templates and JSON files into a file that can be sent to translators, who then produce the import files needed during the build. |
11
208
15165
92
Updatedchalk@^2.4.2
Updatedgulp-translate@^1.5.8
Updatedloader-utils@^1.2.3