|
1 | 1 | ## Demo
|
2 |
| -[Checkout working demo with 3 languages](https://react-intl.simplelocalize.io) |
| 2 | +[Live demo](https://react-intl.simplelocalize.io) |
3 | 3 |
|
4 |
| -## Available Scripts |
| 4 | +## Overview |
| 5 | + |
| 6 | +Sample application with 3 languages. The application is built with React 18, react-intl. It uses React Context to keep translation messages |
| 7 | +and FormattedMessage components with **predefined message IDs.** |
| 8 | + |
| 9 | +```tsx |
| 10 | +<FormattedMessage id="USE_BUTTONS_BELOW" /> |
| 11 | +``` |
| 12 | + |
| 13 | +To **use auto-generated message IDs**, please [eject the app](https://create-react-app.dev/docs/available-scripts/#npm-run-eject) |
| 14 | + and follow the [Bundling with FormatJS](https://formatjs.io/docs/guides/bundler-plugins/) instructions. |
| 15 | + |
| 16 | +## Built with |
| 17 | +- Create React App |
| 18 | +- React 18+ |
| 19 | +- TypeScript 4+ |
| 20 | +- React Hooks |
| 21 | +- React Context |
| 22 | +- React Intl - library for internationalization |
| 23 | +- SimpleLocalize - translation management system |
| 24 | + |
| 25 | +## Extracting translations |
| 26 | + |
| 27 | +In the project directory, you can run: |
| 28 | +### `npm run i18n:extract` |
| 29 | +to extract messages from source code to `lang/en.json` file. |
| 30 | + |
| 31 | +### `npm run i18n:upload` |
| 32 | +to upload messages to the SimpleLocalize service. |
| 33 | + |
| 34 | +### `npm run i18n:download` |
| 35 | +to download messages locally from the SimpleLocalize service. This is optional and it requires to change SimpleLocalize.tsx |
| 36 | +to load translations from local files. |
| 37 | + |
| 38 | +> Please provide a valid API Key in `simplelocalize.yml` configuration file. |
| 39 | +
|
| 40 | +## Running application locally |
5 | 41 |
|
6 | 42 | In the project directory, you can run:
|
7 | 43 |
|
8 |
| -### `yarn start` |
| 44 | +### `npm install && npm start` |
9 | 45 |
|
10 | 46 | Runs the app in the development mode.<br />
|
11 | 47 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
0 commit comments