I am working in Vue 3 and Vuetify 3.
I would like my app to use the local currency symbol based on wherever it is running. If the app is running in the US, I want it to use the dollar sign, if it is in Europe, I want it to use the euro sign, etc.
I've never done and localization/internationalization with Vue/Vuetify though I did dabble with it from time to time in Java several years back. How is all this handled in Vue/Vuetify?
A given locale might use more than one currency, so there is no built-in method to derive a single currency symbol for a locale — for that you'll have to implement a mapping of locales to symbols that meets your project's requirements. (Asking for recommendations for such a third-party library is not on-topic for Stack Overflow — although you might find ISO 4217 to be a useful resource).
To resolve the default locale for a runtime using the Intl
API, you can use new Intl.NumberFormat().resolvedOptions().locale
as demonstrated in this question.
const defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
console.log(defaultLocale);