{"id":30091900,"url":"https://github.com/osedea/ignite-intl","last_synced_at":"2025-08-09T07:53:52.777Z","repository":{"id":57271586,"uuid":"221702602","full_name":"Osedea/ignite-intl","owner":"Osedea","description":"Ignite plugin to add internationalization to your application","archived":false,"fork":false,"pushed_at":"2019-12-09T19:49:53.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-03T08:14:57.980Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Osedea.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}},"created_at":"2019-11-14T13:20:51.000Z","updated_at":"2019-12-09T19:49:49.000Z","dependencies_parsed_at":"2022-09-06T21:52:48.829Z","dependency_job_id":null,"html_url":"https://github.com/Osedea/ignite-intl","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Osedea/ignite-intl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fignite-intl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fignite-intl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fignite-intl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fignite-intl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Osedea","download_url":"https://codeload.github.com/Osedea/ignite-intl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fignite-intl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269548490,"owners_count":24436109,"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","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-09T07:53:49.235Z","updated_at":"2025-08-09T07:53:52.734Z","avatar_url":"https://github.com/Osedea.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ignite Intl plugin\n\nThis plugin will setup your application for internationalization using:\n* https://github.com/react-native-community/react-native-localize : To get data on the locales of the user that are defined in the OS settings\n* https://github.com/formatjs/react-intl : To handle the actual management of translated strings\n\n## Add plugin\n\n```sh\nignite add intl\n```\n\n## Remove plugin\n\n```sh\nignite remove intl\n```\n\n## How yo use in your app\n\nAt `/`OSEDEA, we like simple, working solutions.\n\nAnd when I say simple, I mean simple to *USE*. This setup is not super simple, but it provides a very simple, homogeneous way to add translations after: the `translate` method.\n\nTo your top component (i.e. the one you plug into `AppRegistry.registerComponent`), add the following changes (`./i18n` being the file generated by the plugin if you add the translation files, or the `templates/index.js` file of this repo):\n\n```diff\nimport React, { Component } from 'react';\n+ import * as RNLocalize from 'react-native-localize';\n+ import { RawIntlProvider } from 'react-intl';\n+ import { loadLocale, translate, registerLanguageListener, unregisterLanguageListener, intl, changeLanguage, currentLocale, getLocale } from './i18n';\n\nclass Root extends Component {\n+    state = { locale: currentLocale };\n\n+    componentDidMount() {\n+        // Listen to changes made on the phone\n+        RNLocalize.addEventListener('change', getLocale);\n+        // setState if `changeLanguage` is called from anywhere in the app\n+        registerLanguageListener(this.handleLocalizationChange);\n+        // Loads the locale last saved in AsyncStorage\n+        loadLocale().then((lang) =\u003e lang \u0026\u0026 changeLanguage(lang));\n+    }\n\n+    componentWillUnmount() {\n+        // Cleanup\n+        RNLocalize.removeEventListener('change', getLocale);\n+        unregisterLanguageListener(this.handleLocalizationChange);\n+    }\n\n+    handleLocalizationChange = (locale: string) =\u003e {\n+        this.setState({ locale });\n+    };\n\n    render() {\n        return (\n+            \u003cRawIntlProvider value={intl}\u003e\n-            \u003cApp /\u003e\n+                \u003cApp /\u003e\n+            \u003c/RawIntlProvider\u003e\n        );\n    }\n}\n\nexport default Root;\n```\n\nIn any other component:\n\n```diff\nimport React, { Component } from 'react';\nimport { View, Text } from 'react-native';\n+ import { translate } from '../i18n';\n\nclass SomeComponent extends Component {\n    render() {\n        return (\n            \u003cView\u003e\n-               \u003cText\u003eHey, how are you?\u003c/Text\u003e\n+               \u003cText\u003e{translate({ id: 'hello' })}\u003c/Text\u003e\n            \u003c/View\u003e\n        );\n    }\n}\n\nexport default SomeComponent;\n```\n\nIf you are using [react-navigation](https://github.com/react-navigation/react-navigation), follow [this guide](https://reactnavigation.org/docs/en/localization.html#wiring-up-your-localization-library-to-navigation) to setup your Tabs labels, etc.\n\n## Compatibility \n\nThis has been tested with React Native [0.61.4](https://github.com/facebook/react-native/releases/tag/v0.61.4).\n\n## Contributing\n\nPlease open an issue for any compatibility issues, or provide better interactivity/compatibility through opening a PR! 🙂\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosedea%2Fignite-intl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosedea%2Fignite-intl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosedea%2Fignite-intl/lists"}