From 5c5f65ae8ee936c6cb71e8cf27430269848da2f4 Mon Sep 17 00:00:00 2001 From: Sasha Sorokin <10401817+Brawaru@users.noreply.github.com> Date: Thu, 16 Mar 2023 14:52:55 +0100 Subject: [PATCH] feat: add useVIntl composable as an alternative to useI18n --- src/runtime/index.ts | 2 +- src/runtime/useI18n.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/runtime/index.ts b/src/runtime/index.ts index 95b93f2..f54ecda 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -1,3 +1,3 @@ -export { useI18n } from './useI18n.js' +export { useI18n, useVIntl } from './useI18n.js' export { useFormatters } from './useFormatters.js' export { useTranslate } from './useTranslate.js' diff --git a/src/runtime/useI18n.ts b/src/runtime/useI18n.ts index ff70eec..d3a313d 100644 --- a/src/runtime/useI18n.ts +++ b/src/runtime/useI18n.ts @@ -9,7 +9,7 @@ import type { IntlController } from '../controller.js' * @throws If controller cannot be found in the current application or current * application cannot be determined (called outside of `setup()` call). */ -export function useI18n() { +export function useVIntl() { const controller = inject(controllerKey) if (controller == null) { @@ -20,3 +20,13 @@ export function useI18n() { return controller as IntlController } + +/** + * Alias for {@link useVIntl}. + * + * @deprecated This composable name is deprecated and will be removed in next + * major version. Please use {@link useVIntl} instead. + */ +export function useI18n() { + return useVIntl() +}