You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've noticed that $te will not see a translation exists if the message key contains periods and it is not in nested form in the messages object, but $t will translate the message correctly regardless.
Example:
$te is checking in the default 'en-US' locale where no translation is defined. Similarly, $t also checks 'en-US' but will use the fallback 'en' if no translation is found. To resolve this, you could set the locale to 'en'
Additionally, $te won't work with the flat key annotation like "example.message" unless you set flatJson to true. So the resulting snippet is:
As already mentioned, If you want to use keys in object path format, you must specify flatJson: true to createI18n. That will flatten the message inside vue-i18n.
Reporting a bug?
Hi, I've noticed that
$te
will not see a translation exists if the message key contains periods and it is not in nested form in the messages object, but$t
will translate the message correctly regardless.Example:
$te('example.message')
:false
$t('example.message')
:'Example message'
Expected behavior
$te
should see the message exists if it exists in the messages object, because clearly it can be translated correctly anyway by$t
Reproduction
Code sandbox
System Info
Screenshot
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: