webapp: Remove duplicated code
This commit is contained in:
parent
df80953b5e
commit
ea4e7b77f5
@ -12,44 +12,23 @@ export const LOCALES = [
|
|||||||
{ value: Locales.FR, caption: 'Français' },
|
{ value: Locales.FR, caption: 'Français' },
|
||||||
]
|
]
|
||||||
|
|
||||||
export const dateTimeFormats: I18nOptions["datetimeFormats"] = {
|
export const dateTimeFormats: I18nOptions["datetimeFormats"] = {};
|
||||||
[Locales.EN]: {
|
export const numberFormats: I18nOptions["numberFormats"] = {};
|
||||||
'datetime': {
|
|
||||||
hour: 'numeric',
|
|
||||||
minute: 'numeric',
|
|
||||||
second: 'numeric',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'numeric',
|
|
||||||
day: 'numeric',
|
|
||||||
hour12: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[Locales.DE]: {
|
|
||||||
'datetime': {
|
|
||||||
hour: 'numeric',
|
|
||||||
minute: 'numeric',
|
|
||||||
second: 'numeric',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'numeric',
|
|
||||||
day: 'numeric',
|
|
||||||
hour12: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[Locales.FR]: {
|
|
||||||
'datetime': {
|
|
||||||
hour: 'numeric',
|
|
||||||
minute: 'numeric',
|
|
||||||
second: 'numeric',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'numeric',
|
|
||||||
day: 'numeric',
|
|
||||||
hour12: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const numberFormats: I18nOptions["numberFormats"] = {
|
LOCALES.forEach((locale) => {
|
||||||
[Locales.EN]: {
|
dateTimeFormats[locale.value] = {
|
||||||
|
'datetime': {
|
||||||
|
hour: 'numeric',
|
||||||
|
minute: 'numeric',
|
||||||
|
second: 'numeric',
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'numeric',
|
||||||
|
day: 'numeric',
|
||||||
|
hour12: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
numberFormats[locale.value] = {
|
||||||
decimal: {
|
decimal: {
|
||||||
style: 'decimal',
|
style: 'decimal',
|
||||||
},
|
},
|
||||||
@ -74,59 +53,7 @@ export const numberFormats: I18nOptions["numberFormats"] = {
|
|||||||
celsius: {
|
celsius: {
|
||||||
style: 'unit', unit: 'celsius', maximumFractionDigits: 1,
|
style: 'unit', unit: 'celsius', maximumFractionDigits: 1,
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
[Locales.DE]: {
|
});
|
||||||
decimal: {
|
|
||||||
style: 'decimal',
|
|
||||||
},
|
|
||||||
decimalNoDigits: {
|
|
||||||
style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0
|
|
||||||
},
|
|
||||||
decimalTwoDigits: {
|
|
||||||
style: 'decimal', minimumFractionDigits: 2, maximumFractionDigits: 2
|
|
||||||
},
|
|
||||||
percent: {
|
|
||||||
style: 'percent',
|
|
||||||
},
|
|
||||||
byte: {
|
|
||||||
style: 'unit', unit: 'byte',
|
|
||||||
},
|
|
||||||
kilobyte: {
|
|
||||||
style: 'unit', unit: 'kilobyte',
|
|
||||||
},
|
|
||||||
megabyte: {
|
|
||||||
style: 'unit', unit: 'megabyte',
|
|
||||||
},
|
|
||||||
celsius: {
|
|
||||||
style: 'unit', unit: 'celsius', maximumFractionDigits: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
[Locales.FR]: {
|
|
||||||
decimal: {
|
|
||||||
style: 'decimal',
|
|
||||||
},
|
|
||||||
decimalNoDigits: {
|
|
||||||
style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0
|
|
||||||
},
|
|
||||||
decimalTwoDigits: {
|
|
||||||
style: 'decimal', minimumFractionDigits: 2, maximumFractionDigits: 2
|
|
||||||
},
|
|
||||||
percent: {
|
|
||||||
style: 'percent',
|
|
||||||
},
|
|
||||||
byte: {
|
|
||||||
style: 'unit', unit: 'byte',
|
|
||||||
},
|
|
||||||
kilobyte: {
|
|
||||||
style: 'unit', unit: 'kilobyte',
|
|
||||||
},
|
|
||||||
megabyte: {
|
|
||||||
style: 'unit', unit: 'megabyte',
|
|
||||||
},
|
|
||||||
celsius: {
|
|
||||||
style: 'unit', unit: 'celsius', maximumFractionDigits: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const defaultLocale = Locales.EN;
|
export const defaultLocale = Locales.EN;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user