From f33087be1f650c2b998b3921ab737b3f711fb90f Mon Sep 17 00:00:00 2001 From: Stijn de Witt Date: Mon, 7 Nov 2016 10:03:57 +0100 Subject: [PATCH] 1.2.0: Updated i18nline --- README.md | 65 +++++++++++++++++++++++++++----------- dist/extensions/i18n_js.js | 1 + extensions/i18n_js.js | 1 + i18n.js | 4 +++ package.json | 6 ++-- 5 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 i18n.js diff --git a/README.md b/README.md index 1b883d0..b9d95a3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ██║ ██║ ██║███████╗██║ ██║╚██████╗ ██║ ██║ ██║ ╚████║███████╗██║██║ ╚████║███████╗ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝╚══════╝╚═╝╚═╝ ╚═══╝╚══════╝ - KEEP YOUR TRANSLATIONS IN LINE - WITH PREACT! + keep your translations in line - with preact! ``` preact-i18nline brings [I18nline](https://github.com/download/i18nline) @@ -133,12 +133,12 @@ within a translated element. ## Installation ```sh -npm install -S i18n-js i18nline preact-i18nline +npm install -S i18nline preact-i18nline ``` ## Configuration -In your `package.json`, create an object named `"i18nline"` and +In your `package.json`, create an object named `"i18n"` and specify your project's global configuration settings there. Or, if you prefer, you can create a `.i18nrc` options file in the root of your project. @@ -206,37 +206,63 @@ you use ember-cli, sprockets, grunt concat, etc., it's relatively painless to add a little glue code that runs preprocess on each source file. -### 4. add the preact-i18nline runtime extensions to i18n-js +## Add the preact-i18nline runtime extensions to i18n -Assuming you have a cjs-style app, do something like this: +Both i18nline and preact-i18nline add some extensions to i18n.js to +help with the runtime processing of the translations. You can require +I18n via preact-i18nline to get a `I18n` object that has all extensions +applied already: ```js -var I18n = require("./path/to/cjs'd/i18n"); -require("i18nline/dist/lib/extensions/i18n_js")(I18n); -require("preact-i18nline/dist/extensions/i18n_js")(I18n); +var I18n = require("preact-i18nline/i18n"); ``` -If you're using AMD/`