{"id":23226077,"url":"https://github.com/simplelocalize/simplelocalize-next-i18next","last_synced_at":"2025-08-19T13:32:44.673Z","repository":{"id":117686367,"uuid":"456504232","full_name":"simplelocalize/simplelocalize-next-i18next","owner":"simplelocalize","description":"React localization example app for React 18+, Next.js 14+ and next-i18next","archived":false,"fork":false,"pushed_at":"2024-11-25T13:17:33.000Z","size":1589,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-17T09:30:20.142Z","etag":null,"topics":["i18next","next-i18next","nextjs","react-localization"],"latest_commit_sha":null,"homepage":"https://simplelocalize.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplelocalize.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-07T12:52:04.000Z","updated_at":"2024-11-28T10:32:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"77d645e4-019f-40f3-972d-dad1ed3b6c62","html_url":"https://github.com/simplelocalize/simplelocalize-next-i18next","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fsimplelocalize-next-i18next","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fsimplelocalize-next-i18next/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fsimplelocalize-next-i18next/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fsimplelocalize-next-i18next/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplelocalize","download_url":"https://codeload.github.com/simplelocalize/simplelocalize-next-i18next/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230355847,"owners_count":18213539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["i18next","next-i18next","nextjs","react-localization"],"created_at":"2024-12-19T00:15:54.069Z","updated_at":"2024-12-19T00:15:54.558Z","avatar_url":"https://github.com/simplelocalize.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![next-i18next and SimpleLocalize example](screenshot.png)\n\nThis is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).\n\n## Translations location\n\nTranslations are placed in `/public/locales/{lang}/{ns}.json`\n\n- `{ns}` - namespace, allows you to split translation keys into multiple files\n- `{lang}` - language\n\nIn this example there are two namespaces: `common` and `home` and 4 locales: `en`, `es`, `fr_FR`, `pl`.\n\n\n```bash\n.\n├── en\n│   ├── common.json\n│   └── home.json\n├── es\n│   ├── common.json\n│   └── home.json\n├── pl\n│   ├── common.json\n│   └── home.json\n└── fr_FR\n    ├── common.json\n    └── home.json\n```\n\n## i18next configuration\n\nInstall i18next for NextJS\n\n```bash\nnpm install --save next-i18next\n```\n\nCreate a configuration file in project root.\n\n```typescript\n// 📦 file: ./next-i18next.config.js\nmodule.exports = {\n  i18n: {\n    defaultLocale: 'en',\n    locales: ['en', 'es', 'pl', 'fr_FR'],\n  },\n};\n```\n\n## NextJS + i18n configuration\n\nImport i18next configuration file into `next.config.js`\n\n```typescript\n// 📦 file: ./next.config.js\nconst {i18n} = require(\"./next-i18next.config\");\nconst nextConfig = {\n  reactStrictMode: true,\n  i18n\n}\n\nmodule.exports = nextConfig\n```\n\n## SimpleLocalize configuration\n\n💿 Install [SimpleLocalize CLI](https://simplelocalize.io/docs/cli/get-started/)\n```bash\ncurl -s https://get.simplelocalize.io/2.7/install | bash\n```\n\n🧷 Create configuration file\n\n```yaml\n# 📦 file: ./simplelocalize.yml\nuploadFormat: single-language-json\nuploadLanguageKey: en\nuploadPath: ./public/locales/en/{ns}.json\nuploadOptions:\n  - REPLACE_TRANSLATION_IF_FOUND\n\ndownloadFormat: single-language-json\ndownloadLanguageKeys: ['pl', 'fr', 'es']\ndownloadPath: ./public/locales/{lang}/{ns}.json\n```\n\n⤵️ [Download translations](https://simplelocalize.io/docs/cli/download-translations/) to `./public/locales` directory\n```bash\nsimplelocalize download\n```\n\n⤴️ [Upload translations](https://simplelocalize.io/docs/cli/upload-translations/) from `./public/locales` directory\n```bash\nsimplelocalize upload\n```\n\n\u003e You can [automate process of adding translation keys](https://simplelocalize.io/docs/integrations/i18next/) from project to SimpleLocalize.\n\n\n## Usage\n\nExample usage can be found in `pages/index.tsx`.\n\n```typescript\n//translations from common.json\nconst {t} = useTranslation('common');\nconsole.log(t('LEARN_MORE')) // output: Learn more\n\n//translations from home.json\nconst {t: homeT} = useTranslation('home');\nconsole.log(homeT('HELLO_WORLD')) // output: Hello world\n```\n\n\n\n\n## Try out this demo\n\nFirst, run the development server:\n\n```bash\nnpm run dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) with your browser to see the result.\n\nYou can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fsimplelocalize-next-i18next","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplelocalize%2Fsimplelocalize-next-i18next","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fsimplelocalize-next-i18next/lists"}