Skip to content

Commit 3882d02

Browse files
authored
breaking: drop $tc and tc (#2017)
* breaking: drop `$tc` and `tc` * docs: add breaking changes for v11 * docs: more tweaks
1 parent 60902cc commit 3882d02

File tree

21 files changed

+332
-1110
lines changed

21 files changed

+332
-1110
lines changed

docs/.vitepress/config.mts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { defineConfig } from 'vitepress'
21
import type { HeadConfig } from 'vitepress'
2+
import { defineConfig } from 'vitepress'
33

44
const head: HeadConfig[] = [['link', { rel: 'icon', href: '/vue-i18n-logo.png' }]]
55

@@ -206,6 +206,10 @@ function sidebarGuide() {
206206
text: 'Breaking Changes in v10',
207207
link: '/guide/migration/breaking10'
208208
},
209+
{
210+
text: 'Breaking Changes in v11',
211+
link: '/guide/migration/breaking11'
212+
},
209213
{
210214
text: 'New Features in v9',
211215
link: '/guide/migration/features'

docs/api/injection.md

-257
Original file line numberDiff line numberDiff line change
@@ -597,263 +597,6 @@ Overloaded `$rt`. About details, see the [$rt](injection#rt-message) remarks.
597597

598598
Translation message
599599

600-
### $tc(key)
601-
602-
:::danger NOTICE
603-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
604-
:::
605-
606-
Locale message pluralization
607-
608-
**Signature:**
609-
```typescript
610-
$tc(key: Key): TranslateResult;
611-
```
612-
613-
:::warning NOTE
614-
Supported for **Legacy API mode only**.
615-
:::
616-
617-
**Details**
618-
619-
If this is used in a reactive context, it will re-evaluate once the locale changes.
620-
621-
The input / output is the same as for VueI18n instance. About that details, see [VueI18n#tc](legacy#tc-key).
622-
623-
The value of plural is handled with default `1`.
624-
625-
**See Also**
626-
- [Pluralization](../guide/essentials/pluralization)
627-
628-
#### Parameters
629-
| Parameter | Type | Description |
630-
| --- | --- | --- |
631-
| key | Key | A target locale message key |
632-
633-
#### Returns
634-
635-
Translation message that is pluraled
636-
637-
### $tc(key, locale)
638-
639-
:::danger NOTICE
640-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
641-
:::
642-
643-
Locale message pluralization
644-
645-
**Signature:**
646-
```typescript
647-
$tc(key: Key, locale: Locale): TranslateResult;
648-
```
649-
650-
:::warning NOTE
651-
Supported for **Legacy API mode only**.
652-
:::
653-
654-
**Details**
655-
656-
Overloaded `$tc`. About details, see the [$tc](injection#tc-key) remarks.
657-
658-
#### Parameters
659-
| Parameter | Type | Description |
660-
| --- | --- | --- |
661-
| key | Key | A target locale message key |
662-
| locale | Locale | A locale, override locale that global scope or local scope |
663-
664-
#### Returns
665-
666-
Translation message that is pluraled
667-
668-
### $tc(key, list)
669-
670-
:::danger NOTICE
671-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
672-
:::
673-
674-
Locale message pluralization
675-
676-
**Signature:**
677-
```typescript
678-
$tc(key: Key, list: unknown[]): TranslateResult;
679-
```
680-
681-
:::warning NOTE
682-
Supported for **Legacy API mode only**.
683-
:::
684-
685-
**Details**
686-
687-
Overloaded `$tc`. About details, see the [$tc](injection#tc-key) remarks.
688-
689-
#### Parameters
690-
| Parameter | Type | Description |
691-
| --- | --- | --- |
692-
| key | Key | A target locale message key |
693-
| list | unknown[] | A values of list interpolation |
694-
695-
#### Returns
696-
697-
Translation message that is pluraled
698-
699-
### $tc(key, named)
700-
701-
:::danger NOTICE
702-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
703-
:::
704-
705-
Locale message pluralization
706-
707-
**Signature:**
708-
```typescript
709-
$tc(key: Key, named: Record<string, unknown>): TranslateResult;
710-
```
711-
712-
:::warning NOTE
713-
Supported for **Legacy API mode only**.
714-
:::
715-
716-
**Details**
717-
718-
Overloaded `$tc`. About details, see the [$tc](injection#tc-key) remarks.
719-
720-
#### Parameters
721-
| Parameter | Type | Description |
722-
| --- | --- | --- |
723-
| key | Key | A target locale message key |
724-
| named | Record&lt;string, unknown&gt; | A values of named interpolation |
725-
726-
#### Returns
727-
728-
Translation message that is pluraled
729-
730-
### $tc(key, choice)
731-
732-
:::danger NOTICE
733-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
734-
:::
735-
736-
Locale message pluralization
737-
738-
**Signature:**
739-
```typescript
740-
$tc(key: Key, choice: number): TranslateResult;
741-
```
742-
743-
:::warning NOTE
744-
Supported for **Legacy API mode only**.
745-
:::
746-
747-
**Details**
748-
749-
Overloaded `$tc`. About details, see the [$tc](injection#tc-key) remarks.
750-
751-
#### Parameters
752-
| Parameter | Type | Description |
753-
| --- | --- | --- |
754-
| key | Key | A target locale message key |
755-
| choice | number | Which plural string to get. 1 returns the first one |
756-
757-
#### Returns
758-
759-
Translation message that is pluraled
760-
761-
### $tc(key, choice, locale)
762-
763-
:::danger NOTICE
764-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
765-
:::
766-
767-
Locale message pluralization
768-
769-
**Signature:**
770-
```typescript
771-
$tc(key: Key, choice: number, locale: Locale): TranslateResult;
772-
```
773-
774-
:::warning NOTE
775-
Supported for **Legacy API mode only**.
776-
:::
777-
778-
**Details**
779-
780-
Overloaded `$tc`. About details, see the [$tc](injection#tc-key) remarks.
781-
782-
#### Parameters
783-
| Parameter | Type | Description |
784-
| --- | --- | --- |
785-
| key | Key | A target locale message key |
786-
| choice | number | Which plural string to get. 1 returns the first one |
787-
| locale | Locale | A locale, override locale that global scope or local scope |
788-
789-
#### Returns
790-
791-
Translation message that is pluraled
792-
793-
### $tc(key, choice, list)
794-
795-
:::danger NOTICE
796-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
797-
:::
798-
799-
Locale message pluralization
800-
801-
**Signature:**
802-
```typescript
803-
$tc(key: Key, choice: number, list: unknown[]): TranslateResult;
804-
```
805-
806-
:::warning NOTE
807-
Supported for **Legacy API mode only**.
808-
:::
809-
810-
**Details**
811-
812-
Overloaded `$tc`. About details, see the [$tc](injection#tc-key) remarks.
813-
814-
#### Parameters
815-
| Parameter | Type | Description |
816-
| --- | --- | --- |
817-
| key | Key | A target locale message key |
818-
| choice | number | Which plural string to get. 1 returns the first one |
819-
| list | unknown[] | A values of list interpolation |
820-
821-
#### Returns
822-
823-
Translation message that is pluraled
824-
825-
### $tc(key, choice, named)
826-
827-
:::danger NOTICE
828-
**`$tc` has been deprecated in v10. Use `$t` instead. `$tc` is going to remove in v11.**
829-
:::
830-
831-
Locale message pluralization
832-
833-
**Signature:**
834-
```typescript
835-
$tc(key: Key, choice: number, named: Record<string, unknown>): TranslateResult;
836-
```
837-
838-
:::warning NOTE
839-
Supported for **Legacy API mode only**.
840-
:::
841-
842-
**Details**
843-
844-
Overloaded `$tc`. About details, see the [$tc](injection#tc-key) remarks.
845-
846-
#### Parameters
847-
| Parameter | Type | Description |
848-
| --- | --- | --- |
849-
| key | Key | A target locale message key |
850-
| choice | number | Which plural string to get. 1 returns the first one |
851-
| named | Record&lt;string, unknown&gt; | A values of named interpolation |
852-
853-
#### Returns
854-
855-
Translation message that is pluraled
856-
857600
### $te(key, locale)
858601

859602
Translation message exist

docs/guide/advanced/composition.md

-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ For more details of `t`, see the [API Reference](../../api/composition#t-key).
137137

138138
## Pluralization
139139

140-
In the Legacy API mode, the plural form of the message was translated using either `$tc` or the VueI18n instance of `tc` to translate the message.
141-
142140
In the Composition API mode, the plural form of the message is left in syntax as in the Legacy API mode, but is translated using the `t` of the Composer instance:
143141

144142
```vue

docs/guide/essentials/local.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[In *'Scope and Locale Changing’*](scope), Vue I18n has two scope concepts, global scope and local scope.
66

7-
In general, locale info (e.g. `locale`,`messages`, etc) is set as option of `createI18n` and it sets (install) with `app.use`. To sum up, you use global scope translation functions `$t` and `$tc` to localize them.
7+
In general, locale info (e.g. `locale`,`messages`, etc) is set as option of `createI18n` and it sets (install) with `app.use`. To sum up, you use global scope translation functions `$t` to localize them.
88

99
Sometimes it is necessary to localize per component while still managing the resources of the local messages. In this case it can be useful to localize each local scope using i18n component option on the component instead of the global scope.
1010

docs/guide/essentials/pluralization.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The `apple` has `no apples | one apple | {count} apples` pluralization message,
8787

8888
The number can be accessed within locale messages via predefined named arguments `{count}` and/or `{n}`. You can overwrite those predefined named arguments if necessary.
8989

90-
The following is an example of using `$tc`:
90+
The following is an example of using `$t`:
9191

9292
```html
9393
<p>{{ $t('apple', 10, { count: 10 }) }}</p>

docs/guide/migration/breaking11.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Breaking Changes in v11
2+
3+
## Deprecate Legacy API mode
4+
5+
### Reason
6+
7+
The Legacy API mode was the API mode compatible with v8 for Vue 2. When v9 was released, the Legacy API was provided to smooth the migration from v8 to v9.
8+
9+
Legacy API mode will be deprecated in v11, as previous vue-i18n releases have already provided the following to support migration to Composition API mode
10+
11+
- Migration from Legacy API mode to Composition API mode: https://vue-i18n.intlify.dev/guide/migration/vue3.html
12+
- Composition API usage: https://vue-i18n.intlify.dev/guide/advanced/composition.html
13+
14+
For compatibility, Legacy API mode still works in v11, but will be removed entirely in v12, so Legacy API mode will not work after that version.
15+
16+
## Drop `tc` and `$tc` for Legacy API mode
17+
18+
**Reason**: These APIs had already deprecated in warning about being dropped in v11. docs says, https://vue-i18n.intlify.dev/guide/migration/breaking10.html#deprecate-tc-and-tc-for-legacy-api-mode

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

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export {
9393
VueI18nOptions,
9494
VueI18nResolveLocaleMessageTranslation,
9595
VueI18nTranslation,
96-
VueI18nTranslationChoice,
9796
WarnHtmlInMessageLevel
9897
} from '../../vue-i18n-core/src/legacy'
9998
export { I18nPluginOptions } from '../../vue-i18n-core/src/plugin'

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

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export {
9292
VueI18nOptions,
9393
VueI18nResolveLocaleMessageTranslation,
9494
VueI18nTranslation,
95-
VueI18nTranslationChoice,
9695
WarnHtmlInMessageLevel
9796
} from '../../vue-i18n-core/src/legacy'
9897
export { I18nPluginOptions } from '../../vue-i18n-core/src/plugin'

0 commit comments

Comments
 (0)