I have the following warning in my vue 3 app:
[intlify] Not found 'currency' key in 'US' locale messages.
[intlify] Fall back to number format 'currency' key with 'en-US' locale
[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.
This is how I set it up:
const i18n = createI18n({
legacy: false,
globalInjection: true,
numberFormats: config.formats.number,
dateTimeFormats: config.formats.datetime,
});
console.log(
JSON.stringify(config.formats.number, undefined, 2)
);
The output of console.log is:
{
"DE": {
"currency": {
"style": "currency",
"currency": "EUR",
"currencyDisplay": "symbol"
}
},
"US": {
"currency": {
"style": "currency",
"currency": "USD"
}
}
}
This is how I use it in setup (composition api):
const { n } = useI18n({
inheritLocale: true,
useScope: 'local',
});
const formattedMoney = computed(() => {
console.log(amount.value, location.value);
return n(amount.value, 'currency', location.value);
});
The output of console.log is:
180.62 'US'
In the end it will produce US$180.62, is it possible to produce this output without all the warnings?
I would like to access $n in the setup without having to call the useI18n, is this possible?