@@ -9,6 +9,14 @@ function inferDecimalSeparator (n: ReturnType<typeof useI18n>['n']) {
99 return n ( 0.1 ) . includes ( ',' ) ? ',' : '.'
1010}
1111
12+ function inferNumericGroupSeparator ( n : ReturnType < typeof useI18n > [ 'n' ] ) {
13+ // Vuetify's own adapter uses `n(10000, { part: true }).find(...)`, but vue-i18n's
14+ // `n` does not honour `part` in every Nuxt i18n setup (it returns a string, not
15+ // parts), so derive the separator from the grouped output instead — same string
16+ // approach as inferDecimalSeparator above.
17+ return n ( 10_000 , { useGrouping : true } ) . replace ( / \p{ Nd} / gu, '' ) || ' '
18+ }
19+
1220export function createAdapter ( vuetifyOptions : VuetifyOptions ) {
1321 vuetifyOptions . locale = { }
1422 const nuxtApp = useNuxtApp ( )
@@ -42,6 +50,7 @@ export function createAdapter (vuetifyOptions: VuetifyOptions) {
4250 n : i18n . n ,
4351 provide : createProvideFunction ( { current : currentLocale , fallback, messages } ) ,
4452 decimalSeparator : toRef ( ( ) => inferDecimalSeparator ( i18n . n ) ) ,
53+ numericGroupSeparator : toRef ( ( ) => inferNumericGroupSeparator ( i18n . n ) ) ,
4554 }
4655}
4756
@@ -81,6 +90,7 @@ function createProvideFunction (data: {
8190 t,
8291 n,
8392 decimalSeparator : toRef ( ( ) => props . decimalSeparator ?? inferDecimalSeparator ( n ) ) ,
93+ numericGroupSeparator : toRef ( ( ) => inferNumericGroupSeparator ( n ) ) ,
8494 provide : createProvideFunction ( { current : currentLocale , fallback : data . fallback , messages : data . messages } ) ,
8595 }
8696 }
0 commit comments