Skip to content

Commit

Permalink
fix(petite-vue-i18n): cannot resolve message resolver and locale fall…
Browse files Browse the repository at this point in the history
…backer (#1967)
  • Loading branch information
kazupon authored Sep 22, 2024
1 parent 9d97932 commit d8d6180
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 124 deletions.
6 changes: 4 additions & 2 deletions docs/guide/advanced/lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ Then, at the entry point of the application, configure the message resolver and

```js
import { createApp } from 'vue'
import { createI18n } from 'petite-vue-i18n'
import {
createI18n,
registerMessageResolver, // register the message resolver API
resolveValue, // message resolver of vue-i18n which is used by default
registerLocaleFallbacker, // register the locale fallbacker API
} from 'petite-vue-i18n'
import {
resolveValue, // message resolver of vue-i18n which is used by default
fallbackWithLocaleChain // locale fallbacker of vue-i18n which is used by default
} from '@intlify/core-base'

Expand Down
124 changes: 63 additions & 61 deletions packages/petite-vue-i18n/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getGlobalThis } from '@intlify/shared'
import {
setDevToolsHook,
compile,
registerMessageCompiler,
compile
setDevToolsHook
} from '@intlify/core-base'
import { getGlobalThis } from '@intlify/shared'
import { initDev, initFeatureFlags } from '../../vue-i18n-core/src/misc'

if (__ESM_BUNDLER__ && !__TEST__) {
Expand All @@ -14,96 +14,98 @@ if (__ESM_BUNDLER__ && !__TEST__) {
registerMessageCompiler(compile)

export {
Path,
PathValue,
NamedValue,
Locale,
CompileError,
DateTimeOptions,
FallbackLocale,
LocaleMessageValue,
LocaleMessageDictionary,
LocaleMessageType,
LocaleMessages,
NumberFormat as IntlNumberFormat,
GeneratedTypeConfig,
DateTimeFormat as IntlDateTimeFormat,
DateTimeFormats as IntlDateTimeFormats,
NumberFormats as IntlNumberFormats,
LocaleMatcher as IntlLocaleMatcher,
FormatMatcher as IntlFormatMatcher,
MessageFunction,
MessageFunctions,
PluralizationRule,
LocaleMatcher as IntlLocaleMatcher,
NumberFormat as IntlNumberFormat,
NumberFormats as IntlNumberFormats,
LinkedModifiers,
TranslateOptions,
DateTimeOptions,
NumberOptions,
PostTranslationHandler,
MessageResolver,
Locale,
LocaleMessageDictionary,
LocaleMessages,
LocaleMessageType,
LocaleMessageValue,
MessageCompiler,
MessageCompilerContext,
CompileError,
MessageContext,
MessageFunction,
MessageFunctions,
MessageResolver,
NamedValue,
NumberOptions,
Path,
PathValue,
PluralizationRule,
PostTranslationHandler,
registerLocaleFallbacker,
registerMessageResolver,
RemovedIndexResources,
GeneratedTypeConfig
TranslateOptions
} from '@intlify/core-base'
export {
VueMessageType,
DefineLocaleMessage,
DefaultLocaleMessageSchema,
DefineDateTimeFormat,
DefaultDateTimeFormatSchema,
DefineNumberFormat,
DefaultNumberFormatSchema,
MissingHandler,
ComposerOptions,
Composer,
ComposerCustom,
CustomBlock,
CustomBlocks,
ComposerTranslation,
ComposerDateTimeFormatting,
ComposerNumberFormatting,
ComposerResolveLocaleMessageTranslation
ComposerOptions,
ComposerResolveLocaleMessageTranslation,
ComposerTranslation,
CustomBlock,
CustomBlocks,
DefaultDateTimeFormatSchema,
DefaultLocaleMessageSchema,
DefaultNumberFormatSchema,
DefineDateTimeFormat,
DefineLocaleMessage,
DefineNumberFormat,
MissingHandler,
VueMessageType
} from '../../vue-i18n-core/src/composer'
export {
TranslateResult,
ComposerAdditionalOptions,
ComposerExtender,
createI18n,
ExportedGlobalComposer,
I18n,
I18nAdditionalOptions,
I18nMode,
I18nOptions,
I18nScope,
useI18n,
UseI18nOptions
} from '../../vue-i18n-core/src/i18n'
export {
Choice,
LocaleMessageObject,
PluralizationRulesMap,
WarnHtmlInMessageLevel,
DateTimeFormatResult,
LocaleMessageObject,
NumberFormatResult,
VueI18nOptions,
PluralizationRulesMap,
TranslateResult,
VueI18n,
VueI18nTranslation,
VueI18nTranslationChoice,
VueI18nDateTimeFormatting,
VueI18nExtender,
VueI18nNumberFormatting,
VueI18nOptions,
VueI18nResolveLocaleMessageTranslation,
VueI18nExtender
VueI18nTranslation,
VueI18nTranslationChoice,
WarnHtmlInMessageLevel
} from '../../vue-i18n-core/src/legacy'
export {
createI18n,
useI18n,
I18nOptions,
I18nAdditionalOptions,
I18n,
I18nMode,
I18nScope,
ComposerAdditionalOptions,
UseI18nOptions,
ExportedGlobalComposer,
ComposerExtender
} from '../../vue-i18n-core/src/i18n'
export { I18nPluginOptions } from '../../vue-i18n-core/src/plugin'
export { VERSION } from './../../vue-i18n-core/src/misc'
export { Disposer } from './../../vue-i18n-core/src/types'

export type {
IsNever,
IsEmptyObject,
PickupPaths,
IsNever,
PickupFormatPathKeys,
PickupKeys,
PickupFormatPathKeys
PickupPaths
} from '@intlify/core-base'

// NOTE: experimental !!
Expand Down
124 changes: 63 additions & 61 deletions packages/petite-vue-i18n/src/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getGlobalThis } from '@intlify/shared'
import {
setDevToolsHook,
compile,
registerMessageCompiler
registerMessageCompiler,
setDevToolsHook
} from '@intlify/core-base'
import { getGlobalThis } from '@intlify/shared'
import { initDev, initFeatureFlags } from '../../vue-i18n-core/src/misc'

if (__ESM_BUNDLER__ && !__TEST__) {
Expand All @@ -14,95 +14,97 @@ if (__ESM_BUNDLER__ && !__TEST__) {
registerMessageCompiler(compile)

export {
Path,
PathValue,
NamedValue,
Locale,
CompileError,
DateTimeOptions,
FallbackLocale,
LocaleMessageValue,
LocaleMessageDictionary,
LocaleMessageType,
LocaleMessages,
NumberFormat as IntlNumberFormat,
DateTimeFormat as IntlDateTimeFormat,
DateTimeFormats as IntlDateTimeFormats,
NumberFormats as IntlNumberFormats,
LocaleMatcher as IntlLocaleMatcher,
FormatMatcher as IntlFormatMatcher,
MessageFunction,
MessageFunctions,
PluralizationRule,
LocaleMatcher as IntlLocaleMatcher,
NumberFormat as IntlNumberFormat,
NumberFormats as IntlNumberFormats,
LinkedModifiers,
TranslateOptions,
DateTimeOptions,
NumberOptions,
PostTranslationHandler,
MessageResolver,
Locale,
LocaleMessageDictionary,
LocaleMessages,
LocaleMessageType,
LocaleMessageValue,
MessageCompiler,
MessageCompilerContext,
CompileError,
MessageContext,
RemovedIndexResources
MessageFunction,
MessageFunctions,
MessageResolver,
NamedValue,
NumberOptions,
Path,
PathValue,
PluralizationRule,
PostTranslationHandler,
registerLocaleFallbacker,
registerMessageResolver,
RemovedIndexResources,
TranslateOptions
} from '@intlify/core-base'
export {
VueMessageType,
DefineLocaleMessage,
DefaultLocaleMessageSchema,
DefineDateTimeFormat,
DefaultDateTimeFormatSchema,
DefineNumberFormat,
DefaultNumberFormatSchema,
MissingHandler,
ComposerOptions,
Composer,
ComposerCustom,
CustomBlock,
CustomBlocks,
ComposerTranslation,
ComposerDateTimeFormatting,
ComposerNumberFormatting,
ComposerResolveLocaleMessageTranslation
ComposerOptions,
ComposerResolveLocaleMessageTranslation,
ComposerTranslation,
CustomBlock,
CustomBlocks,
DefaultDateTimeFormatSchema,
DefaultLocaleMessageSchema,
DefaultNumberFormatSchema,
DefineDateTimeFormat,
DefineLocaleMessage,
DefineNumberFormat,
MissingHandler,
VueMessageType
} from '../../vue-i18n-core/src/composer'
export {
TranslateResult,
ComposerAdditionalOptions,
ComposerExtender,
createI18n,
ExportedGlobalComposer,
I18n,
I18nAdditionalOptions,
I18nMode,
I18nOptions,
I18nScope,
useI18n,
UseI18nOptions
} from '../../vue-i18n-core/src/i18n'
export {
Choice,
LocaleMessageObject,
PluralizationRulesMap,
WarnHtmlInMessageLevel,
DateTimeFormatResult,
LocaleMessageObject,
NumberFormatResult,
VueI18nOptions,
PluralizationRulesMap,
TranslateResult,
VueI18n,
VueI18nTranslation,
VueI18nTranslationChoice,
VueI18nDateTimeFormatting,
VueI18nExtender,
VueI18nNumberFormatting,
VueI18nOptions,
VueI18nResolveLocaleMessageTranslation,
VueI18nExtender
VueI18nTranslation,
VueI18nTranslationChoice,
WarnHtmlInMessageLevel
} from '../../vue-i18n-core/src/legacy'
export {
createI18n,
useI18n,
I18nOptions,
I18nAdditionalOptions,
I18n,
I18nMode,
I18nScope,
ComposerAdditionalOptions,
UseI18nOptions,
ExportedGlobalComposer,
ComposerExtender
} from '../../vue-i18n-core/src/i18n'
export { I18nPluginOptions } from '../../vue-i18n-core/src/plugin'
export { VERSION } from './../../vue-i18n-core/src/misc'
export { Disposer } from './../../vue-i18n-core/src/types'

export type {
IsNever,
IsEmptyObject,
PickupPaths,
IsNever,
PickupFormatPathKeys,
PickupKeys,
PickupFormatPathKeys
PickupPaths
} from '@intlify/core-base'

// NOTE: experimental !!
Expand Down

0 comments on commit d8d6180

Please sign in to comment.