From 1fcdbc605bca016e36f2972c0189e86000a22a4d Mon Sep 17 00:00:00 2001 From: jsek Date: Tue, 30 Jul 2024 14:55:49 +0200 Subject: [PATCH] feat(VNumberInput): precision validation message from locale --- packages/vuetify/src/labs/VNumberInput/VNumberInput.tsx | 7 ++++++- packages/vuetify/src/locale/af.ts | 3 +++ packages/vuetify/src/locale/ar.ts | 3 +++ packages/vuetify/src/locale/az.ts | 3 +++ packages/vuetify/src/locale/bg.ts | 3 +++ packages/vuetify/src/locale/ca.ts | 3 +++ packages/vuetify/src/locale/ckb.ts | 3 +++ packages/vuetify/src/locale/cs.ts | 3 +++ packages/vuetify/src/locale/da.ts | 3 +++ packages/vuetify/src/locale/de.ts | 3 +++ packages/vuetify/src/locale/el.ts | 3 +++ packages/vuetify/src/locale/en.ts | 3 +++ packages/vuetify/src/locale/es.ts | 3 +++ packages/vuetify/src/locale/et.ts | 3 +++ packages/vuetify/src/locale/fa.ts | 3 +++ packages/vuetify/src/locale/fi.ts | 3 +++ packages/vuetify/src/locale/fr.ts | 3 +++ packages/vuetify/src/locale/he.ts | 3 +++ packages/vuetify/src/locale/hr.ts | 3 +++ packages/vuetify/src/locale/hu.ts | 3 +++ packages/vuetify/src/locale/id.ts | 3 +++ packages/vuetify/src/locale/it.ts | 3 +++ packages/vuetify/src/locale/ja.ts | 3 +++ packages/vuetify/src/locale/km.ts | 3 +++ packages/vuetify/src/locale/ko.ts | 3 +++ packages/vuetify/src/locale/lt.ts | 3 +++ packages/vuetify/src/locale/lv.ts | 3 +++ packages/vuetify/src/locale/nl.ts | 3 +++ packages/vuetify/src/locale/no.ts | 3 +++ packages/vuetify/src/locale/pl.ts | 3 +++ packages/vuetify/src/locale/pt.ts | 3 +++ packages/vuetify/src/locale/ro.ts | 3 +++ packages/vuetify/src/locale/ru.ts | 3 +++ packages/vuetify/src/locale/sk.ts | 3 +++ packages/vuetify/src/locale/sl.ts | 3 +++ packages/vuetify/src/locale/sr-Cyrl.ts | 3 +++ packages/vuetify/src/locale/sr-Latn.ts | 3 +++ packages/vuetify/src/locale/sv.ts | 3 +++ packages/vuetify/src/locale/th.ts | 3 +++ packages/vuetify/src/locale/tr.ts | 3 +++ packages/vuetify/src/locale/uk.ts | 3 +++ packages/vuetify/src/locale/vi.ts | 3 +++ packages/vuetify/src/locale/zh-Hans.ts | 3 +++ packages/vuetify/src/locale/zh-Hant.ts | 3 +++ 44 files changed, 135 insertions(+), 1 deletion(-) diff --git a/packages/vuetify/src/labs/VNumberInput/VNumberInput.tsx b/packages/vuetify/src/labs/VNumberInput/VNumberInput.tsx index 86f3a8582a54..1173c1c4deaf 100644 --- a/packages/vuetify/src/labs/VNumberInput/VNumberInput.tsx +++ b/packages/vuetify/src/labs/VNumberInput/VNumberInput.tsx @@ -18,6 +18,7 @@ import { clamp, genericComponent, getDecimals, omit, propsFactory, useRender } f // Types import type { PropType } from 'vue' import type { VTextFieldSlots } from '@/components/VTextField/VTextField' +import { useLocale } from '@/composables' type ControlSlot = { click: (e: MouseEvent) => void @@ -73,6 +74,8 @@ export const VNumberInput = genericComponent()({ }, setup (props, { slots }) { + const { t } = useLocale() + const model = useProxiedModel(props, 'modelValue') const inputText = ref(null) @@ -117,7 +120,9 @@ export const VNumberInput = genericComponent()({ }, { immediate: true }) const precisionRules = computed(() => [ - (v: string | null) => isNaN(Number(v)) || getDecimals(Number(v)) <= props.precision! || `Expected up to ${props.precision} decimal places`, + (v: string | null) => isNaN(Number(v)) || + getDecimals(Number(v)) <= props.precision! || + t('$vuetify.numberInput.precisionExceeded', props.precision), ]) function formatInputValue () { diff --git a/packages/vuetify/src/locale/af.ts b/packages/vuetify/src/locale/af.ts index 34fc7bd4c765..c54604c6a145 100644 --- a/packages/vuetify/src/locale/af.ts +++ b/packages/vuetify/src/locale/af.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/ar.ts b/packages/vuetify/src/locale/ar.ts index b5ec2b2ea6f4..6d510c83e13b 100644 --- a/packages/vuetify/src/locale/ar.ts +++ b/packages/vuetify/src/locale/ar.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/az.ts b/packages/vuetify/src/locale/az.ts index b452d1ccd950..28c6ee899d91 100644 --- a/packages/vuetify/src/locale/az.ts +++ b/packages/vuetify/src/locale/az.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/bg.ts b/packages/vuetify/src/locale/bg.ts index f795df460160..1d77f3386d36 100644 --- a/packages/vuetify/src/locale/bg.ts +++ b/packages/vuetify/src/locale/bg.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Зареди още', empty: 'Няма повече', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/ca.ts b/packages/vuetify/src/locale/ca.ts index 09b06b0b9e9f..cc286166f211 100644 --- a/packages/vuetify/src/locale/ca.ts +++ b/packages/vuetify/src/locale/ca.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/ckb.ts b/packages/vuetify/src/locale/ckb.ts index 64ffde6ea1a6..5d8004fdf86b 100644 --- a/packages/vuetify/src/locale/ckb.ts +++ b/packages/vuetify/src/locale/ckb.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/cs.ts b/packages/vuetify/src/locale/cs.ts index 85a8b6b613af..2c1d975d4239 100644 --- a/packages/vuetify/src/locale/cs.ts +++ b/packages/vuetify/src/locale/cs.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Načíst více', empty: 'Žádné další', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/da.ts b/packages/vuetify/src/locale/da.ts index 8a80af265005..e84035867dbf 100644 --- a/packages/vuetify/src/locale/da.ts +++ b/packages/vuetify/src/locale/da.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/de.ts b/packages/vuetify/src/locale/de.ts index 9b350fc12228..47b8238056af 100644 --- a/packages/vuetify/src/locale/de.ts +++ b/packages/vuetify/src/locale/de.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Mehr laden', empty: 'Nichts weiteres', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/el.ts b/packages/vuetify/src/locale/el.ts index be1701683f9f..b610b691092d 100755 --- a/packages/vuetify/src/locale/el.ts +++ b/packages/vuetify/src/locale/el.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/en.ts b/packages/vuetify/src/locale/en.ts index cf94f5e97865..aceb9fc62e1d 100644 --- a/packages/vuetify/src/locale/en.ts +++ b/packages/vuetify/src/locale/en.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/es.ts b/packages/vuetify/src/locale/es.ts index 849ddececaa8..51bcd40d534e 100644 --- a/packages/vuetify/src/locale/es.ts +++ b/packages/vuetify/src/locale/es.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/et.ts b/packages/vuetify/src/locale/et.ts index b420079173d8..65b6e5684943 100644 --- a/packages/vuetify/src/locale/et.ts +++ b/packages/vuetify/src/locale/et.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/fa.ts b/packages/vuetify/src/locale/fa.ts index d80255e4351a..435bd3cd7496 100644 --- a/packages/vuetify/src/locale/fa.ts +++ b/packages/vuetify/src/locale/fa.ts @@ -99,4 +99,7 @@ export default { loadMore: 'بارگذاری بیشتر', empty: 'پایان', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/fi.ts b/packages/vuetify/src/locale/fi.ts index d03c07039280..798d5f00c2b4 100644 --- a/packages/vuetify/src/locale/fi.ts +++ b/packages/vuetify/src/locale/fi.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/fr.ts b/packages/vuetify/src/locale/fr.ts index 717e2902829d..72201934ceff 100644 --- a/packages/vuetify/src/locale/fr.ts +++ b/packages/vuetify/src/locale/fr.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Charger plus', empty: 'Aucune donnée supplémentaire', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/he.ts b/packages/vuetify/src/locale/he.ts index ebc04e428e6d..b05108162d11 100644 --- a/packages/vuetify/src/locale/he.ts +++ b/packages/vuetify/src/locale/he.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/hr.ts b/packages/vuetify/src/locale/hr.ts index d24be21324b1..aae14b7166a0 100644 --- a/packages/vuetify/src/locale/hr.ts +++ b/packages/vuetify/src/locale/hr.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/hu.ts b/packages/vuetify/src/locale/hu.ts index d23db5b5e152..f216ccd54e07 100644 --- a/packages/vuetify/src/locale/hu.ts +++ b/packages/vuetify/src/locale/hu.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Továbbiak', empty: 'Nincsen több', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/id.ts b/packages/vuetify/src/locale/id.ts index ad689c5f4781..45d523d0fa82 100644 --- a/packages/vuetify/src/locale/id.ts +++ b/packages/vuetify/src/locale/id.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/it.ts b/packages/vuetify/src/locale/it.ts index cc2d11e9f53e..1684df2975c2 100644 --- a/packages/vuetify/src/locale/it.ts +++ b/packages/vuetify/src/locale/it.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Carica altro', empty: 'Nessun elemento', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/ja.ts b/packages/vuetify/src/locale/ja.ts index 1156492f5528..224f170ffb90 100644 --- a/packages/vuetify/src/locale/ja.ts +++ b/packages/vuetify/src/locale/ja.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/km.ts b/packages/vuetify/src/locale/km.ts index 10c1cd735acb..9b83a2593db4 100644 --- a/packages/vuetify/src/locale/km.ts +++ b/packages/vuetify/src/locale/km.ts @@ -99,4 +99,7 @@ export default { loadMore: 'ទាញយកបន្ថែម', empty: 'គ្មានទំព័រទៀត', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/ko.ts b/packages/vuetify/src/locale/ko.ts index 1a0782eec8a8..ff727616b043 100644 --- a/packages/vuetify/src/locale/ko.ts +++ b/packages/vuetify/src/locale/ko.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/lt.ts b/packages/vuetify/src/locale/lt.ts index 307340e31a3b..6e924422b944 100644 --- a/packages/vuetify/src/locale/lt.ts +++ b/packages/vuetify/src/locale/lt.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Užkrauti daugiau', empty: 'Daugiau nėra', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/lv.ts b/packages/vuetify/src/locale/lv.ts index eb493589646d..126a85235142 100644 --- a/packages/vuetify/src/locale/lv.ts +++ b/packages/vuetify/src/locale/lv.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/nl.ts b/packages/vuetify/src/locale/nl.ts index b8c6032fe32c..77a024353d36 100644 --- a/packages/vuetify/src/locale/nl.ts +++ b/packages/vuetify/src/locale/nl.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Laad meer', empty: 'Niet meer', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/no.ts b/packages/vuetify/src/locale/no.ts index c9fc72ddfc6a..88a8b80225a2 100644 --- a/packages/vuetify/src/locale/no.ts +++ b/packages/vuetify/src/locale/no.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Last flere', empty: 'Det var alt', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/pl.ts b/packages/vuetify/src/locale/pl.ts index 0e45ad375dff..396169f443d5 100644 --- a/packages/vuetify/src/locale/pl.ts +++ b/packages/vuetify/src/locale/pl.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Wczytaj więcej', empty: 'Brak kolejnych danych', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/pt.ts b/packages/vuetify/src/locale/pt.ts index d6094cb7edd6..9e2e2f77f90c 100644 --- a/packages/vuetify/src/locale/pt.ts +++ b/packages/vuetify/src/locale/pt.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Carregar mais', empty: 'Não há mais dados', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/ro.ts b/packages/vuetify/src/locale/ro.ts index 615b28616372..18bd1af552e6 100644 --- a/packages/vuetify/src/locale/ro.ts +++ b/packages/vuetify/src/locale/ro.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Încarcă mai multe', empty: 'Nu mai există', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/ru.ts b/packages/vuetify/src/locale/ru.ts index 3c6eb2cde0ed..205837e207f5 100644 --- a/packages/vuetify/src/locale/ru.ts +++ b/packages/vuetify/src/locale/ru.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Загрузить ещё', empty: 'Больше нечего загружать', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/sk.ts b/packages/vuetify/src/locale/sk.ts index 9b1ffe2481e6..5841e8c6f321 100644 --- a/packages/vuetify/src/locale/sk.ts +++ b/packages/vuetify/src/locale/sk.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Načítať viac', empty: 'Žiadne ďalšie', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/sl.ts b/packages/vuetify/src/locale/sl.ts index c36e668c6114..0d151ca74a4b 100644 --- a/packages/vuetify/src/locale/sl.ts +++ b/packages/vuetify/src/locale/sl.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Naloži več', empty: 'Konec', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/sr-Cyrl.ts b/packages/vuetify/src/locale/sr-Cyrl.ts index 6e9c1f9cc166..42418ae8db1b 100644 --- a/packages/vuetify/src/locale/sr-Cyrl.ts +++ b/packages/vuetify/src/locale/sr-Cyrl.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/sr-Latn.ts b/packages/vuetify/src/locale/sr-Latn.ts index 485d81bd2d01..d8632335b213 100644 --- a/packages/vuetify/src/locale/sr-Latn.ts +++ b/packages/vuetify/src/locale/sr-Latn.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/sv.ts b/packages/vuetify/src/locale/sv.ts index 2a0b576b7aa9..d1e3e358a3e6 100644 --- a/packages/vuetify/src/locale/sv.ts +++ b/packages/vuetify/src/locale/sv.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/th.ts b/packages/vuetify/src/locale/th.ts index 672643cd6c08..b2ee91eb0969 100644 --- a/packages/vuetify/src/locale/th.ts +++ b/packages/vuetify/src/locale/th.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/tr.ts b/packages/vuetify/src/locale/tr.ts index 2463d23ba1ea..1ad2949d2d90 100644 --- a/packages/vuetify/src/locale/tr.ts +++ b/packages/vuetify/src/locale/tr.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/uk.ts b/packages/vuetify/src/locale/uk.ts index 4d1d28540ac7..f67a43229aca 100644 --- a/packages/vuetify/src/locale/uk.ts +++ b/packages/vuetify/src/locale/uk.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/vi.ts b/packages/vuetify/src/locale/vi.ts index 67915a2dc1eb..7df3072f0ecc 100644 --- a/packages/vuetify/src/locale/vi.ts +++ b/packages/vuetify/src/locale/vi.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/zh-Hans.ts b/packages/vuetify/src/locale/zh-Hans.ts index dec1c61f811e..8849ce1c81fa 100644 --- a/packages/vuetify/src/locale/zh-Hans.ts +++ b/packages/vuetify/src/locale/zh-Hans.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, } diff --git a/packages/vuetify/src/locale/zh-Hant.ts b/packages/vuetify/src/locale/zh-Hant.ts index dbae45b65267..333415d26595 100644 --- a/packages/vuetify/src/locale/zh-Hant.ts +++ b/packages/vuetify/src/locale/zh-Hant.ts @@ -99,4 +99,7 @@ export default { loadMore: 'Load more', empty: 'No more', }, + numberInput: { + precisionExceeded: 'Expected up to {0} decimal places', + }, }