0.0.1 • Published 10 years ago
clear-i18n-loader v0.0.1
clear-i18n-loader
A webpack loader for simple and clear i18n.
Basic Usage
npm install --save clear-i18n-loader
Usually, use it as the last loader require("html!clear-i18n!./index.html").
This loader takes one JSON file for each file containing untranslated strings.
In the text files, put "^" around the untranslated strings.
<div>^Please help me translate this!^</div>var str = '^Please help me translate this!^';If you need the "^" character itself, write double.
<div>^Ha^^_^^ha!^ <span>^^_^^</span></div>
<!-- This means "Ha^_^ha!" need to be translated, and there is a "^_^" followed in the span. -->Do not like "^" character? It is configurable! "`" character might look better, but it is used in ECMAScript 2015...
Options
Tips: write options like this: clear-i18n?{"lang":"en","char":"^"}
langthe target language. It is required, or translations are silently ignored.localePathwhere the translation files locate. It is "path.ext.locale/" by default. The target file is a JSON file named current lang (i.e. "en.json") inside this dir.charthe "^" above. ONLY special ASCII characters are allowed!multilineif there are multiline untranslated strings, please set this to true.generateFilegenerate target translation files, collect and put untranslated strings in. I found this feature quite useful.
License
MIT
0.0.1
10 years ago