Skip to content

Commit 8034986

Browse files
authored
feat: export $te as global on composition mode (#1222)
1 parent 5419a8f commit 8034986

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

docs/api/injection.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,13 +888,9 @@ Translation message exist
888888
$te(key: Path, locale?: Locale): boolean;
889889
```
890890

891-
:::warning NOTE
892-
Supported for **Legacy API mode only**.
893-
:::
894-
895891
**Details**
896892

897-
The input / output is the same as for VueI18n instance. About that details, see [VueI18n#te](legacy#te-key-locale)
893+
About that details, see [VueI18n#te](legacy#te-key-locale)
898894

899895
#### Parameters
900896
| Parameter | Type | Description |

packages/petite-vue-i18n/src/vue.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,7 @@ declare module '@vue/runtime-core' {
831831
* Translation message exist
832832
*
833833
* @remarks
834-
* The input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#te | `VueI18n.#te` }.
835-
* Supported for Legacy API mode only.
834+
* About that details, see {@link VueI18n#te | `VueI18n#te` } or {@link Composer#te | `Composer#te`}.
836835
*
837836
* @param key - A target locale message key
838837
* @param locale - A locale, optional, override locale that global scope or local scope

packages/vue-i18n-bridge/src/vue.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,7 @@ declare module '@vue/runtime-core' {
831831
* Translation message exist
832832
*
833833
* @remarks
834-
* The input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#te | `VueI18n.#te` }.
835-
* Supported for Legacy API mode only.
834+
* About that details, see {@link VueI18n#te | `VueI18n#te` } or {@link Composer#te | `Composer#te`}.
836835
*
837836
* @param key - A target locale message key
838837
* @param locale - A locale, optional, override locale that global scope or local scope

packages/vue-i18n-core/src/i18n.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,9 @@ const globalExportProps = [
15711571
'fallbackLocale',
15721572
'availableLocales'
15731573
] as const
1574-
const globalExportMethods = !__LITE__ ? ['t', 'rt', 'd', 'n', 'tm'] : ['t']
1574+
const globalExportMethods = !__LITE__
1575+
? ['t', 'rt', 'd', 'n', 'tm', 'te']
1576+
: ['t']
15751577

15761578
function injectGlobalFields(app: App, composer: Composer): void {
15771579
const i18n = Object.create(null)

packages/vue-i18n/src/vue.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,7 @@ declare module '@vue/runtime-core' {
831831
* Translation message exist
832832
*
833833
* @remarks
834-
* The input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#te | `VueI18n.#te` }.
835-
* Supported for Legacy API mode only.
834+
* About that details, see {@link VueI18n#te | `VueI18n#te` } or {@link Composer#te | `Composer#te`}.
836835
*
837836
* @param key - A target locale message key
838837
* @param locale - A locale, optional, override locale that global scope or local scope

0 commit comments

Comments
 (0)