{"id":23967912,"url":"https://github.com/telenko/react-localizer","last_synced_at":"2025-08-22T17:08:12.392Z","repository":{"id":57165457,"uuid":"347404671","full_name":"telenko/react-localizer","owner":"telenko","description":"Useful component and hooks to build lazy loading based localization","archived":false,"fork":false,"pushed_at":"2021-04-06T13:11:17.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T02:05:45.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/telenko.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":"2021-03-13T15:19:42.000Z","updated_at":"2021-04-06T13:11:19.000Z","dependencies_parsed_at":"2022-08-30T15:21:06.296Z","dependency_job_id":null,"html_url":"https://github.com/telenko/react-localizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Freact-localizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Freact-localizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Freact-localizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telenko%2Freact-localizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telenko","download_url":"https://codeload.github.com/telenko/react-localizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240491987,"owners_count":19810004,"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":"2025-01-06T23:56:58.801Z","updated_at":"2025-02-24T14:22:06.145Z","avatar_url":"https://github.com/telenko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-localizer\nUseful component and hooks to build lazy loading based localization\n\n# how it works?\nUses 'languagechange' API to detect browser language, then passes browser language into a loader.\n\n# example with react-intl\n```Typescript\n    import { useLocalization, normalizeLocale, VocabularyLoader } from '@telenko/react-localizer';\n    //you can use any other 3pp for rich declarative/imperative localization API\n    import { IntlProvider } from \"react-intl\";\n\n    \n    const customLoader: VocabularyLoader = (lang: string) =\u003e {\n        return import(`../../../translations/${normalizeLocale(lang)}.json`);\n    };\n\n    const CustomLocalizer: React.FC = ({ children }) =\u003e {\n        const [language, vocabulary] = useLocalization(customLoader);\n\n        return \u003cIntlProvider locale={normalizeLocale(language)} messages={vocabulary}\u003e\n                {children}\n            \u003c/IntlProvider\u003e\n    }\n\n    export default CustomLoader;\n```\n\n```TSX\n    import CustomLocalizer from '../somewhere/in/your/project/Localizer';\n    import SomeGuiPage from '../somewhere/in/your/project/SomeGuiPage';\n\n    //Some GUI page will be localized :)\n    const App: React.FC = () =\u003e (\n        \u003cCustomLocalizer\u003e\n            \u003cSomeGuiPage/\u003e\n        \u003c/CustomLocalizer\u003e\n    )\n```\n\n# using out-of-the-box component\n```Typescript\n    import Localizer from '@telenko/react-localizer/src/Localizer';\n    import SomeGuiPage from '../somewhere/in/your/project/SomeGuiPage';\n\n    //Some GUI page will be localized :)\n    const App: React.FC = () =\u003e (\n        \u003cLocalizer localesPath='/translations'\u003e\n            \u003cSomeGuiPage/\u003e\n        \u003c/Localizer\u003e\n    )\n```\n!Note, **Localizer** component will try to fetch locales from 'localesPath' url. Resulting url will be built as following:\n    ```Javascript\n    `${props.localesPath}/${langCode}.json`\n    ```\nIf you want custom behavior (f.e. webpack import), use hook + own component instead (example above)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelenko%2Freact-localizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelenko%2Freact-localizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelenko%2Freact-localizer/lists"}