Skip to content

Commit

Permalink
moves sample for next.js to its repo so we do not have to sync those …
Browse files Browse the repository at this point in the history
…anylonger
  • Loading branch information
jamuhl committed Mar 6, 2018
1 parent 910c5b8 commit 7ff5af1
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 299 deletions.
3 changes: 0 additions & 3 deletions example/nextjs/.babelrc

This file was deleted.

50 changes: 6 additions & 44 deletions example/nextjs/README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,13 @@
# Getting started

Build with [next.js](https://github.com/zeit/next.js/).
You find the example for next.js and react-i18next here:

```bash
# npm install
# npm run dev
```
[https://github.com/zeit/next.js/tree/canary/examples/with-react-i18next](https://github.com/zeit/next.js/tree/canary/examples/with-react-i18next)

**open:**
*Using one place for the example makes it easier so we do not have to sync them on every change.*

auto detecting user language: [http://localhost:3000](http://localhost:3000)
Beside that there is also a sample to show the usage with **locize** here:

german: [http://localhost:3000/?lng=de](http://localhost:3000/?lng=de)
[https://github.com/i18next/react-i18next/tree/master/example/nextjs-locize](https://github.com/i18next/react-i18next/tree/master/example/nextjs-locize)

english: [http://localhost:3000/?lng=en](http://localhost:3000/?lng=en)


## The idea behind the example

This example app shows how to integrate [react-i18next](https://github.com/i18next/react-i18next) with [Next](https://github.com/zeit/next.js).

**Plus:**

- Routing and separating translations into multiple files (lazy load them on client routing)
- Child components (pure or using translation hoc)

### Features of this example app

- Server-side language negotiation
- Full control and usage of i18next on express server using [i18next-express-middleware](https://github.com/i18next/i18next-express-middleware) which asserts no async request collisions resulting in wrong language renderings
- Support for save missing features to get untranslated keys automatically created `locales/{lng}/{namespace}.missing.json` -> never miss to translate a key
- Proper pass down on translations via initialProps
- Taking advantage of multiple translation files including lazy loading on client (no need to load all translations upfront)
- Use express to also serve translations for clientside
- In contrast to react-intl the translations are visible both during development and in production

### learn more

- [next.js](https://github.com/zeit/next.js)
- [react-i18next repository](https://github.com/i18next/react-i18next)
- [react-i18next documentation](https://react.i18next.com)

**Translation features:**

- [i18next repository](https://github.com/i18next/i18next)
- [i18next documentation](https://www.i18next.com)

**Translation management:**

- [locize](http://locize.com)
If you like to cover the full localization process beside instrumenting your code for i18n.
15 changes: 0 additions & 15 deletions example/nextjs/components/ExtendedComponent.js

This file was deleted.

10 changes: 0 additions & 10 deletions example/nextjs/components/PureComponent.js

This file was deleted.

59 changes: 0 additions & 59 deletions example/nextjs/i18n.js

This file was deleted.

5 changes: 0 additions & 5 deletions example/nextjs/locales/de/common.json

This file was deleted.

6 changes: 0 additions & 6 deletions example/nextjs/locales/de/home.json

This file was deleted.

6 changes: 0 additions & 6 deletions example/nextjs/locales/de/page2.json

This file was deleted.

5 changes: 0 additions & 5 deletions example/nextjs/locales/en/common.json

This file was deleted.

6 changes: 0 additions & 6 deletions example/nextjs/locales/en/home.json

This file was deleted.

6 changes: 0 additions & 6 deletions example/nextjs/locales/en/page2.json

This file was deleted.

25 changes: 0 additions & 25 deletions example/nextjs/package.json

This file was deleted.

30 changes: 0 additions & 30 deletions example/nextjs/pages/index.js

This file was deleted.

30 changes: 0 additions & 30 deletions example/nextjs/pages/page2.js

This file was deleted.

49 changes: 0 additions & 49 deletions example/nextjs/server.js

This file was deleted.

0 comments on commit 7ff5af1

Please sign in to comment.