{"id":23226084,"url":"https://github.com/simplelocalize/simplelocalize-next-translate","last_synced_at":"2025-08-19T13:32:45.148Z","repository":{"id":117686353,"uuid":"477924313","full_name":"simplelocalize/simplelocalize-next-translate","owner":"simplelocalize","description":"Demo application for React 18+, Next.js 14+ and next-translate 2.6+","archived":false,"fork":false,"pushed_at":"2024-11-25T14:04:11.000Z","size":2664,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-17T09:30:20.327Z","etag":null,"topics":["i18n","localization","next-translate","nextjs","nextjs-example","react","react-i18n","static-site"],"latest_commit_sha":null,"homepage":"https://simplelocalize.io/docs/integrations/next-translate/","language":"CSS","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-04-05T00:45:11.000Z","updated_at":"2024-11-28T10:31:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"c3a95e45-f104-4b82-82e8-b670bfa0ef44","html_url":"https://github.com/simplelocalize/simplelocalize-next-translate","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-translate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fsimplelocalize-next-translate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fsimplelocalize-next-translate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fsimplelocalize-next-translate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplelocalize","download_url":"https://codeload.github.com/simplelocalize/simplelocalize-next-translate/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":["i18n","localization","next-translate","nextjs","nextjs-example","react","react-i18n","static-site"],"created_at":"2024-12-19T00:15:58.191Z","updated_at":"2024-12-19T00:15:58.765Z","avatar_url":"https://github.com/simplelocalize.png","language":"CSS","readme":"![next-translate + SimpleLocalize](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\n## Demo\n\n\n\nhttps://github.com/user-attachments/assets/a9fb0c90-4d9d-4fcc-8157-35933683b0ec\n\n\n\n## Translation files\n\nTranslations are placed in `/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`, `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\n    ├── common.json\n    └── home.json\n```\n\n## next-translate configuration\n\nInstall [next-translate](https://github.com/vinissimus/next-translate) for NextJS\n\n```bash\nnpm install --save next-translate\n```\n\nCreate a configuration file in project root.\n\n📦 file: ./i18n.json\n```json\n{\n  \"locales\": [\"en\", \"es\", \"fr\", \"pl\"],\n  \"defaultLocale\": \"en\",\n  \"pages\": {\n    \"*\": [\"common\"],\n    \"/\": [\"home\"]\n  }\n}\n\n```\n\n## Next.js 14+ and i18n configuration\n\nImport next-translate configuration file into `next.config.js`\n\n```typescript\n// 📦 file: ./next.config.js\nconst nextTranslate = require('next-translate-plugin')\n\nmodule.exports = nextTranslate({\n  webpack: (config, { isServer, webpack }) =\u003e {\n    return config;\n  }\n})\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\napiKey: YOUR_API_KEY\nuploadFormat: single-language-json\nuploadLanguageKey: en\nuploadPath: ./locales/en/{ns}.json\nuploadOptions:\n  - REPLACE_TRANSLATION_IF_FOUND\n\ndownloadFormat: single-language-json\ndownloadLanguageKeys: ['pl', 'fr', 'es']\ndownloadPath: ./locales/{lang}/{ns}.json\n```\n\n⤵️ [Download translations](https://simplelocalize.io/docs/cli/download-translations/) to `./locales` directory\n```bash\nsimplelocalize download\n```\n\n⤴️ [Upload translations](https://simplelocalize.io/docs/cli/upload-translations/) from `./locales` directory\n```bash\nsimplelocalize upload\n```\n\n\n## Usage\n\nExample usage can be found in `pages/index.tsx`.\n\n```typescript\nimport useTranslation from 'next-translate/useTranslation'\n\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## 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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fsimplelocalize-next-translate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplelocalize%2Fsimplelocalize-next-translate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fsimplelocalize-next-translate/lists"}