From 45b35cda2e2e3beb00b54e52d9f5e99e258cd417 Mon Sep 17 00:00:00 2001 From: Patrick Chua Date: Tue, 26 May 2015 16:40:35 +0800 Subject: [PATCH 1/3] Fix Windows 'fs' issue on webpack -- Added npm run build and npm run extract commands. -- Added Japanese samples --- examples/webpack/README.md | 5 +++-- examples/webpack/assets/ja-JP.svg | 5 +++++ examples/webpack/components/Header.js | 3 ++- examples/webpack/config/locales/generated/en.json | 2 +- examples/webpack/config/locales/ja-JP.json | 8 ++++++++ examples/webpack/package.json | 4 ++++ examples/webpack/webpack.config.js | 3 +++ 7 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 examples/webpack/assets/ja-JP.svg create mode 100644 examples/webpack/config/locales/ja-JP.json diff --git a/examples/webpack/README.md b/examples/webpack/README.md index 7e44137..fa11c79 100644 --- a/examples/webpack/README.md +++ b/examples/webpack/README.md @@ -6,8 +6,9 @@ the basic features of react-i18nliner. ## How do I run it? 1. `npm install` -2. `webpack` (assuming `./node_modules/.bin` is in your PATH) -3. open index.html in a browser +2. `npm run build` (uses `./node_modules/.bin/webpack` from your dependencies) +3. `npm run extract` to generate sample json translations. +4. open index.html in a browser ## What's this stuff in config/locales? diff --git a/examples/webpack/assets/ja-JP.svg b/examples/webpack/assets/ja-JP.svg new file mode 100644 index 0000000..05ca699 --- /dev/null +++ b/examples/webpack/assets/ja-JP.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/examples/webpack/components/Header.js b/examples/webpack/components/Header.js index cda0be5..a0062ed 100644 --- a/examples/webpack/components/Header.js +++ b/examples/webpack/components/Header.js @@ -28,7 +28,8 @@ module.exports = React.createClass({ , , , - + , + diff --git a/examples/webpack/config/locales/generated/en.json b/examples/webpack/config/locales/generated/en.json index 6c9ed37..4410a0b 100644 --- a/examples/webpack/config/locales/generated/en.json +++ b/examples/webpack/config/locales/generated/en.json @@ -1 +1 @@ -{"en":{"this_is_so_great_811d0088":"This is so great","language_language_e22e71c":"Language: %{language}","create_num_groups_8b20f408":"Create %{num} groups","click_here_to_get_started_b8ee8d7b":"*Click here* to get started"}} +{"en":{"this_is_so_great_811d0088":"This is so great","language_language_e22e71c":"Language: %{language}","create_num_groups_8b20f408":"Create %{num} groups","click_here_to_get_started_b8ee8d7b":"*Click here* to get started"}} \ No newline at end of file diff --git a/examples/webpack/config/locales/ja-JP.json b/examples/webpack/config/locales/ja-JP.json new file mode 100644 index 0000000..3dd57c2 --- /dev/null +++ b/examples/webpack/config/locales/ja-JP.json @@ -0,0 +1,8 @@ +{ + "ja-JP": { + "this_is_so_great_811d0088": "これはとても素晴らしい", + "language_language_e22e71c": "言語: %{language}", + "create_num_groups_8b20f408": "作成 %{num} グループ", + "click_here_to_get_started_b8ee8d7b": "*クリックしてここ* 始めるために" + } +} \ No newline at end of file diff --git a/examples/webpack/package.json b/examples/webpack/package.json index f361da5..15390c2 100644 --- a/examples/webpack/package.json +++ b/examples/webpack/package.json @@ -8,5 +8,9 @@ "react": "0.13.x", "react-i18nliner": "../..", "webpack": "^1.9.8" + }, + "scripts": { + "build": "./node_modules/.bin/webpack", + "extract": "./node_modules/.bin/i18nliner export" } } diff --git a/examples/webpack/webpack.config.js b/examples/webpack/webpack.config.js index fdc1cb8..9e9874f 100644 --- a/examples/webpack/webpack.config.js +++ b/examples/webpack/webpack.config.js @@ -7,6 +7,9 @@ module.exports = { path: __dirname, filename: "bundle.js" }, + node: { + fs: 'empty', + }, module: { loaders: [ { test: /\.js$/, loader: "jsx-loader!react-i18nliner/webpack-loader" }, From 7c0e1f8b273d0fce9bea8880b25bd4bb548632ca Mon Sep 17 00:00:00 2001 From: Celestz Date: Mon, 8 Jun 2015 21:45:48 +0800 Subject: [PATCH 2/3] Update JP selection verbiage --- examples/webpack/components/Header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webpack/components/Header.js b/examples/webpack/components/Header.js index a0062ed..92457be 100644 --- a/examples/webpack/components/Header.js +++ b/examples/webpack/components/Header.js @@ -29,7 +29,7 @@ module.exports = React.createClass({ , , , - + From c0967bfb4f1188288abd709bf98433b335612f56 Mon Sep 17 00:00:00 2001 From: Celestz Date: Mon, 8 Jun 2015 21:47:09 +0800 Subject: [PATCH 3/3] Update webpack.config.js --- examples/webpack/webpack.config.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/webpack/webpack.config.js b/examples/webpack/webpack.config.js index 9e9874f..fdc1cb8 100644 --- a/examples/webpack/webpack.config.js +++ b/examples/webpack/webpack.config.js @@ -7,9 +7,6 @@ module.exports = { path: __dirname, filename: "bundle.js" }, - node: { - fs: 'empty', - }, module: { loaders: [ { test: /\.js$/, loader: "jsx-loader!react-i18nliner/webpack-loader" },