@intlify/vue-i18n-bridge
Advanced tools
Comparing version 0.0.0-18527c9 to 0.0.0-6c9d585
{ | ||
"name": "@intlify/vue-i18n-bridge", | ||
"version": "0.0.0-18527c9", | ||
"version": "0.0.0-6c9d585", | ||
"description": "Vue I18n bridging for Vue 2 & Vue 3", | ||
@@ -68,4 +68,3 @@ "peerDependencies": { | ||
"postinstall": "node ./scripts/postinstall.js" | ||
}, | ||
"readme": "# @intlify/vue-i18n-bridge\n\nVue I18n bridging for Vue 2 & Vue 3\n\n> This library is inspired by [vue-demi](https://github.com/vueuse/vue-demi)\n\n## đ Features\n- Vue I18n composable APIs available on Vue 2 & Vue 3 (e.g `createI18n`, `useI18n`)\n- Auto detect Vue Router version on bundling\n- Manual switch versions\n## đŋ Installation\n\n```sh\n# npm\nnpm install @intlify/vue-i18n-bridge\n\n# yarn\nyarn add @intlify/vue-i18n-bridge\n\n# pnpm\npnpm add @intlify/vue-i18n-bridge\n```\n\n## âī¸ Dependencies\n\nYou need to add `vue-i18n` and `@vue/composition-api` to your plugin's peer dependencies to specify what versions you support.\n\n```js\n{\n \"dependencies\": {\n \"@intlify/vue-i18n-bridge\": \"latest\"\n },\n \"peerDependencies\": {\n \"@vue/composition-api\": \"^1.0.0-rc.1\",\n \"vue-i18n\": \"^8.26.1\" // or \"^9.2.0-beta.25\" or later base on your preferred working environment\n \"vue-i18n-bridge\": \"^9.2.0-beta.25\" // if you use `vue-i18n@v8.26.1` or later, you need to configure deps\n },\n \"peerDependenciesMeta\": {\n \"@vue/composition-api\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"vue-i18n\": \"^8.26.1\", // or \"^9.2.0-beta.25\" or later base on your preferred working environment\n \"vue-i18n-bridge\": \"^9.2.0-beta.25\" // if you use `vue-i18n@v8.26.1` or later, you need to configure deps\n },\n}\n```\n\nImport everything related to Vue Router from it, it will redirect to `vue-i18n@8.26` + `@vue/composition-api` or `vue-i18n@9.2` based on users' environments.\n\n```js\nimport { createI18n, useI18n } from '@intlify/vue-i18n-bridge'\n```\n\nWhen using with [Vite](https://vitejs.dev), you will need to opt-out the pre-bundling to get `@intlify/vue-i18n-bridge` work properly by\n\n```js\n// vite.config.js\nexport default defineConfig({\n optimizeDeps: {\n exclude: ['@intlify/vue-i18n-bridge']\n }\n})\n```\n\n## đ¤ Extra APIs\n\n`@intlify/vue-i18n-bridge` provides extra APIs to help distinguish users' environments and to do some version-specific logic.\n\n### `isVueI18n8` / `isVueI18n9`\n\n```js\nimport { isVueI18n8, isVueI18n9 } from '@intlify/vue-i18n-bridge'\n\nif (isVueI18n8) {\n // Vue I18n 8 only\n} else {\n // Vue I18n 9 only\n}\n```\n\n## đē CLI\n\nTo explicitly switch the redirecting version, you can use these commands in your project's root:\n### đ¤ Manually Switch Versions\n\n```sh\nnpx vue-i18n-switch 2\n# or\nnpx vue-i18n-switch 3\n```\n\n### đĻ Package Aliasing\n\nIf you would like to import `vue-i18n` under an alias, you can use the following command:\n\n```sh\nnpx vue-i18n-switch 2 vue2\n# or\nnpx vue-i18n-switch 3 vue3\n```\n### 𩹠Auto Fix\n\nIf the postinstall hook doesn't get triggered or you have updated the Vue Router version, try to run the following command to resolve the redirecting:\n\n```sh\nnpx vue-i18n-fix\n```\n### âŗī¸ Isomorphic Testings\n\nYou can support testing for both versions by adding npm alias in your dev dependencies. For example:\n\n```js\n{\n \"scripts\": {\n \"test:8\": \"vue-i18n-switch 8 vue-i18n-8 && jest\",\n \"test:9\": \"vue-i18n-switch 9 && jest\",\n },\n \"devDependencies\": {\n \"vue-i18n-8\": \"^8.26.1\",\n \"vue-i18n-bridge\": \"^9.2.0-beta.25\",\n \"vue-i18n\": \"npm:vue-i18n@9.2.0-beta.25\"\n },\n}\n```\n\nor\n\n```js\n{\n \"scripts\": {\n \"test:8\": \"vue-i18n-switch 8 && jest\",\n \"test:9\": \"vue-i18n-switch 9 vue-i18n-9 && jest\",\n },\n \"devDependencies\": {\n \"vue-i18n\": \"^8.26.1\",\n \"vue-i18n-9\": \"npm:vue-i18n@9.2.0-beta.25\"\n },\n}\n```\n\n## đ Thanks\nThis package idea was inspired from [vue-demi](https://github.com/vueuse/vue-demi), [@antfu](https://github.com/antfu)s great work!\n\n## Šī¸ License\n\n[MIT](http://opensource.org/licenses/MIT)\n" | ||
} | ||
} |
@@ -144,3 +144,3 @@ # @intlify/vue-i18n-bridge | ||
## đ Thanks | ||
This package idea was inspired from [vue-demi](https://github.com/vueuse/vue-demi), [@antfu](https://github.com/antfu)s great work! | ||
This package idea was inspired from [vue-demi](https://github.com/vueuse/vue-demi), [@antfu](https://github.com/antfu)'s great work! | ||
@@ -147,0 +147,0 @@ ## Šī¸ License |
10459