Skip to content

Commit 5c5f65a

Browse files
committed
feat: add useVIntl composable as an alternative to useI18n
1 parent fbb28b1 commit 5c5f65a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/runtime/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { useI18n } from './useI18n.js'
1+
export { useI18n, useVIntl } from './useI18n.js'
22
export { useFormatters } from './useFormatters.js'
33
export { useTranslate } from './useTranslate.js'

src/runtime/useI18n.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { IntlController } from '../controller.js'
99
* @throws If controller cannot be found in the current application or current
1010
* application cannot be determined (called outside of `setup()` call).
1111
*/
12-
export function useI18n<ControllerType = MessageValueType>() {
12+
export function useVIntl<ControllerType = MessageValueType>() {
1313
const controller = inject(controllerKey)
1414

1515
if (controller == null) {
@@ -20,3 +20,13 @@ export function useI18n<ControllerType = MessageValueType>() {
2020

2121
return controller as IntlController<ControllerType>
2222
}
23+
24+
/**
25+
* Alias for {@link useVIntl}.
26+
*
27+
* @deprecated This composable name is deprecated and will be removed in next
28+
* major version. Please use {@link useVIntl} instead.
29+
*/
30+
export function useI18n<ControllerType = MessageValueType>() {
31+
return useVIntl<ControllerType>()
32+
}

0 commit comments

Comments
 (0)