{"id":16222136,"url":"https://github.com/hugodf/next-i18next-shared-translations-example","last_synced_at":"2026-05-10T16:43:35.590Z","repository":{"id":85774038,"uuid":"599281245","full_name":"HugoDF/next-i18next-shared-translations-example","owner":"HugoDF","description":" next-i18next example of loading translations from a non-public directory","archived":false,"fork":false,"pushed_at":"2023-02-13T16:03:00.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-11T11:54:21.397Z","etag":null,"topics":["i18next","next-i18next","nextjs"],"latest_commit_sha":null,"homepage":"","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/HugoDF.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":"2023-02-08T20:23:25.000Z","updated_at":"2023-02-08T20:25:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f6c949b-5046-4ae5-bde6-b431c10851e5","html_url":"https://github.com/HugoDF/next-i18next-shared-translations-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HugoDF/next-i18next-shared-translations-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fnext-i18next-shared-translations-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fnext-i18next-shared-translations-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fnext-i18next-shared-translations-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fnext-i18next-shared-translations-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HugoDF","download_url":"https://codeload.github.com/HugoDF/next-i18next-shared-translations-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fnext-i18next-shared-translations-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32864092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"ssl_error","status_checked_at":"2026-05-10T13:40:02.145Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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"],"created_at":"2024-10-10T12:11:22.664Z","updated_at":"2026-05-10T16:43:35.556Z","avatar_url":"https://github.com/HugoDF.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## next-i18next shared translations example\n\nModified version of [next-i18next \"simple\" example](https://github.com/i18next/next-i18next/tree/53b7a049266be676ad2d99dd5f62b4d9b5cdc44c/examples/simple).\n\nShowcases the ability to load translations conditionally from a directory other than `public` based on the namespace (or locale).\n\n### Approach\n\n[next-i18next.config.js](./next-i18next.config.js), uses a `localePath` function which checks the namespace. In order for next-i18next to work, `ns` and `serializeConfig: false` need to be provided.\n\nPassing the next-i18next configuration to `appWithTranslation` in [./pages/_app.tsx](./pages/_app.tsx) and each page's `serverSideTranslations`.\n\nThe `footer` content is loaded from `non-public` (`node_modules` also works but only tested on Mac where `cp` is available, after running `npm run dev:setup`).\n\n```js\n  localePath(locale, namespace) {\n    if (namespace === 'footer') {\n      return `./non-public/locales/${locale}/${namespace}.json`;\n    }\n    return `./public/locales/${locale}/${namespace}.json`;\n  },\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugodf%2Fnext-i18next-shared-translations-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugodf%2Fnext-i18next-shared-translations-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugodf%2Fnext-i18next-shared-translations-example/lists"}