{"id":25379305,"url":"https://github.com/vue-formily/i18n-plugin","last_synced_at":"2026-04-28T11:01:55.818Z","repository":{"id":57169269,"uuid":"401319015","full_name":"vue-formily/i18n-plugin","owner":"vue-formily","description":"Localization plugin for vue-formily.","archived":false,"fork":false,"pushed_at":"2021-09-27T10:20:10.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-08T23:58:44.768Z","etag":null,"topics":["i18n","localization","plugin","vue","vue-formily"],"latest_commit_sha":null,"homepage":"https://vue-formily.netlify.app/plugins/i18n","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/vue-formily.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"hqnan","custom":"https://www.buymeacoffee.com/anha"}},"created_at":"2021-08-30T11:29:03.000Z","updated_at":"2021-09-27T10:20:13.000Z","dependencies_parsed_at":"2022-09-04T11:00:42.525Z","dependency_job_id":null,"html_url":"https://github.com/vue-formily/i18n-plugin","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vue-formily/i18n-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vue-formily%2Fi18n-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vue-formily%2Fi18n-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vue-formily%2Fi18n-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vue-formily%2Fi18n-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vue-formily","download_url":"https://codeload.github.com/vue-formily/i18n-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vue-formily%2Fi18n-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32377599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T09:24:15.638Z","status":"ssl_error","status_checked_at":"2026-04-28T09:24:15.071Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["i18n","localization","plugin","vue","vue-formily"],"created_at":"2025-02-15T05:19:41.116Z","updated_at":"2026-04-28T11:01:55.784Z","avatar_url":"https://github.com/vue-formily.png","language":"JavaScript","funding_links":["https://patreon.com/hqnan","https://www.buymeacoffee.com/anha"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://vue-formily.netlify.app/plugins/i18n\" target=\"_blank\"\u003e\n    \u003cimg width=\"320\" src=\"./.github/logo.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\nLocalization plugin for [**vue-formily**](https://vue-formily.netlify.app).\n\n## Links\n- [📚 \u0026nbsp; Documentation](https://vue-formily.netlify.app/plugins/i18n)\n\n## Installation\n### NPM\n```sh\n# install with yarn\nyarn add @vue-formily/i18n\n\n# install with npm\nnpm install @vue-formily/i18n --save\n```\n\n### CDN\nYou can use **i18n** plugin with a script tag and a CDN, import the library like this:\n\n```html\n\u003cscript src=\"https://unpkg.com/@vue-formily/i18n@latest\"\u003e\u003c/script\u003e\n```\n\nThis will inject a `I18nPlugin` global object, which you will use to access the various methods exposed by the plugin or register to [**vue-formily**](https://vue-formily.netlify.app).\n\nIf you are using native ES Modules, there is also an ES Modules compatible build:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import i18n from 'https://unpkg.com/@vue-formily/i18n@latest/dist/i18n-plugin.esm.js'\n\u003c/script\u003e\n```\n\n### Set Up\n### Vue 3.x\n```typescript\nimport { createApp } from 'vue'\nimport { createFormily } from '@vue-formily/formily';\nimport i18n from '@vue-formily/i18n';\n\nconst formily = createFormily();\n\nformily.plug(i18n, {} as I18nOptions);\n\nconst app = createApp(App)\n\napp.use(formily);\n```\n\n### Vue 2.x\n```typescript\nimport Vue from 'vue';\nimport { createFormily } from '@vue-formily/formily';\nimport i18n from '@vue-formily/date-format';\n\nconst formily = createFormily();\n\nformily.plug(i18n, {} as I18nOptions);\n\nVue.use(formily);\n```\n\n## Options\n```typescript\ntype Resource = Record\u003cstring, string | string[]\u003e;\ntype Locale = {\n  code: string;\n  localize?: Record\u003cstring, any\u003e;\n  resource?: Resource;\n};\n\ntype I18nOptions = {\n  defaultLocale: string;\n  locales?: Locale[];\n}\n```\n\n## Basic Usage\n### Stand Along\n```typescript\nimport i18n from 'vue-formily/plugins/i18n';\n\n// Install plugin and locale\nVueFormily.plug(i18n, {\n  locales: [{\n    ...enUS,\n    resource: {\n      hi: 'Hi, {name}.',\n      weekday: 'Today is {date[6]}.',\n      validation: {\n        dupplicated: '{field} is invalid.'\n      }\n    },\n    // The data will be used to translate the messages above\n    localize: {\n      name: 'Jo',\n      date: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']\n    }\n  }]\n});\n\nVue.use(VueFormily);\n\n// Translation\ni18n.translate('hi'); // Hi, Jo.\n// Nested object\n// The localize data can be checked directly by 2nd parameter\ni18n.translate('validation.dupplicated', {\n  field: 'Email'\n}); // Email is invalid.\n// Array\ni18n.translate('weekday[6]'); // Today is Saturday.\n\ni18n.addLocale({\n  code: 'fr-ca',\n  resource: {\n    hi: 'Bonjour, {name}.'\n  },\n  localize: {\n    name: 'Jo'\n  }\n});\n\ni18n.switchLocale('fr-ca');\n\ni18n.translate('hi') // Bonjour, Jo.\n```\n\n### In Vue Formily\nIn **vue-formily**, the **i18n** is used in the [Rule](https://vue-formily.netlify.app/api/rule), [Field](https://vue-formily.netlify.app/api/field), and [props](https://vue-formily.netlify.app/api/element#properties) for all form elements. Here are some examples:\n- [Localize Using Vue Formily I18n](https://vue-formily.netlify.app/examples/localize#using-vue-formily-i18n)\n- [Localize Using External Library](https://vue-formily.netlify.app/examples/localize#using-external-library)\n\n## Contributing\nYou are welcome to contribute to this project, but before you do, please make sure you read the [Contributing Guide](https://github.com/vue-formily/formily/blob/main/.github/CONTRIBUTING.md).\n\n## License\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvue-formily%2Fi18n-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvue-formily%2Fi18n-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvue-formily%2Fi18n-plugin/lists"}