├── .gitignore
├── LICENSE
├── README.md
├── package.json
├── public
├── favicon.ico
├── index.html
└── intl
│ ├── de.json
│ ├── en.json
│ └── fr.json
├── src
├── app
│ ├── App.css
│ ├── App.js
│ └── App.test.js
├── index.css
├── index.js
└── intl
│ ├── IntlWrapper.js
│ ├── intl.store.js
│ └── setup.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 |
6 | # testing
7 | coverage
8 |
9 | # production
10 | build
11 |
12 | # misc
13 | .idea
14 | .DS_Store
15 | .env
16 | npm-debug.log
17 |
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 James Hill
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | react-router-intl-routing
2 | ====
3 |
4 | An example repo demonstrating dynamic translation of the actual uri segments of the address bar.
5 |
6 | Although I see a few examples of integrating [react-router](https://react-router.now.sh/) and [react-intl](https://github.com/yahoo/react-intl), these by and large, focus
7 | on dynamically re-rendering the page content for a chosen language.
8 |
9 | This takes this concept a step further, in that it demonstrates how simple it is to also have each uri segment in the address bar translated in your chosen language as well. **Examples of this I've not found despite extensive searching!**
10 |
11 | The example uses [Mobx](https://mobxjs.github.io/mobx/) to glue things together, and also [create-react-app](https://github.com/facebookincubator/create-react-app) as a sensible shortcut to get up and running. As `create-react-app` does not - yet - support [decorators](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#can-i-use-decorators) or other experimental features not yet widely adopted from `babel` such as `property-initializers`, I'm afraid you don't get the sugary sweetness with Mobx.
12 |
13 |
14 | `npm start` to get started.
15 |
16 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-router-intl-routing",
3 | "version": "0.1.0",
4 | "private": true,
5 | "devDependencies": {
6 | "react-scripts": "0.7.0"
7 | },
8 | "dependencies": {
9 | "intl": "^1.2.5",
10 | "intl-locales-supported": "^1.0.0",
11 | "mobx": "^2.6.0",
12 | "mobx-react": "^3.5.8",
13 | "mobx-react-devtools": "^4.2.9",
14 | "react": "^15.3.2",
15 | "react-dom": "^15.3.2",
16 | "react-intl": "^2.1.5",
17 | "react-router": "^4.0.0-alpha.4",
18 | "whatwg-fetch": "^1.0.0"
19 | },
20 | "scripts": {
21 | "start": "react-scripts start",
22 | "build": "react-scripts build",
23 | "test": "react-scripts test --env=jsdom"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhchill666/react-router-intl-routing/20195d65079ec3f70165b8654adfd2eb0e6d3b02/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |