{"id":22856185,"url":"https://github.com/wave-play/pilot-i18next","last_synced_at":"2025-03-31T07:45:16.035Z","repository":{"id":61322921,"uuid":"549408052","full_name":"Wave-Play/pilot-i18next","owner":"Wave-Play","description":"Support for i18next in Pilot router","archived":false,"fork":false,"pushed_at":"2022-10-13T16:25:48.000Z","size":1331,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T15:55:57.153Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wave-Play.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-11T06:24:29.000Z","updated_at":"2022-10-11T06:45:12.000Z","dependencies_parsed_at":"2022-10-15T01:40:33.583Z","dependency_job_id":null,"html_url":"https://github.com/Wave-Play/pilot-i18next","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wave-Play%2Fpilot-i18next","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wave-Play%2Fpilot-i18next/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wave-Play%2Fpilot-i18next/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wave-Play%2Fpilot-i18next/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wave-Play","download_url":"https://codeload.github.com/Wave-Play/pilot-i18next/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246436094,"owners_count":20776965,"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":[],"created_at":"2024-12-13T08:07:28.189Z","updated_at":"2025-03-31T07:45:16.000Z","avatar_url":"https://github.com/Wave-Play.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ePilot i18Next\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub license](https://img.shields.io/github/license/Wave-Play/pilot-i18next?style=flat)](https://github.com/Wave-Play/pilot-i18next/blob/main/LICENSE) [![Tests](https://github.com/Wave-Play/pilot-i18next/workflows/CI/badge.svg)](https://github.com/Wave-Play/pilot-i18next/actions) ![npm](https://img.shields.io/npm/v/@waveplay/pilot-i18next) [![minizipped size](https://badgen.net/bundlephobia/minzip/@waveplay/pilot-i18next)](https://bundlephobia.com/result?p=@waveplay/pilot-i18next)\n\n**Support for i18next in Pilot router**\n\n\u003c/div\u003e\n\n## Install\n\nUsing NPM\n\n```bash\nnpm install @waveplay/pilot-i18next next-i18next\n```\n\nUsing Yarn\n\n```bash\nyarn add @waveplay/pilot-i18next next-i18next\n```\n\n## Getting started\n\nRegister your translations with this module using the built-in CLI.\n\n```bash\npilot-i18next build\n```\n\nThis assumes that your i18n translations exist inside `/public/locales`. All this command does is copy those translations into the module and generate a `import-resource.js` for internal use.\n\n## Basic usage\n\nWrap your app export with the `appWithTranslation` function. This will automatically add the `i18n` instance + resources to your app's context.\n\n\u003e `App.tsx`\n```tsx\nconst App = () =\u003e {\n  // ... your code\n};\nexport default appWithTranslation(App);\n```\n\nInclude `serverSideTranslations` in your returned props from your `getServerSideProps` function. Be sure to specify the namespaces you want to load.\n\n\u003e `example-page.tsx`\n```tsx\nexport const getServerSideProps = async (context) =\u003e {\n  const { locale } = context;\n\n  return {\n    props: {\n      ...(await serverSideTranslations(locale, ['common']))\n    }\n  };\n};\n```\n\nYou're now ready to use the `useTranslation` hook in your components!\n\n\u003e `example-page.tsx`\n```tsx\nconst ExamplePage = () =\u003e {\n  const { t } = useTranslation('common');\n\n  return (\n    \u003cView\u003e\n      \u003cText\u003e{t('title')}\u003c/Text\u003e\n    \u003c/View\u003e\n  );\n};\n```\n\nIt's recommended to import the `useTranslation` hook directly from `react-i18next`.\n\n## Common issues\n\nYour bundler may complain about the `fs` module not being found. This is because this module exports `next-i18next` on web builds, which are not meant to be used on native.\n\nTo fix this, create two files named the same way, but one with a `.native.ts` extension like this:\n\n\u003e `pilot-i18next.ts`\n```ts\nexport * from '@waveplay/pilot-i18next/dist/index';\n```\n\n\u003e `pilot-i18next.native.ts`\n```ts\nexport * from '@waveplay/pilot-i18next/dist/index.native';\n```\n\n... and change your imports in your code to use this file instead.\n\u003e `App.tsx`\n```ts\nimport { appWithTranslation, serverSideTranslations } from './pilot-i18next';\n```\n\nYour bundler should now happily import only the `.native` version on native builds, keeping the `fs` issue away.\n\n## Credits\n\nThis project was originally developed for [WavePlay](https://waveplay.com).\n\n## License\n\nThe MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwave-play%2Fpilot-i18next","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwave-play%2Fpilot-i18next","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwave-play%2Fpilot-i18next/lists"}