3

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.

HMR
  • 37,593
  • 24
  • 91
  • 160
  • This is usually happens when define `en-US` and use `en`, try to be more consistent between config and usage, also I believe the language code is `en` (or `en-US`) rather than `US`. – Ibrahim.H Oct 12 '22 at 15:49

0 Answers0