From 4bb0b4aefea01eda3168c022b1255036b3d9371b Mon Sep 17 00:00:00 2001 From: Joakim Bjerknes Date: Tue, 12 Nov 2024 19:10:34 +0100 Subject: [PATCH] camel case translations --- .../src/components/date-picker/DatePicker.tsx | 2 +- .../dnb-eufemia/src/shared/locales/en-GB.ts | 32 +++++++++---------- .../dnb-eufemia/src/shared/locales/en-US.ts | 8 ++--- .../dnb-eufemia/src/shared/locales/index.ts | 7 +++- .../dnb-eufemia/src/shared/locales/nb-NO.ts | 32 +++++++++---------- 5 files changed, 43 insertions(+), 38 deletions(-) diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePicker.tsx b/packages/dnb-eufemia/src/components/date-picker/DatePicker.tsx index 2a082c4355d..3cdd83cc20d 100644 --- a/packages/dnb-eufemia/src/components/date-picker/DatePicker.tsx +++ b/packages/dnb-eufemia/src/components/date-picker/DatePicker.tsx @@ -605,7 +605,7 @@ function DatePicker(externalProps: DatePickerAllProps) { props, defaultProps, { skeleton: context?.skeleton }, - context.getTranslation(props).DatePicker, + convertSnakeCaseProps(context.getTranslation(props).DatePicker), pickFormElementProps(context?.FormRow), // Deprecated – can be removed in v11 pickFormElementProps(context?.formElement), context.DatePicker diff --git a/packages/dnb-eufemia/src/shared/locales/en-GB.ts b/packages/dnb-eufemia/src/shared/locales/en-GB.ts index 273d4ba18ef..7d498f444d9 100644 --- a/packages/dnb-eufemia/src/shared/locales/en-GB.ts +++ b/packages/dnb-eufemia/src/shared/locales/en-GB.ts @@ -23,22 +23,22 @@ export default { year: 'Year', start: 'from', end: 'to', - selected_date: 'Selected date: %s', - selected_month: 'Selected month %s', - selected_year: 'Selected year %s', - next_month: 'Next month %s', - prev_month: 'Previous month %s', - next_year: 'Next year %s', - prev_year: 'Previous year %s', - open_picker_text: 'Open date picker', - mask_order: 'dd/mm/yyyy', - mask_placeholder: 'dd/mm/yyyy', // have to be same setup as "mask" - but can be like: dd/mm/åååå - date_format: 'yyyy-MM-dd', // in v1 of date-fns we were more flexible in terms of the format - return_format: 'yyyy-MM-dd', // used in date-fns v1: YYYY-MM-DD - submit_button_text: 'OK', - cancel_button_text: 'Cancel', - reset_button_text: 'Reset', - placeholder_characters: { + selectedDate: 'Selected date: %s', + selectedMonth: 'Selected month %s', + selectedYear: 'Selected year %s', + nextMonth: 'Next month %s', + prevMonth: 'Previous month %s', + nextYear: 'Next year %s', + prevYear: 'Previous year %s', + openPickerText: 'Open date picker', + maskOrder: 'dd/mm/yyyy', + maskPlaceholder: 'dd/mm/yyyy', // have to be same setup as "mask" - but can be like: dd/mm/åååå + dateFormat: 'yyyy-MM-dd', // in v1 of date-fns we were more flexible in terms of the format + returnFormat: 'yyyy-MM-dd', // used in date-fns v1: YYYY-MM-DD + submitButtonText: 'OK', + cancelButtonText: 'Cancel', + resetButtonText: 'Reset', + placeholderCharacters: { day: 'd', month: 'm', year: 'y', diff --git a/packages/dnb-eufemia/src/shared/locales/en-US.ts b/packages/dnb-eufemia/src/shared/locales/en-US.ts index 027f9df5b66..d218a3f8201 100644 --- a/packages/dnb-eufemia/src/shared/locales/en-US.ts +++ b/packages/dnb-eufemia/src/shared/locales/en-US.ts @@ -7,13 +7,13 @@ export default { ...enGB, DatePicker: { ...enGB.DatePicker, - mask_order: 'mm/dd/yyyy', - mask_placeholder: 'mm/dd/yyyy', // have to be same setup as "mask" - but can be like: mm/dd/åååå - first_day: 'sunday', + maskOrder: 'mm/dd/yyyy', + maskPlaceholder: 'mm/dd/yyyy', // have to be same setup as "mask" - but can be like: mm/dd/åååå + firstDay: 'sunday', }, } satisfies typeof enGB & { DatePicker: { - first_day: string + firstDay: string } }, } diff --git a/packages/dnb-eufemia/src/shared/locales/index.ts b/packages/dnb-eufemia/src/shared/locales/index.ts index 664ba9d7aa3..22b0242dc79 100644 --- a/packages/dnb-eufemia/src/shared/locales/index.ts +++ b/packages/dnb-eufemia/src/shared/locales/index.ts @@ -1,7 +1,12 @@ // import default locales import nbNO from './nb-NO' import enGB from './en-GB' +import enUS from './en-US' -const locales = { ...nbNO, ...enGB } +const locales = { ...nbNO, ...enGB, ...enUS } + +export type TranslationsNbNO = (typeof locales)['nb-NO'] +export type TranslationsEnGB = (typeof locales)['en-GB'] +export type TranslationsEnUS = (typeof locales)['en-US'] export default locales diff --git a/packages/dnb-eufemia/src/shared/locales/nb-NO.ts b/packages/dnb-eufemia/src/shared/locales/nb-NO.ts index ebb1ac29dd0..2805e5ec252 100644 --- a/packages/dnb-eufemia/src/shared/locales/nb-NO.ts +++ b/packages/dnb-eufemia/src/shared/locales/nb-NO.ts @@ -22,22 +22,22 @@ export default { year: 'år', start: 'fra', end: 'til', - selected_date: 'Valgt dato: %s', - selected_month: 'Valgt måned %s', - selected_year: 'Valgt år %s', - next_month: 'Neste måned %s', - prev_month: 'Forrige måned %s', - next_year: 'Neste år %s', - prev_year: 'Forrige år %s', - open_picker_text: 'åpne datovelger', - mask_order: 'dd/mm/yyyy', - mask_placeholder: 'dd.mm.åååå', // have to be same setup as "mask" - but can be like: dd/mm/åååå - date_format: 'yyyy-MM-dd', // in v1 of date-fns we were more flexible in terms of the format - return_format: 'yyyy-MM-dd', // used in date-fns v1: YYYY-MM-DD - submit_button_text: 'Ok', - cancel_button_text: 'Avbryt', - reset_button_text: 'Tilbakestill', - placeholder_characters: { + selectedDate: 'Valgt dato: %s', + selectedMonth: 'Valgt måned %s', + selectedYear: 'Valgt år %s', + nextMonth: 'Neste måned %s', + prevMonth: 'Forrige måned %s', + nextYear: 'Neste år %s', + prevYear: 'Forrige år %s', + openPickerText: 'åpne datovelger', + maskOrder: 'dd/mm/yyyy', + maskPlaceholder: 'dd.mm.åååå', // have to be same setup as "mask" - but can be like: dd/mm/åååå + dateFormat: 'yyyy-MM-dd', // in v1 of date-fns we were more flexible in terms of the format + returnFormat: 'yyyy-MM-dd', // used in date-fns v1: YYYY-MM-DD + submitButtonText: 'Ok', + cancelButtonText: 'Avbryt', + resetButtonText: 'Tilbakestill', + placeholderCharacters: { day: 'd', month: 'm', year: 'å',