New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$te returns false if the key contains dot #1521
Comments
Hi! I have the same error. When using a dot in the key - |
Same problem here. Please support it ( maybe just an option to choose the key separator) |
Same for me. |
same, had to remove $te check in the if before, was wondering why i18n didn't work after dependency update |
when my key is Chinese,it can't match. |
Same issue - using this workaround for now...
|
Still not fixed :( |
@dmcknight26 solution works, some changes:
|
Thank you for your solution, here is the Typescript support (also without lodash dependency): export const i18n = createI18n({
locale: `fr-FR`,
legacy: false,
warnHtmlMessage: false,
messages,
})
i18n.global.te = (key: Parameters<typeof i18n.global.te>[0], locale: Parameters<typeof i18n.global.te>[1]) => {
const effectiveLocale = locale && locale.length ? locale : i18n.global.locale.value
const messages = i18n.global.messages.value[effectiveLocale]
return Object.hasOwn(messages, key)
} |
Bump, I'm using a flattened json for i18n, Refs for attention: intlify/vue-i18n-next#271 |
Reporting a bug?
If
key
has dot likea.b.c
,$t('a.b.c')
will get the correct result, but$te
will return false.Expected behavior
$te
returntrue
Reproduction
$t('a.b.c')
returnfalse
System Info
Screenshot
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: