Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Italian language #1830

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/Display_Graphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@ std::map<DisplayType_t, std::function<U8G2*(uint8_t, uint8_t, uint8_t, uint8_t)>
#define I18N_LOCALE_EN 0
#define I18N_LOCALE_DE 1
#define I18N_LOCALE_FR 2
#define I18N_LOCALE_IT 3

// Languages supported. Note: the order is important and must match locale_translations.h
const uint8_t languages[] = {
I18N_LOCALE_EN,
I18N_LOCALE_DE,
I18N_LOCALE_FR
I18N_LOCALE_FR,
I18N_LOCALE_IT
};

static const char* const i18n_offline[] = { "Offline", "Offline", "Offline" };
static const char* const i18n_current_power_w[] = { "%.0f W", "%.0f W", "%.0f W" };
static const char* const i18n_current_power_kw[] = { "%.1f kW", "%.1f kW", "%.1f kW" };
static const char* const i18n_yield_today_wh[] = { "today: %4.0f Wh", "Heute: %4.0f Wh", "auj.: %4.0f Wh" };
static const char* const i18n_yield_total_kwh[] = { "total: %.1f kWh", "Ges.: %.1f kWh", "total: %.1f kWh" };
static const char* const i18n_yield_total_mwh[] = { "total: %.0f kWh", "Ges.: %.0f kWh", "total: %.0f kWh" };
static const char* const i18n_date_format[] = { "%m/%d/%Y %H:%M", "%d.%m.%Y %H:%M", "%d/%m/%Y %H:%M" };
static const char* const i18n_offline[] = { "Offline", "Offline", "Offline", "Offline" };
static const char* const i18n_current_power_w[] = { "%.0f W", "%.0f W", "%.0f W", "%.0f W" };
static const char* const i18n_current_power_kw[] = { "%.1f kW", "%.1f kW", "%.1f kW", "%.1f kW" };
static const char* const i18n_yield_today_wh[] = { "today: %4.0f Wh", "Heute: %4.0f Wh", "auj.: %4.0f Wh", "oggi: %4.0f Wh" };
static const char* const i18n_yield_total_kwh[] = { "total: %.1f kWh", "Ges.: %.1f kWh", "total: %.1f kWh", "totale: %.1f kWh" };
static const char* const i18n_yield_total_mwh[] = { "total: %.0f kWh", "Ges.: %.0f kWh", "total: %.0f kWh", "totale: %.0f kWh" };
static const char* const i18n_date_format[] = { "%m/%d/%Y %H:%M", "%d.%m.%Y %H:%M", "%d/%m/%Y %H:%M", "%d/%m/%Y %H:%M" };

DisplayGraphicClass::DisplayGraphicClass()
: _loopTask(TASK_IMMEDIATE, TASK_FOREVER, std::bind(&DisplayGraphicClass::loop, this))
Expand Down
32 changes: 31 additions & 1 deletion webapp/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ export enum Locales {
EN = 'en',
DE = 'de',
FR = 'fr',
IT = 'it',
}

export const LOCALES = [
{ value: Locales.EN, caption: 'English' },
{ value: Locales.DE, caption: 'Deutsch' },
{ value: Locales.FR, caption: 'Français' },
{ value: Locales.IT, caption: 'Italiano' },
]

export const dateTimeFormats: I18nOptions["datetimeFormats"] = {
Expand Down Expand Up @@ -45,6 +47,17 @@ export const dateTimeFormats: I18nOptions["datetimeFormats"] = {
day: 'numeric',
hour12: false
}
},
[Locales.IT]: {
'datetime': {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour12: false
}
}
};

Expand Down Expand Up @@ -100,6 +113,23 @@ export const numberFormats: I18nOptions["numberFormats"] = {
style: 'unit', unit: 'kilobyte',
},
},
[Locales.IT]: {
decimal: {
style: 'decimal',
},
decimalNoDigits: {
style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0
},
decimalTwoDigits: {
style: 'decimal', minimumFractionDigits: 2, maximumFractionDigits: 2
},
percent: {
style: 'percent',
},
kilobyte: {
style: 'unit', unit: 'kilobyte',
},
},
};

export const defaultLocale = Locales.EN;
export const defaultLocale = Locales.EN;
Loading