Quantcast
Viewing all articles
Browse latest Browse all 43

Vue i18n sometimes warn about missing key

In my home component I have the following:

const { location } = useLocation();const { t, n } = useI18n();const freeShippingValue = computed(() => {  return n(100, 'currency', location.value);});

In my BaseMoney component I have:

const { n } = useI18n();const { location } = useLocation();const formattedMoney = computed(() => {  return n(amount.value, 'currency', location.value);});

In Home.js this generates warnings:

[intlify] Not found 'currency' key in 'DE' locale messages.[intlify] Fall back to number format 'currency' key with 'en-US' locale.[intlify] Not found 'currency' key in 'en-US' locale messages.[intlify] Not found 'currency' key in 'en-US' locale messages.[intlify] Not found 'currency' key in 'en-US' locale messages.[intlify] Fall back to number format 'currency' key with 'en' locale.[intlify] Not found 'currency' key in 'en' locale messages.[intlify] Fall back to number format 'currency' with root locale.

Full code is here

I set up i18n here home is here and BaseMoney is here

Why would I get warnings in one component but not in another?

I can change both Home and BaseMoney to return n(100, 'currency', 'US'); and still get a warning in Home but not in BaseMoney.

When I remove translations for the component the warnings are not there but I don't understand why adding component translations breaks number formatting.


Viewing all articles
Browse latest Browse all 43

Trending Articles