From 5b356dc36101a595f4e362ae4ac95cd4e8dd5c75 Mon Sep 17 00:00:00 2001 From: waynzh Date: Sat, 5 Nov 2022 01:06:44 +0800 Subject: [PATCH] translation: add the Chinese translation link and categorize files --- .vitepress/config.js | 154 +-------------- .vitepress/locales/en.js | 175 ++++++++++++++++++ .vitepress/locales/index.js | 13 ++ .vitepress/locales/zh.js | 175 ++++++++++++++++++ src/zh/{ => archive}/array-refs.md | 0 src/zh/{ => archive}/introduction.md | 0 src/zh/{ => archive}/suspense.md | 0 .../async-components.md | 0 .../attribute-coercion.md | 0 .../attrs-includes-class-style.md | 0 src/zh/{ => breaking-changes}/children.md | 0 .../custom-directives.md | 0 .../custom-elements-interop.md | 0 src/zh/{ => breaking-changes}/data-option.md | 0 src/zh/{ => breaking-changes}/emits-option.md | 0 src/zh/{ => breaking-changes}/events-api.md | 0 src/zh/{ => breaking-changes}/filters.md | 0 .../functional-components.md | 0 .../global-api-treeshaking.md | 0 src/zh/{ => breaking-changes}/global-api.md | 0 src/zh/breaking-changes/index.md | 66 +++++++ .../inline-template-attribute.md | 0 .../{ => breaking-changes}/key-attribute.md | 0 .../keycode-modifiers.md | 0 .../listeners-removed.md | 0 .../{ => breaking-changes}/mount-changes.md | 0 src/zh/{ => breaking-changes}/props-data.md | 0 .../props-default-this.md | 0 .../render-function-api.md | 0 .../slots-unification.md | 0 .../transition-as-root.md | 0 .../transition-group.md | 0 src/zh/{ => breaking-changes}/transition.md | 0 src/zh/{ => breaking-changes}/v-bind.md | 0 src/zh/{ => breaking-changes}/v-if-v-for.md | 0 src/zh/{ => breaking-changes}/v-model.md | 0 .../v-on-native-modifier-removed.md | 0 .../vnode-lifecycle-events.md | 0 src/zh/{ => breaking-changes}/watch.md | 0 src/zh/index.md | 119 ++++++++++++ src/zh/{ => new}/fragments.md | 0 src/zh/recommendations.md | 75 ++++++++ 42 files changed, 627 insertions(+), 150 deletions(-) create mode 100644 .vitepress/locales/en.js create mode 100644 .vitepress/locales/index.js create mode 100644 .vitepress/locales/zh.js rename src/zh/{ => archive}/array-refs.md (100%) rename src/zh/{ => archive}/introduction.md (100%) rename src/zh/{ => archive}/suspense.md (100%) rename src/zh/{ => breaking-changes}/async-components.md (100%) rename src/zh/{ => breaking-changes}/attribute-coercion.md (100%) rename src/zh/{ => breaking-changes}/attrs-includes-class-style.md (100%) rename src/zh/{ => breaking-changes}/children.md (100%) rename src/zh/{ => breaking-changes}/custom-directives.md (100%) rename src/zh/{ => breaking-changes}/custom-elements-interop.md (100%) rename src/zh/{ => breaking-changes}/data-option.md (100%) rename src/zh/{ => breaking-changes}/emits-option.md (100%) rename src/zh/{ => breaking-changes}/events-api.md (100%) rename src/zh/{ => breaking-changes}/filters.md (100%) rename src/zh/{ => breaking-changes}/functional-components.md (100%) rename src/zh/{ => breaking-changes}/global-api-treeshaking.md (100%) rename src/zh/{ => breaking-changes}/global-api.md (100%) create mode 100644 src/zh/breaking-changes/index.md rename src/zh/{ => breaking-changes}/inline-template-attribute.md (100%) rename src/zh/{ => breaking-changes}/key-attribute.md (100%) rename src/zh/{ => breaking-changes}/keycode-modifiers.md (100%) rename src/zh/{ => breaking-changes}/listeners-removed.md (100%) rename src/zh/{ => breaking-changes}/mount-changes.md (100%) rename src/zh/{ => breaking-changes}/props-data.md (100%) rename src/zh/{ => breaking-changes}/props-default-this.md (100%) rename src/zh/{ => breaking-changes}/render-function-api.md (100%) rename src/zh/{ => breaking-changes}/slots-unification.md (100%) rename src/zh/{ => breaking-changes}/transition-as-root.md (100%) rename src/zh/{ => breaking-changes}/transition-group.md (100%) rename src/zh/{ => breaking-changes}/transition.md (100%) rename src/zh/{ => breaking-changes}/v-bind.md (100%) rename src/zh/{ => breaking-changes}/v-if-v-for.md (100%) rename src/zh/{ => breaking-changes}/v-model.md (100%) rename src/zh/{ => breaking-changes}/v-on-native-modifier-removed.md (100%) rename src/zh/{ => breaking-changes}/vnode-lifecycle-events.md (100%) rename src/zh/{ => breaking-changes}/watch.md (100%) create mode 100644 src/zh/index.md rename src/zh/{ => new}/fragments.md (100%) create mode 100644 src/zh/recommendations.md diff --git a/.vitepress/config.js b/.vitepress/config.js index 5f8ca76..17824ce 100644 --- a/.vitepress/config.js +++ b/.vitepress/config.js @@ -1,156 +1,10 @@ +import locales from './locales' + export default { - title: 'Vue 3 Migration Guide', - description: 'Guide on migrating from Vue 2 to Vue 3', srcDir: 'src', + locales: locales.vitepressConfig, themeConfig: { - nav: [{ text: 'Vue 3 Docs', link: 'https://vuejs.org' }], - - sidebar: [ - { - text: 'Guide', - items: [ - { text: 'Overview', link: '/' }, - { text: 'New Recommendations', link: '/recommendations' }, - { text: 'Migration Build', link: '/migration-build' }, - { - text: 'Breaking Changes', - link: '/breaking-changes/' - } - ] - }, - { - text: 'Global API', - items: [ - { - text: 'Global API Application Instance', - link: '/breaking-changes/global-api' - }, - { - text: 'Global API Treeshaking', - link: '/breaking-changes/global-api-treeshaking' - } - ] - }, - { - text: 'Template Directives', - items: [ - { text: 'v-model', link: '/breaking-changes/v-model' }, - { - text: 'key Usage Change', - link: '/breaking-changes/key-attribute' - }, - { - text: 'v-if vs. v-for Precedence', - link: '/breaking-changes/v-if-v-for' - }, - { text: 'v-bind Merge Behavior', link: '/breaking-changes/v-bind' }, - { - text: 'v-on.native modifier removed', - link: '/breaking-changes/v-on-native-modifier-removed' - } - ] - }, - { - text: 'Components', - items: [ - { - text: 'Functional Components', - link: '/breaking-changes/functional-components' - }, - { - text: 'Async Components', - link: '/breaking-changes/async-components' - }, - { text: 'emits Option', link: '/breaking-changes/emits-option' } - ] - }, - { - text: 'Render Function', - items: [ - { - text: 'Render Function API', - link: '/breaking-changes/render-function-api' - }, - { - text: 'Slots Unification', - link: '/breaking-changes/slots-unification' - }, - { - text: '$listeners merged into $attrs', - link: '/breaking-changes/listeners-removed' - }, - { - text: '$attrs includes class & style', - link: '/breaking-changes/attrs-includes-class-style' - } - ] - }, - { - text: 'Custom Elements', - items: [ - { - text: 'Custom Elements Interop Changes', - link: '/breaking-changes/custom-elements-interop' - } - ] - }, - { - text: 'Removed APIs', - items: [ - { - text: 'v-on keyCode Modifiers', - link: '/breaking-changes/keycode-modifiers' - }, - { text: 'Events API', link: '/breaking-changes/events-api' }, - { text: 'Filters', link: '/breaking-changes/filters' }, - { - text: 'inline-template', - link: '/breaking-changes/inline-template-attribute' - }, - { text: '$children', link: '/breaking-changes/children' }, - { text: 'propsData option', link: '/breaking-changes/props-data' } - ] - }, - { - text: 'Other Minor Changes', - items: [ - { - text: 'Attribute Coercion Behavior', - link: '/breaking-changes/attribute-coercion' - }, - { - text: 'Custom Directives', - link: '/breaking-changes/custom-directives' - }, - { text: 'Data Option', link: '/breaking-changes/data-option' }, - { - text: 'Mount API changes', - link: '/breaking-changes/mount-changes' - }, - { - text: 'Props Default Function this Access', - link: '/breaking-changes/props-default-this' - }, - { - text: 'Transition Class Change', - link: '/breaking-changes/transition' - }, - { - text: 'Transition as Root', - link: '/breaking-changes/transition-as-root' - }, - { - text: 'Transition Group Root Element', - link: '/breaking-changes/transition-group' - }, - { - text: 'VNode lifecycle events', - link: '/breaking-changes/vnode-lifecycle-events' - }, - { text: 'Watch on Arrays', link: '/breaking-changes/watch' } - ] - } - ] + locales: locales.themeConfig } } diff --git a/.vitepress/locales/en.js b/.vitepress/locales/en.js new file mode 100644 index 0000000..04e8c95 --- /dev/null +++ b/.vitepress/locales/en.js @@ -0,0 +1,175 @@ +export default { + vitepressConfig: { + title: 'Vue 3 Migration Guide', + lang: 'en-US', + description: 'Guide on migrating from Vue 2 to Vue 3', + }, + themeConfig: { + localeLinks: { + text: 'English', + items: [ + { text: '简体中文', link: '/zh/' }, + ] + }, + + nav: [ + { text: 'Docs', link: '/' }, + { + text: 'Links', + items: [ + { + text: 'Vue 3 Docs', + link: 'https://vuejs.org', + } + ] + } + ], + + sidebar: [ + { + text: 'Guide', + items: [ + { text: 'Overview', link: '/' }, + { text: 'New Recommendations', link: '/recommendations' }, + { text: 'Migration Build', link: '/migration-build' }, + { + text: 'Breaking Changes', + link: '/breaking-changes/' + } + ] + }, + { + text: 'Global API', + items: [ + { + text: 'Global API Application Instance', + link: '/breaking-changes/global-api' + }, + { + text: 'Global API Treeshaking', + link: '/breaking-changes/global-api-treeshaking' + } + ] + }, + { + text: 'Template Directives', + items: [ + { text: 'v-model', link: '/breaking-changes/v-model' }, + { + text: 'key Usage Change', + link: '/breaking-changes/key-attribute' + }, + { + text: 'v-if vs. v-for Precedence', + link: '/breaking-changes/v-if-v-for' + }, + { text: 'v-bind Merge Behavior', link: '/breaking-changes/v-bind' }, + { + text: 'v-on.native modifier removed', + link: '/breaking-changes/v-on-native-modifier-removed' + } + ] + }, + { + text: 'Components', + items: [ + { + text: 'Functional Components', + link: '/breaking-changes/functional-components' + }, + { + text: 'Async Components', + link: '/breaking-changes/async-components' + }, + { text: 'emits Option', link: '/breaking-changes/emits-option' } + ] + }, + { + text: 'Render Function', + items: [ + { + text: 'Render Function API', + link: '/breaking-changes/render-function-api' + }, + { + text: 'Slots Unification', + link: '/breaking-changes/slots-unification' + }, + { + text: '$listeners merged into $attrs', + link: '/breaking-changes/listeners-removed' + }, + { + text: '$attrs includes class & style', + link: '/breaking-changes/attrs-includes-class-style' + } + ] + }, + { + text: 'Custom Elements', + items: [ + { + text: 'Custom Elements Interop Changes', + link: '/breaking-changes/custom-elements-interop' + } + ] + }, + { + text: 'Removed APIs', + items: [ + { + text: 'v-on keyCode Modifiers', + link: '/breaking-changes/keycode-modifiers' + }, + { text: 'Events API', link: '/breaking-changes/events-api' }, + { text: 'Filters', link: '/breaking-changes/filters' }, + { + text: 'inline-template', + link: '/breaking-changes/inline-template-attribute' + }, + { text: '$children', link: '/breaking-changes/children' }, + { text: 'propsData option', link: '/breaking-changes/props-data' } + ] + }, + { + text: 'Other Minor Changes', + items: [ + { + text: 'Attribute Coercion Behavior', + link: '/breaking-changes/attribute-coercion' + }, + { + text: 'Custom Directives', + link: '/breaking-changes/custom-directives' + }, + { text: 'Data Option', link: '/breaking-changes/data-option' }, + { + text: 'Mount API changes', + link: '/breaking-changes/mount-changes' + }, + { + text: 'Props Default Function this Access', + link: '/breaking-changes/props-default-this' + }, + { + text: 'Transition Class Change', + link: '/breaking-changes/transition' + }, + { + text: 'Transition as Root', + link: '/breaking-changes/transition-as-root' + }, + { + text: 'Transition Group Root Element', + link: '/breaking-changes/transition-group' + }, + { + text: 'VNode lifecycle events', + link: '/breaking-changes/vnode-lifecycle-events' + }, + { text: 'Watch on Arrays', link: '/breaking-changes/watch' } + ] + } + ] + }, +} diff --git a/.vitepress/locales/index.js b/.vitepress/locales/index.js new file mode 100644 index 0000000..b1c0ff4 --- /dev/null +++ b/.vitepress/locales/index.js @@ -0,0 +1,13 @@ +import en from './en.js' +import zh from './zh.js' + +export default { + vitepressConfig: { + '/': en.vitepressConfig, + '/zh/': zh.vitepressConfig, + }, + themeConfig: { + '/': en.themeConfig, + '/zh/': zh.themeConfig, + }, +} diff --git a/.vitepress/locales/zh.js b/.vitepress/locales/zh.js new file mode 100644 index 0000000..87aeeeb --- /dev/null +++ b/.vitepress/locales/zh.js @@ -0,0 +1,175 @@ +export default { + vitepressConfig: { + title: 'Vue 3 迁移指南', + lang: 'zh-CN', + description: 'Guide on migrating from Vue 2 to Vue 3', + }, + themeConfig: { + localeLinks: { + text: '简体中文', + items: [ + { text: 'English', link: '/' }, + ] + }, + + nav: [ + { text: '指南', link: '/zh/' }, + { + text: '相关链接', + items: [ + { + text: 'Vue 3 文档', + link: 'https://vuejs.org', + } + ] + } + ], + + sidebar: [ + { + text: '指南', + items: [ + { text: '概览', link: '/zh/' }, + { text: '建议', link: '/zh/recommendations' }, + { text: '用于迁移的构建版本', link: '/zh/migration-build' }, + { + text: '非兼容的变更', + link: '/zh/breaking-changes/' + } + ] + }, + { + text: '全局 API', + items: [ + { + text: '全局 API', + link: '/zh/breaking-changes/global-api' + }, + { + text: '全局 API Treeshaking', + link: '/zh/breaking-changes/global-api-treeshaking' + } + ] + }, + { + text: '模板指令', + items: [ + { text: 'v-model', link: '/zh/breaking-changes/v-model' }, + { + text: 'key 用法改变', + link: '/zh/breaking-changes/key-attribute' + }, + { + text: 'v-if 与 v-for 的优先级对比', + link: '/zh/breaking-changes/v-if-v-for' + }, + { text: 'v-bind 合并行为', link: '/zh/breaking-changes/v-bind' }, + { + text: '移除 v-on.native 修饰符', + link: '/zh/breaking-changes/v-on-native-modifier-removed' + } + ] + }, + { + text: '组件', + items: [ + { + text: '函数式组件', + link: '/zh/breaking-changes/functional-components' + }, + { + text: '异步组件', + link: '/zh/breaking-changes/async-components' + }, + { text: 'emits 选项', link: '/zh/breaking-changes/emits-option' } + ] + }, + { + text: '渲染函数', + items: [ + { + text: '渲染函数 API', + link: '/zh/breaking-changes/render-function-api' + }, + { + text: '插槽统一', + link: '/zh/breaking-changes/slots-unification' + }, + { + text: '$listeners 合并入 $attrs', + link: '/zh/breaking-changes/listeners-removed' + }, + { + text: '$attrs 包含 class & style', + link: '/zh/breaking-changes/attrs-includes-class-style' + } + ] + }, + { + text: '自定义元素', + items: [ + { + text: '与自定义元素的互操作性', + link: '/zh/breaking-changes/custom-elements-interop' + } + ] + }, + { + text: '移除的 API', + items: [ + { + text: 'v-on 按键修饰符', + link: '/zh/breaking-changes/keycode-modifiers' + }, + { text: '事件 API', link: '/zh/breaking-changes/events-api' }, + { text: 'Filters', link: '/zh/breaking-changes/filters' }, + { + text: '内联模板', + link: '/zh/breaking-changes/inline-template-attribute' + }, + { text: '$children', link: '/zh/breaking-changes/children' }, + { text: 'propsData 选项', link: '/zh/breaking-changes/props-data' } + ] + }, + { + text: '其他细微改动', + items: [ + { + text: 'Attribute 强制行为', + link: '/zh/breaking-changes/attribute-coercion' + }, + { + text: '自定义指令', + link: '/zh/breaking-changes/custom-directives' + }, + { text: 'Data 选项', link: '/zh/breaking-changes/data-option' }, + { + text: '挂载 API 变化', + link: '/zh/breaking-changes/mount-changes' + }, + { + text: '在 prop 的默认函数中访问 this', + link: '/zh/breaking-changes/props-default-this' + }, + { + text: '过渡的 class 名更改', + link: '/zh/breaking-changes/transition' + }, + { + text: 'Transition 作为根节点', + link: '/zh/breaking-changes/transition-as-root' + }, + { + text: 'Transition Group 根元素', + link: '/zh/breaking-changes/transition-group' + }, + { + text: 'VNode 生命周期事件', + link: '/zh/breaking-changes/vnode-lifecycle-events' + }, + { text: '侦听数组', link: '/zh/breaking-changes/watch' } + ] + } + ] + } +} diff --git a/src/zh/array-refs.md b/src/zh/archive/array-refs.md similarity index 100% rename from src/zh/array-refs.md rename to src/zh/archive/array-refs.md diff --git a/src/zh/introduction.md b/src/zh/archive/introduction.md similarity index 100% rename from src/zh/introduction.md rename to src/zh/archive/introduction.md diff --git a/src/zh/suspense.md b/src/zh/archive/suspense.md similarity index 100% rename from src/zh/suspense.md rename to src/zh/archive/suspense.md diff --git a/src/zh/async-components.md b/src/zh/breaking-changes/async-components.md similarity index 100% rename from src/zh/async-components.md rename to src/zh/breaking-changes/async-components.md diff --git a/src/zh/attribute-coercion.md b/src/zh/breaking-changes/attribute-coercion.md similarity index 100% rename from src/zh/attribute-coercion.md rename to src/zh/breaking-changes/attribute-coercion.md diff --git a/src/zh/attrs-includes-class-style.md b/src/zh/breaking-changes/attrs-includes-class-style.md similarity index 100% rename from src/zh/attrs-includes-class-style.md rename to src/zh/breaking-changes/attrs-includes-class-style.md diff --git a/src/zh/children.md b/src/zh/breaking-changes/children.md similarity index 100% rename from src/zh/children.md rename to src/zh/breaking-changes/children.md diff --git a/src/zh/custom-directives.md b/src/zh/breaking-changes/custom-directives.md similarity index 100% rename from src/zh/custom-directives.md rename to src/zh/breaking-changes/custom-directives.md diff --git a/src/zh/custom-elements-interop.md b/src/zh/breaking-changes/custom-elements-interop.md similarity index 100% rename from src/zh/custom-elements-interop.md rename to src/zh/breaking-changes/custom-elements-interop.md diff --git a/src/zh/data-option.md b/src/zh/breaking-changes/data-option.md similarity index 100% rename from src/zh/data-option.md rename to src/zh/breaking-changes/data-option.md diff --git a/src/zh/emits-option.md b/src/zh/breaking-changes/emits-option.md similarity index 100% rename from src/zh/emits-option.md rename to src/zh/breaking-changes/emits-option.md diff --git a/src/zh/events-api.md b/src/zh/breaking-changes/events-api.md similarity index 100% rename from src/zh/events-api.md rename to src/zh/breaking-changes/events-api.md diff --git a/src/zh/filters.md b/src/zh/breaking-changes/filters.md similarity index 100% rename from src/zh/filters.md rename to src/zh/breaking-changes/filters.md diff --git a/src/zh/functional-components.md b/src/zh/breaking-changes/functional-components.md similarity index 100% rename from src/zh/functional-components.md rename to src/zh/breaking-changes/functional-components.md diff --git a/src/zh/global-api-treeshaking.md b/src/zh/breaking-changes/global-api-treeshaking.md similarity index 100% rename from src/zh/global-api-treeshaking.md rename to src/zh/breaking-changes/global-api-treeshaking.md diff --git a/src/zh/global-api.md b/src/zh/breaking-changes/global-api.md similarity index 100% rename from src/zh/global-api.md rename to src/zh/breaking-changes/global-api.md diff --git a/src/zh/breaking-changes/index.md b/src/zh/breaking-changes/index.md new file mode 100644 index 0000000..d1f5aa6 --- /dev/null +++ b/src/zh/breaking-changes/index.md @@ -0,0 +1,66 @@ +# 非兼容的变更 + +This page lists all Vue 3 breaking changes from Vue 2. + +While it looks like a lot has changed, a lot of what you know and love about Vue is still the same; but we wanted to be as thorough as possible and provide detailed explanations and examples for every documented change. + +## Details + +### Global API + +- [Global Vue API is changed to use an application instance](./global-api.html) +- [Global and internal APIs have been restructured to be tree-shakable](./global-api-treeshaking.html) + +### Template Directives + +- [`v-model` usage on components has been reworked, replacing `v-bind.sync`](./v-model.html) +- [`key` usage on `