Skip to content

Commit

Permalink
feat: add useVIntl composable as an alternative to useI18n
Browse files Browse the repository at this point in the history
  • Loading branch information
brawaru committed Mar 16, 2023
1 parent fbb28b1 commit 5c5f65a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/runtime/index.ts
Original file line number Diff line number Diff line change
@@ -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'
12 changes: 11 additions & 1 deletion src/runtime/useI18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ControllerType = MessageValueType>() {
export function useVIntl<ControllerType = MessageValueType>() {
const controller = inject(controllerKey)

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

return controller as IntlController<ControllerType>
}

/**
* 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<ControllerType = MessageValueType>() {
return useVIntl<ControllerType>()
}

1 comment on commit 5c5f65a

@vercel
Copy link

@vercel vercel bot commented on 5c5f65a Mar 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vintl – ./

vintl-vintl-dev.vercel.app
vintl-git-main-vintl-dev.vercel.app
vintl.vercel.app

Please sign in to comment.