The docs describe adding an exclamation mark to locale to prevent vue-i18n from falling back to language parts when a regional/dialect match isn't found (e.g. en from en-US). While this is supported by the standard t/$t translator, it breaks the numeric n/$n formatter entirely, apparently due to passing the configured locale directly to new Intl.NumberFormat(locale, ...).
vue-i18n.js?v=01aa3a84:3153 Uncaught RangeError: Incorrect locale information provided
at new NumberFormat (<anonymous>)
at number (vue-i18n.js?v=01aa3a84:3153:12)
at vue-i18n.js?v=01aa3a84:3825:46
at wrapWithDeps (vue-i18n.js?v=01aa3a84:3773:13)
at Proxy.n (vue-i18n.js?v=01aa3a84:3825:12)
at Proxy._sfc_render (App.vue:9:6)
at renderComponentRoot (chunk-FVTSMHLH.js?v=28e50421:2226:17)
at ReactiveEffect.componentUpdateFn [as fn] (chunk-FVTSMHLH.js?v=28e50421:7162:46)
at ReactiveEffect.run (chunk-FVTSMHLH.js?v=28e50421:422:19)
at instance.update (chunk-FVTSMHLH.js?v=28e50421:7275:52)
Expected behavior
n/$n should behave the same as t/$t, and no error should occur.
Reporting a bug?
The docs describe adding an exclamation mark to
locale
to prevent vue-i18n from falling back to language parts when a regional/dialect match isn't found (e.g.en
fromen-US
). While this is supported by the standardt
/$t
translator, it breaks the numericn
/$n
formatter entirely, apparently due to passing the configuredlocale
directly tonew Intl.NumberFormat(locale, ...)
.Expected behavior
n
/$n
should behave the same ast
/$t
, and no error should occur.Reproduction
https://stackblitz.com/edit/vitejs-vite-uyzmvt?file=src%2Fmain.ts,src%2FApp.vue
System Info
Screenshot
No response
Additional context
No response
Validations