DE translations for Settings, Customizations and Help

This commit is contained in:
Proddy
2022-08-26 16:14:28 +02:00
parent e9c695f76a
commit 84499dab35
8 changed files with 761 additions and 111 deletions

View File

@@ -38,9 +38,11 @@ const de: Translation = {
SAVE: 'Speichern', SAVE: 'Speichern',
REMOVE: 'Entfernen', REMOVE: 'Entfernen',
PROBLEM_UPDATING: 'Problem beim Aktualisieren', PROBLEM_UPDATING: 'Problem beim Aktualisieren',
PROBLEM_LOADING: 'Problem beim Holen',
ACCESS_DENIED: 'Zugriff abgelehnt', ACCESS_DENIED: 'Zugriff abgelehnt',
ANALOG_SENSOR: 'Analoger Sensor{post}', ANALOG_SENSOR: 'Analoger Sensor{post}',
TEMP_SENSOR: 'Temperatursensor{post}', TEMP_SENSOR: 'Temperatursensor{post}',
TEMP_SENSORS: 'Temperatursensoren',
WRITE_COMMAND: 'Befehl schreiben {cmd}', WRITE_COMMAND: 'Befehl schreiben {cmd}',
EMS_BUS_WARNING: EMS_BUS_WARNING:
'EMS-Bus getrennt. Wenn diese Warnung nach einigen Sekunden immer noch besteht, überprüfen Sie bitte die Einstellungen und das Board-Profil', 'EMS-Bus getrennt. Wenn diese Warnung nach einigen Sekunden immer noch besteht, überprüfen Sie bitte die Einstellungen und das Board-Profil',
@@ -52,7 +54,7 @@ const de: Translation = {
EMS_SCAN: 'Möchten Sie wirklich einen vollständigen Gerätescan des EMS-Busses starten?', EMS_SCAN: 'Möchten Sie wirklich einen vollständigen Gerätescan des EMS-Busses starten?',
EMS_BUS_STATUS: 'EMS Bus Status', EMS_BUS_STATUS: 'EMS Bus Status',
ACTIVE_DEVICES: 'Aktive Geräte und Sensoren', ACTIVE_DEVICES: 'Aktive Geräte und Sensoren',
DEVICE: 'Device', DEVICE: 'Gerät',
SUCCESS: 'ERFOLG', SUCCESS: 'ERFOLG',
FAIL: 'SCHEITERN', FAIL: 'SCHEITERN',
QUALITY: 'QUALITÄT', QUALITY: 'QUALITÄT',
@@ -75,7 +77,72 @@ const de: Translation = {
NUM_DAYS: '{num} Tag{{en}}', NUM_DAYS: '{num} Tag{{en}}',
NUM_SECONDS: '{num} Sekund{{en}}', NUM_SECONDS: '{num} Sekund{{en}}',
NUM_HOURS: '{num} Stunde{{n}}', NUM_HOURS: '{num} Stunde{{n}}',
NUM_MINUTES: '{num} Minute{{en}}' NUM_MINUTES: '{num} Minute{{en}}',
APPLICATION_SETTINGS: 'Anwendungseinstellungen',
CUSTOMIZATION: 'Anpassung',
APPLICATION_RESTARTING: 'EMS-ESP startet neu',
BOARD_PROFILE_TEXT:
'Wählen Sie ein vorkonfiguriertes Schnittstellenkartenprofil aus der Liste unten aus oder wählen Sie Benutzerdefiniert, um Ihre eigenen Hardwareeinstellungen zu konfigurieren',
BOARD_PROFILE: 'Board Profil',
BUTTON: 'Druckknopf',
TEMPERATURE: 'Temperatur',
DISABLED: 'deaktiviert',
GENERAL_OPTIONS: 'Allgemeine Optionen',
LANGUAGE_ENTITIES: 'Sprache (für Geräteentitäten)',
HIDE_LED: 'ausblenden LED',
ENABLE_TELNET: 'Ermöglichen Telnet Console',
ENABLE_ANALOG: 'Ermöglichen Analogsensorsen',
CONVERT_FAHRENHEIT: 'Konvertieren Sie Temperaturwerte in Fahrenheit',
BYPASS_TOKEN: 'Zugriffstoken-Autorisierung bei API-Aufrufen umgehen',
READONLY: 'Nur-Lese-Modus aktivieren (blockiert alle ausgehenden EMS Tx Write-Befehle)',
UNDERCLOCK_CPU: 'CPU-Geschwindigkeit untertakten',
ENABLE_SHOWER_TIMER: 'Duschtimer aktivieren',
ENABLE_SHOWER_ALERT: 'Duschalarm aktivieren',
TRIGGER_TIME: 'Auslösezeit',
COLD_SHOT_DURATION: 'Kaltschussdauer',
FORMATTING_OPTIONS: 'Formatierungsoptionen',
BOOLEAN_FORMAT_DASHBOARD: 'Dashboard im booleschen Format',
BOOLEAN_FORMAT_API: 'Boolesches Format API/MQTT',
ENUM_FORMAT: 'Enum Format API/MQTT',
INDEX: 'Index',
ENABLE_PARASITE: 'Parasiten-Power aktivieren',
LOGGING: 'Protokollierung',
LOG_HEX: 'EMS-Telegramme hexadezimal protokollieren',
ENABLE_SYSLOG: 'Syslog aktivieren',
MARK_INTERVAL: 'Intervallmarke',
SECONDS: 'sekunden',
MINUTES: 'minuten',
RESTART: 'Neu starten',
RESTART_TEXT: 'muss neu gestartet werden, um geänderte Systemeinstellungen zu übernehmen',
COMMAND: 'Befehl',
CUSTOMIZATIONS_RESTART: 'Alle Anpassungen wurden entfernt. Neustart...',
CUSTOMIZATIONS_FULL: 'Ausgewählte Entitäten haben das Limit von 60 überschritten. Bitte stapelweise speichern',
CUSTOMIZATIONS_SAVED: 'Anpassungen gespeichert',
CUSTOMIZATIONS_HELP_1: 'Wählen Sie ein Gerät aus und passen Sie die Entitäten mithilfe der Optionen an',
CUSTOMIZATIONS_HELP_2: 'als Favorit markieren',
CUSTOMIZATIONS_HELP_3: 'Schreibaktion deaktivieren',
CUSTOMIZATIONS_HELP_4: 'von MQTT und API ausschließen',
CUSTOMIZATIONS_HELP_5: 'Aus dem Dashboard ausblenden',
SELECT_DEVICE: 'Wählen Sie ein Gerät aus',
SET_ALL: 'setzen Sie alle',
OPTIONS: 'Optionen',
NAME: 'Name',
CUSTOMIZATIONS_RESET:
'Möchten Sie wirklich alle Anpassungen entfernen, einschließlich der benutzerdefinierten Einstellungen der Temperatur- und Analogsensoren?',
DEVICE_ENTITIES: 'Geräteentitäten',
CONFIGURE: 'konfigurieren',
USER_CUSTOMIZATION: 'Benutzeranpassung',
SUPPORT_INFORMATION: 'Unterstützende Informationen',
HELP_INFORMATION_1: 'Besuchen Sie das Online',
HELP_INFORMATION_2: 'um Anweisungen zu erhalten, wie es geht',
HELP_INFORMATION_3: 'und auf andere Informationen zugreifen',
HELP_INFORMATION_4: 'Für einen Live-Community-Chat treten Sie unserem bei',
HELP_INFORMATION_5: 'Sende ein',
HELP_INFORMATION_6: 'Support-Problem',
HELP_INFORMATION_7: 'um eine neue Funktion anzufordern oder einen Fehler zu melden',
HELP_INFORMATION_8: 'Überzeugen Sie sich auch',
HELP_INFORMATION_9: 'und hängen Sie Ihre Systemdetails für eine schnellere Antwort an',
HELP_INFORMATION_10: 'EMS-ESP wird immer ein kostenloses Open-Source-Projekt sein. Bitte erwägen Sie, es mit einem '
}; };
export default de; export default de;

View File

@@ -38,9 +38,11 @@ const en: BaseTranslation = {
SAVE: 'Save', SAVE: 'Save',
REMOVE: 'Remove', REMOVE: 'Remove',
PROBLEM_UPDATING: 'Problem updating', PROBLEM_UPDATING: 'Problem updating',
PROBLEM_LOADING: 'Problem loading',
ACCESS_DENIED: 'Access Denied', ACCESS_DENIED: 'Access Denied',
ANALOG_SENSOR: 'Analog Sensor{post}', ANALOG_SENSOR: 'Analog Sensor{post}',
TEMP_SENSOR: 'Temperature Sensor{post}', TEMP_SENSOR: 'Temperature Sensor{post}',
TEMP_SENSORS: 'Temperature Sensors',
WRITE_COMMAND: 'Write command {cmd}', WRITE_COMMAND: 'Write command {cmd}',
EMS_BUS_WARNING: EMS_BUS_WARNING:
'EMS bus disconnected. If this warning still persists after a few seconds please check settings and board profile', 'EMS bus disconnected. If this warning still persists after a few seconds please check settings and board profile',
@@ -75,7 +77,72 @@ const en: BaseTranslation = {
NUM_DAYS: '{num} Day{{s}}', NUM_DAYS: '{num} Day{{s}}',
NUM_SECONDS: '{num} Second{{s}}', NUM_SECONDS: '{num} Second{{s}}',
NUM_HOURS: '{num} Hour{{s}}', NUM_HOURS: '{num} Hour{{s}}',
NUM_MINUTES: '{num} Minute{{s}}' NUM_MINUTES: '{num} Minute{{s}}',
APPLICATION_SETTINGS: 'Application Settings',
CUSTOMIZATION: 'Customization',
APPLICATION_RESTARTING: 'EMS-ESP is restarting',
BOARD_PROFILE_TEXT:
'Select a pre-configured interface board profile from the list below or choose Custom to configure your own hardware settings',
BOARD_PROFILE: 'Board Profile',
BUTTON: 'Button',
TEMPERATURE: 'Temperature',
DISABLED: 'disabled',
GENERAL_OPTIONS: 'General Options',
LANGUAGE_ENTITIES: 'Language (for device entities)',
HIDE_LED: 'Hide LED',
ENABLE_TELNET: 'Enable Telnet Console',
ENABLE_ANALOG: 'Enable Analog Sensors',
CONVERT_FAHRENHEIT: 'Convert temperature values to Fahrenheit',
BYPASS_TOKEN: 'Bypass Access Token authorization on API calls',
READONLY: 'Enable read-only mode (blocks all outgoing EMS Tx Write commands)',
UNDERCLOCK_CPU: 'Underclock CPU speed',
ENABLE_SHOWER_TIMER: 'Enable Shower Timer',
ENABLE_SHOWER_ALERT: 'Enable Shower Alert',
TRIGGER_TIME: 'Trigger Time',
COLD_SHOT_DURATION: 'Cold Shot Duration',
FORMATTING_OPTIONS: 'Formatting Options',
BOOLEAN_FORMAT_DASHBOARD: 'Boolean Format Dashboard',
BOOLEAN_FORMAT_API: 'Boolean Format API/MQTT',
ENUM_FORMAT: 'Enum Format API/MQTT',
INDEX: 'Index',
ENABLE_PARASITE: 'Enable parasite power',
LOGGING: 'Logging',
LOG_HEX: 'Log EMS telegrams in hexadecimal',
ENABLE_SYSLOG: 'Enable Syslog',
MARK_INTERVAL: 'Mark Interval',
SECONDS: 'seconds',
MINUTES: 'minutes',
RESTART: 'Restart',
RESTART_TEXT: 'EMS-ESP needs to be restarted to apply changed system settings',
COMMAND: 'Command',
CUSTOMIZATIONS_RESTART: 'All customizations have been removed. Restarting...',
CUSTOMIZATIONS_FULL: 'Selected entities exceeded limit of 60. Please Save in batches',
CUSTOMIZATIONS_SAVED: 'Customizations saved',
CUSTOMIZATIONS_HELP_1: 'Select a device and customize the entities using the options',
CUSTOMIZATIONS_HELP_2: 'mark as favorite',
CUSTOMIZATIONS_HELP_3: 'disable write action',
CUSTOMIZATIONS_HELP_4: 'exclude from MQTT and API',
CUSTOMIZATIONS_HELP_5: 'hide from Dashboard',
SELECT_DEVICE: 'Select a device',
SET_ALL: 'set all',
OPTIONS: 'Options',
NAME: 'Name',
CUSTOMIZATIONS_RESET:
'Are you sure you want remove all customizations including the custom settings of the Temperature and Analog sensors?',
DEVICE_ENTITIES: 'Device Entities',
CONFIGURE: 'configure',
USER_CUSTOMIZATION: 'User Customization',
SUPPORT_INFORMATION: 'Support Information',
HELP_INFORMATION_1: 'Visit the online',
HELP_INFORMATION_2: 'to get instructions on how to',
HELP_INFORMATION_3: 'and access other information',
HELP_INFORMATION_4: 'For live community chat join our',
HELP_INFORMATION_5: 'Submit a',
HELP_INFORMATION_6: 'support issue',
HELP_INFORMATION_7: 'for requesting a new feature or reporting a bug',
HELP_INFORMATION_8: 'Make sure you also',
HELP_INFORMATION_9: 'and attach your system details for a faster response',
HELP_INFORMATION_10: 'EMS-ESP will always be a free and open-source project. Please consider supporting it with a '
}; };
export default en; export default en;

View File

@@ -163,6 +163,10 @@ type RootTranslation = {
* Problem updating * Problem updating
*/ */
PROBLEM_UPDATING: string PROBLEM_UPDATING: string
/**
* Problem loading
*/
PROBLEM_LOADING: string
/** /**
* Access Denied * Access Denied
*/ */
@@ -177,6 +181,10 @@ type RootTranslation = {
* @param {unknown} post * @param {unknown} post
*/ */
TEMP_SENSOR: RequiredParams<'post'> TEMP_SENSOR: RequiredParams<'post'>
/**
* Temperature Sensors
*/
TEMP_SENSORS: string
/** /**
* Write command {cmd} * Write command {cmd}
* @param {unknown} cmd * @param {unknown} cmd
@@ -315,6 +323,258 @@ type RootTranslation = {
* @param {string | number | boolean} num * @param {string | number | boolean} num
*/ */
NUM_MINUTES: RequiredParams<'num'> NUM_MINUTES: RequiredParams<'num'>
/**
* Application Settings
*/
APPLICATION_SETTINGS: string
/**
* Customization
*/
CUSTOMIZATION: string
/**
* EMS-ESP is restarting
*/
APPLICATION_RESTARTING: string
/**
* Select a pre-configured interface board profile from the list below or choose Custom to configure your own hardware settings
*/
BOARD_PROFILE_TEXT: string
/**
* Board Profile
*/
BOARD_PROFILE: string
/**
* Button
*/
BUTTON: string
/**
* Temperature
*/
TEMPERATURE: string
/**
* disabled
*/
DISABLED: string
/**
* General Options
*/
GENERAL_OPTIONS: string
/**
* Language (for device entities)
*/
LANGUAGE_ENTITIES: string
/**
* Hide LED
*/
HIDE_LED: string
/**
* Enable Telnet Console
*/
ENABLE_TELNET: string
/**
* Enable Analog Sensors
*/
ENABLE_ANALOG: string
/**
* Convert temperature values to Fahrenheit
*/
CONVERT_FAHRENHEIT: string
/**
* Bypass Access Token authorization on API calls
*/
BYPASS_TOKEN: string
/**
* Enable read-only mode (blocks all outgoing EMS Tx Write commands)
*/
READONLY: string
/**
* Underclock CPU speed
*/
UNDERCLOCK_CPU: string
/**
* Enable Shower Timer
*/
ENABLE_SHOWER_TIMER: string
/**
* Enable Shower Alert
*/
ENABLE_SHOWER_ALERT: string
/**
* Trigger Time
*/
TRIGGER_TIME: string
/**
* Cold Shot Duration
*/
COLD_SHOT_DURATION: string
/**
* Formatting Options
*/
FORMATTING_OPTIONS: string
/**
* Boolean Format Dashboard
*/
BOOLEAN_FORMAT_DASHBOARD: string
/**
* Boolean Format API/MQTT
*/
BOOLEAN_FORMAT_API: string
/**
* Enum Format API/MQTT
*/
ENUM_FORMAT: string
/**
* Index
*/
INDEX: string
/**
* Enable parasite power
*/
ENABLE_PARASITE: string
/**
* Logging
*/
LOGGING: string
/**
* Log EMS telegrams in hexadecimal
*/
LOG_HEX: string
/**
* Enable Syslog
*/
ENABLE_SYSLOG: string
/**
* Mark Interval
*/
MARK_INTERVAL: string
/**
* seconds
*/
SECONDS: string
/**
* minutes
*/
MINUTES: string
/**
* Restart
*/
RESTART: string
/**
* EMS-ESP needs to be restarted to apply changed system settings
*/
RESTART_TEXT: string
/**
* Command
*/
COMMAND: string
/**
* All customizations have been removed. Restarting...
*/
CUSTOMIZATIONS_RESTART: string
/**
* Selected entities exceeded limit of 60. Please Save in batches
*/
CUSTOMIZATIONS_FULL: string
/**
* Customizations saved
*/
CUSTOMIZATIONS_SAVED: string
/**
* Select a device and customize the entities using the options
*/
CUSTOMIZATIONS_HELP_1: string
/**
* mark as favorite
*/
CUSTOMIZATIONS_HELP_2: string
/**
* disable write action
*/
CUSTOMIZATIONS_HELP_3: string
/**
* exclude from MQTT and API
*/
CUSTOMIZATIONS_HELP_4: string
/**
* hide from Dashboard
*/
CUSTOMIZATIONS_HELP_5: string
/**
* Select a device
*/
SELECT_DEVICE: string
/**
* set all
*/
SET_ALL: string
/**
* Options
*/
OPTIONS: string
/**
* Name
*/
NAME: string
/**
* Are you sure you want remove all customizations including the custom settings of the Temperature and Analog sensors?
*/
CUSTOMIZATIONS_RESET: string
/**
* Device Entities
*/
DEVICE_ENTITIES: string
/**
* configure
*/
CONFIGURE: string
/**
* User Customization
*/
USER_CUSTOMIZATION: string
/**
* Support Information
*/
SUPPORT_INFORMATION: string
/**
* Visit the online
*/
HELP_INFORMATION_1: string
/**
* to get instructions on how to
*/
HELP_INFORMATION_2: string
/**
* and access other information
*/
HELP_INFORMATION_3: string
/**
* For live community chat join our
*/
HELP_INFORMATION_4: string
/**
* Submit a
*/
HELP_INFORMATION_5: string
/**
* support issue
*/
HELP_INFORMATION_6: string
/**
* for requesting a new feature or reporting a bug
*/
HELP_INFORMATION_7: string
/**
* Make sure you also
*/
HELP_INFORMATION_8: string
/**
* and attach your system details for a faster response
*/
HELP_INFORMATION_9: string
/**
* EMS-ESP will always be a free and open-source project. Please consider supporting it with a
*/
HELP_INFORMATION_10: string
} }
export type TranslationFunctions = { export type TranslationFunctions = {
@@ -466,6 +726,10 @@ export type TranslationFunctions = {
* Problem updating * Problem updating
*/ */
PROBLEM_UPDATING: () => LocalizedString PROBLEM_UPDATING: () => LocalizedString
/**
* Problem loading
*/
PROBLEM_LOADING: () => LocalizedString
/** /**
* Access Denied * Access Denied
*/ */
@@ -478,6 +742,10 @@ export type TranslationFunctions = {
* Temperature Sensor{post} * Temperature Sensor{post}
*/ */
TEMP_SENSOR: (arg: { post: unknown }) => LocalizedString TEMP_SENSOR: (arg: { post: unknown }) => LocalizedString
/**
* Temperature Sensors
*/
TEMP_SENSORS: () => LocalizedString
/** /**
* Write command {cmd} * Write command {cmd}
*/ */
@@ -608,6 +876,258 @@ export type TranslationFunctions = {
* {num} Minute{{s}} * {num} Minute{{s}}
*/ */
NUM_MINUTES: (arg: { num: string | number | boolean }) => LocalizedString NUM_MINUTES: (arg: { num: string | number | boolean }) => LocalizedString
/**
* Application Settings
*/
APPLICATION_SETTINGS: () => LocalizedString
/**
* Customization
*/
CUSTOMIZATION: () => LocalizedString
/**
* EMS-ESP is restarting
*/
APPLICATION_RESTARTING: () => LocalizedString
/**
* Select a pre-configured interface board profile from the list below or choose Custom to configure your own hardware settings
*/
BOARD_PROFILE_TEXT: () => LocalizedString
/**
* Board Profile
*/
BOARD_PROFILE: () => LocalizedString
/**
* Button
*/
BUTTON: () => LocalizedString
/**
* Temperature
*/
TEMPERATURE: () => LocalizedString
/**
* disabled
*/
DISABLED: () => LocalizedString
/**
* General Options
*/
GENERAL_OPTIONS: () => LocalizedString
/**
* Language (for device entities)
*/
LANGUAGE_ENTITIES: () => LocalizedString
/**
* Hide LED
*/
HIDE_LED: () => LocalizedString
/**
* Enable Telnet Console
*/
ENABLE_TELNET: () => LocalizedString
/**
* Enable Analog Sensors
*/
ENABLE_ANALOG: () => LocalizedString
/**
* Convert temperature values to Fahrenheit
*/
CONVERT_FAHRENHEIT: () => LocalizedString
/**
* Bypass Access Token authorization on API calls
*/
BYPASS_TOKEN: () => LocalizedString
/**
* Enable read-only mode (blocks all outgoing EMS Tx Write commands)
*/
READONLY: () => LocalizedString
/**
* Underclock CPU speed
*/
UNDERCLOCK_CPU: () => LocalizedString
/**
* Enable Shower Timer
*/
ENABLE_SHOWER_TIMER: () => LocalizedString
/**
* Enable Shower Alert
*/
ENABLE_SHOWER_ALERT: () => LocalizedString
/**
* Trigger Time
*/
TRIGGER_TIME: () => LocalizedString
/**
* Cold Shot Duration
*/
COLD_SHOT_DURATION: () => LocalizedString
/**
* Formatting Options
*/
FORMATTING_OPTIONS: () => LocalizedString
/**
* Boolean Format Dashboard
*/
BOOLEAN_FORMAT_DASHBOARD: () => LocalizedString
/**
* Boolean Format API/MQTT
*/
BOOLEAN_FORMAT_API: () => LocalizedString
/**
* Enum Format API/MQTT
*/
ENUM_FORMAT: () => LocalizedString
/**
* Index
*/
INDEX: () => LocalizedString
/**
* Enable parasite power
*/
ENABLE_PARASITE: () => LocalizedString
/**
* Logging
*/
LOGGING: () => LocalizedString
/**
* Log EMS telegrams in hexadecimal
*/
LOG_HEX: () => LocalizedString
/**
* Enable Syslog
*/
ENABLE_SYSLOG: () => LocalizedString
/**
* Mark Interval
*/
MARK_INTERVAL: () => LocalizedString
/**
* seconds
*/
SECONDS: () => LocalizedString
/**
* minutes
*/
MINUTES: () => LocalizedString
/**
* Restart
*/
RESTART: () => LocalizedString
/**
* EMS-ESP needs to be restarted to apply changed system settings
*/
RESTART_TEXT: () => LocalizedString
/**
* Command
*/
COMMAND: () => LocalizedString
/**
* All customizations have been removed. Restarting...
*/
CUSTOMIZATIONS_RESTART: () => LocalizedString
/**
* Selected entities exceeded limit of 60. Please Save in batches
*/
CUSTOMIZATIONS_FULL: () => LocalizedString
/**
* Customizations saved
*/
CUSTOMIZATIONS_SAVED: () => LocalizedString
/**
* Select a device and customize the entities using the options
*/
CUSTOMIZATIONS_HELP_1: () => LocalizedString
/**
* mark as favorite
*/
CUSTOMIZATIONS_HELP_2: () => LocalizedString
/**
* disable write action
*/
CUSTOMIZATIONS_HELP_3: () => LocalizedString
/**
* exclude from MQTT and API
*/
CUSTOMIZATIONS_HELP_4: () => LocalizedString
/**
* hide from Dashboard
*/
CUSTOMIZATIONS_HELP_5: () => LocalizedString
/**
* Select a device
*/
SELECT_DEVICE: () => LocalizedString
/**
* set all
*/
SET_ALL: () => LocalizedString
/**
* Options
*/
OPTIONS: () => LocalizedString
/**
* Name
*/
NAME: () => LocalizedString
/**
* Are you sure you want remove all customizations including the custom settings of the Temperature and Analog sensors?
*/
CUSTOMIZATIONS_RESET: () => LocalizedString
/**
* Device Entities
*/
DEVICE_ENTITIES: () => LocalizedString
/**
* configure
*/
CONFIGURE: () => LocalizedString
/**
* User Customization
*/
USER_CUSTOMIZATION: () => LocalizedString
/**
* Support Information
*/
SUPPORT_INFORMATION: () => LocalizedString
/**
* Visit the online
*/
HELP_INFORMATION_1: () => LocalizedString
/**
* to get instructions on how to
*/
HELP_INFORMATION_2: () => LocalizedString
/**
* and access other information
*/
HELP_INFORMATION_3: () => LocalizedString
/**
* For live community chat join our
*/
HELP_INFORMATION_4: () => LocalizedString
/**
* Submit a
*/
HELP_INFORMATION_5: () => LocalizedString
/**
* support issue
*/
HELP_INFORMATION_6: () => LocalizedString
/**
* for requesting a new feature or reporting a bug
*/
HELP_INFORMATION_7: () => LocalizedString
/**
* Make sure you also
*/
HELP_INFORMATION_8: () => LocalizedString
/**
* and attach your system details for a faster response
*/
HELP_INFORMATION_9: () => LocalizedString
/**
* EMS-ESP will always be a free and open-source project. Please consider supporting it with a
*/
HELP_INFORMATION_10: () => LocalizedString
} }
export type Formatters = {} export type Formatters = {}

View File

@@ -18,7 +18,7 @@ const Help: FC = () => {
return ( return (
<> <>
<RouterTabs value={routerTab}> <RouterTabs value={routerTab}>
<Tab value="information" label="EMS-ESP Help" /> <Tab value="information" label={"EMS-ESP " + LL.HELP()} />
</RouterTabs> </RouterTabs>
<Routes> <Routes>
<Route path="information" element={<HelpInformation />} /> <Route path="information" element={<HelpInformation />} />

View File

@@ -14,9 +14,13 @@ import DownloadIcon from '@mui/icons-material/GetApp';
import { extractErrorMessage } from '../utils'; import { extractErrorMessage } from '../utils';
import { useI18nContext } from '../i18n/i18n-react';
import * as EMSESP from './api'; import * as EMSESP from './api';
const HelpInformation: FC = () => { const HelpInformation: FC = () => {
const { LL } = useI18nContext();
const { enqueueSnackbar } = useSnackbar(); const { enqueueSnackbar } = useSnackbar();
const saveFile = (json: any, endpoint: string) => { const saveFile = (json: any, endpoint: string) => {
@@ -47,40 +51,40 @@ const HelpInformation: FC = () => {
saveFile(response.data, endpoint); saveFile(response.data, endpoint);
} }
} catch (error: unknown) { } catch (error: unknown) {
enqueueSnackbar(extractErrorMessage(error, 'Problem with downloading'), { variant: 'error' }); enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_LOADING()), { variant: 'error' });
} }
}; };
return ( return (
<SectionContent title="Support Information" titleGutter> <SectionContent title={LL.SUPPORT_INFORMATION()} titleGutter>
<List> <List>
<ListItem> <ListItem>
<ListItemAvatar> <ListItemAvatar>
<MenuBookIcon /> <MenuBookIcon style={{ fontSize: 24, color: 'lightblue', verticalAlign: 'middle' }} />
</ListItemAvatar> </ListItemAvatar>
<ListItemText> <ListItemText>
Visit the online&nbsp; {LL.HELP_INFORMATION_1()}&nbsp;
<Link target="_blank" href="https://emsesp.github.io/docs" color="primary"> <Link target="_blank" href="https://emsesp.github.io/docs" color="primary">
{'Wiki'} {'Wiki'}
</Link> </Link>
&nbsp;to get instructions on how to&nbsp; &nbsp;{LL.HELP_INFORMATION_2()}&nbsp;
<Link <Link
target="_blank" target="_blank"
href="https://emsesp.github.io/docs/#/Configure-firmware?id=ems-esp-settings" href="https://emsesp.github.io/docs/#/Configure-firmware?id=ems-esp-settings"
color="primary" color="primary"
> >
{'configure'} {LL.CONFIGURE()}
</Link> </Link>
&nbsp;EMS-ESP and access other information. {' EMS-ESP ' + LL.HELP_INFORMATION_3() + '.'}
</ListItemText> </ListItemText>
</ListItem> </ListItem>
<ListItem> <ListItem>
<ListItemAvatar> <ListItemAvatar>
<CommentIcon /> <CommentIcon style={{ fontSize: 24, color: 'lightblue', verticalAlign: 'middle' }} />
</ListItemAvatar> </ListItemAvatar>
<ListItemText> <ListItemText>
For live community chat join our&nbsp; {LL.HELP_INFORMATION_4()}&nbsp;
<Link target="_blank" href="https://discord.gg/3J3GgnzpyT" color="primary"> <Link target="_blank" href="https://discord.gg/3J3GgnzpyT" color="primary">
{'Discord'} {'Discord'}
</Link> </Link>
@@ -90,33 +94,31 @@ const HelpInformation: FC = () => {
<ListItem> <ListItem>
<ListItemAvatar> <ListItemAvatar>
<GitHubIcon /> <GitHubIcon style={{ fontSize: 24, color: 'lightblue', verticalAlign: 'middle' }} />
</ListItemAvatar> </ListItemAvatar>
<ListItemText> <ListItemText>
Submit a&nbsp; {LL.HELP_INFORMATION_5()}&nbsp;
<Link target="_blank" href="https://github.com/emsesp/EMS-ESP32/issues/new/choose" color="primary"> <Link target="_blank" href="https://github.com/emsesp/EMS-ESP32/issues/new/choose" color="primary">
support issue {LL.HELP_INFORMATION_6()}
</Link> </Link>
&nbsp;for requesting a new feature or reporting a bug. &nbsp;{LL.HELP_INFORMATION_7()}.
<br /> <br />
Make sure you also&nbsp; {LL.HELP_INFORMATION_8()}&nbsp;
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={() => callAPI('info')}> <Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={() => callAPI('info')}>
download download
</Button> </Button>
&nbsp; and attach your system details for a faster response. &nbsp;&nbsp;{LL.HELP_INFORMATION_9()}.
</ListItemText> </ListItemText>
</ListItem> </ListItem>
</List> </List>
<Box border={1} p={1} mt={4}> <Box border={1} p={1} mt={4}>
<Typography align="center" variant="h6" color="orange"> <Typography align="center" variant="h6" color="orange">
EMS-ESP will always be a free and open-source project {LL.HELP_INFORMATION_10()}
<br></br>Please consider supporting it with a&nbsp;
<StarIcon style={{ fontSize: 16, color: 'yellow', verticalAlign: 'middle' }} /> on&nbsp;
<Link href="https://github.com/emsesp/EMS-ESP32" color="primary"> <Link href="https://github.com/emsesp/EMS-ESP32" color="primary">
{'GitHub'} {'GitHub'}
</Link> </Link>
<StarIcon style={{ fontSize: 20, color: 'yellow', verticalAlign: 'middle' }} />
</Typography> </Typography>
<Typography align="center">@proddy @MichaelDvP</Typography> <Typography align="center">@proddy @MichaelDvP</Typography>
</Box> </Box>

View File

@@ -19,8 +19,8 @@ const Settings: FC = () => {
return ( return (
<> <>
<RouterTabs value={routerTab}> <RouterTabs value={routerTab}>
<Tab value="application" label="Application Settings" /> <Tab value="application" label={LL.APPLICATION_SETTINGS()} />
<Tab value="customization" label="Customization" /> <Tab value="customization" label={LL.CUSTOMIZATION()} />
</RouterTabs> </RouterTabs>
<Routes> <Routes>
<Route path="application" element={<SettingsApplication />} /> <Route path="application" element={<SettingsApplication />} />

View File

@@ -69,7 +69,7 @@ const SettingsApplication: FC = () => {
}); });
} }
} catch (error: unknown) { } catch (error: unknown) {
enqueueSnackbar(extractErrorMessage(error, 'Problem fetching board profile'), { variant: 'error' }); enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_UPDATING()), { variant: 'error' });
} finally { } finally {
setProcessingBoard(false); setProcessingBoard(false);
} }
@@ -106,26 +106,23 @@ const SettingsApplication: FC = () => {
validateAndSubmit(); validateAndSubmit();
try { try {
await EMSESP.restart(); await EMSESP.restart();
enqueueSnackbar('EMS-ESP is restarting...', { variant: 'info' }); enqueueSnackbar(LL.APPLICATION_RESTARTING(), { variant: 'info' });
} catch (error: unknown) { } catch (error: unknown) {
enqueueSnackbar(extractErrorMessage(error, 'Problem restarting device'), { variant: 'error' }); enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_UPDATING()), { variant: 'error' });
} }
}; };
return ( return (
<> <>
<Typography sx={{ pt: 2 }} variant="h6" color="primary"> <Typography sx={{ pt: 2 }} variant="h6" color="primary">
Interface Board Profile Interface {LL.BOARD_PROFILE()}
</Typography> </Typography>
<Box color="warning.main"> <Box color="warning.main">
<Typography variant="body2"> <Typography variant="body2">{LL.BOARD_PROFILE_TEXT()}</Typography>
Select a pre-configured interface board profile from the list below or choose "Custom" to configure your own
hardware settings
</Typography>
</Box> </Box>
<ValidatedTextField <ValidatedTextField
name="board_profile" name="board_profile"
label="Board Profile" label={LL.BOARD_PROFILE()}
value={data.board_profile} value={data.board_profile}
disabled={processingBoard} disabled={processingBoard}
variant="outlined" variant="outlined"
@@ -174,7 +171,7 @@ const SettingsApplication: FC = () => {
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="pbutton_gpio" name="pbutton_gpio"
label="Button GPIO" label={LL.BUTTON() + ' GPIO'}
fullWidth fullWidth
variant="outlined" variant="outlined"
value={numberValue(data.pbutton_gpio)} value={numberValue(data.pbutton_gpio)}
@@ -188,7 +185,7 @@ const SettingsApplication: FC = () => {
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="dallas_gpio" name="dallas_gpio"
label="Temperature GPIO (0=disabled)" label={LL.TEMPERATURE() + ' GPIO (0=' + LL.DISABLED() + ')'}
fullWidth fullWidth
variant="outlined" variant="outlined"
value={numberValue(data.dallas_gpio)} value={numberValue(data.dallas_gpio)}
@@ -202,7 +199,7 @@ const SettingsApplication: FC = () => {
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="led_gpio" name="led_gpio"
label="LED GPIO (0=disabled)" label={'LED GPIO (0=' + LL.DISABLED() + ')'}
fullWidth fullWidth
variant="outlined" variant="outlined"
value={numberValue(data.led_gpio)} value={numberValue(data.led_gpio)}
@@ -225,7 +222,7 @@ const SettingsApplication: FC = () => {
margin="normal" margin="normal"
select select
> >
<MenuItem value={0}>No Ethernet Module</MenuItem> <MenuItem value={0}>{LL.DISABLED()}</MenuItem>
<MenuItem value={1}>LAN8720</MenuItem> <MenuItem value={1}>LAN8720</MenuItem>
<MenuItem value={2}>TLK110</MenuItem> <MenuItem value={2}>TLK110</MenuItem>
</ValidatedTextField> </ValidatedTextField>
@@ -235,7 +232,7 @@ const SettingsApplication: FC = () => {
<Grid item> <Grid item>
<ValidatedTextField <ValidatedTextField
name="eth_power" name="eth_power"
label="Eth Power GPIO (-1=disabled)" label={'Eth Power GPIO (-1=' + LL.DISABLED() + ')'}
fullWidth fullWidth
variant="outlined" variant="outlined"
value={numberValue(data.eth_power)} value={numberValue(data.eth_power)}
@@ -281,7 +278,7 @@ const SettingsApplication: FC = () => {
</> </>
)} )}
<Typography variant="h6" color="primary"> <Typography variant="h6" color="primary">
EMS Bus Settings EMS Bus {LL.SETTINGS()}
</Typography> </Typography>
<Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start"> <Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start">
<Grid item xs={6}> <Grid item xs={6}>
@@ -323,7 +320,7 @@ const SettingsApplication: FC = () => {
</Grid> </Grid>
</Grid> </Grid>
<Typography sx={{ pt: 2 }} variant="h6" color="primary"> <Typography sx={{ pt: 2 }} variant="h6" color="primary">
General Options {LL.GENERAL_OPTIONS()}
</Typography> </Typography>
<Box <Box
sx={{ sx={{
@@ -332,7 +329,7 @@ const SettingsApplication: FC = () => {
> >
<ValidatedTextField <ValidatedTextField
name="locale" name="locale"
label="Language (for device entities)" label={LL.LANGUAGE_ENTITIES()}
disabled={saving} disabled={saving}
value={data.locale} value={data.locale}
variant="outlined" variant="outlined"
@@ -341,56 +338,56 @@ const SettingsApplication: FC = () => {
size="small" size="small"
select select
> >
<MenuItem value="en">English</MenuItem> <MenuItem value="en">English (en)</MenuItem>
<MenuItem value="de">Deutsch</MenuItem> <MenuItem value="de">Deutsch (de)</MenuItem>
</ValidatedTextField> </ValidatedTextField>
</Box> </Box>
{data.led_gpio !== 0 && ( {data.led_gpio !== 0 && (
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.hide_led} onChange={updateFormValue} name="hide_led" />} control={<Checkbox checked={data.hide_led} onChange={updateFormValue} name="hide_led" />}
label="Hide LED" label={LL.HIDE_LED()}
disabled={saving} disabled={saving}
/> />
)} )}
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.telnet_enabled} onChange={updateFormValue} name="telnet_enabled" />} control={<Checkbox checked={data.telnet_enabled} onChange={updateFormValue} name="telnet_enabled" />}
label="Enable Telnet Console" label={LL.ENABLE_TELNET()}
disabled={saving} disabled={saving}
/> />
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.analog_enabled} onChange={updateFormValue} name="analog_enabled" />} control={<Checkbox checked={data.analog_enabled} onChange={updateFormValue} name="analog_enabled" />}
label="Enable Analog Sensors" label={LL.ENABLE_ANALOG()}
disabled={saving} disabled={saving}
/> />
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.fahrenheit} onChange={updateFormValue} name="fahrenheit" />} control={<Checkbox checked={data.fahrenheit} onChange={updateFormValue} name="fahrenheit" />}
label="Convert temperature values to Fahrenheit" label={LL.CONVERT_FAHRENHEIT()}
disabled={saving} disabled={saving}
/> />
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.notoken_api} onChange={updateFormValue} name="notoken_api" />} control={<Checkbox checked={data.notoken_api} onChange={updateFormValue} name="notoken_api" />}
label="Bypass Access Token authorization on API calls" label={LL.BYPASS_TOKEN()}
disabled={saving} disabled={saving}
/> />
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.readonly_mode} onChange={updateFormValue} name="readonly_mode" />} control={<Checkbox checked={data.readonly_mode} onChange={updateFormValue} name="readonly_mode" />}
label="Enable read-only mode (blocks all outgoing EMS Tx Write commands)" label={LL.READONLY()}
disabled={saving} disabled={saving}
/> />
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.low_clock} onChange={updateFormValue} name="low_clock" />} control={<Checkbox checked={data.low_clock} onChange={updateFormValue} name="low_clock" />}
label="Underclock CPU speed" label={LL.UNDERCLOCK_CPU()}
disabled={saving} disabled={saving}
/> />
<Grid container spacing={0} direction="row" justifyContent="flex-start" alignItems="flex-start"> <Grid container spacing={0} direction="row" justifyContent="flex-start" alignItems="flex-start">
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.shower_timer} onChange={updateFormValue} name="shower_timer" />} control={<Checkbox checked={data.shower_timer} onChange={updateFormValue} name="shower_timer" />}
label="Enable Shower Timer" label={LL.ENABLE_SHOWER_TIMER()}
disabled={saving} disabled={saving}
/> />
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.shower_alert} onChange={updateFormValue} name="shower_alert" />} control={<Checkbox checked={data.shower_alert} onChange={updateFormValue} name="shower_alert" />}
label="Enable Shower Alert" label={LL.ENABLE_SHOWER_ALERT()}
disabled={!data.shower_timer} disabled={!data.shower_timer}
/> />
{data.shower_alert && ( {data.shower_alert && (
@@ -399,9 +396,9 @@ const SettingsApplication: FC = () => {
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="shower_alert_trigger" name="shower_alert_trigger"
label="Trigger Time" label={LL.TRIGGER_TIME()}
InputProps={{ InputProps={{
endAdornment: <InputAdornment position="end">minutes</InputAdornment> endAdornment: <InputAdornment position="end">{LL.MINUTES()}</InputAdornment>
}} }}
variant="outlined" variant="outlined"
value={data.shower_alert_trigger} value={data.shower_alert_trigger}
@@ -414,9 +411,9 @@ const SettingsApplication: FC = () => {
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="shower_alert_coldshot" name="shower_alert_coldshot"
label="Cold Shot Duration" label={LL.COLD_SHOT_DURATION()}
InputProps={{ InputProps={{
endAdornment: <InputAdornment position="end">seconds</InputAdornment> endAdornment: <InputAdornment position="end">{LL.SECONDS()}</InputAdornment>
}} }}
variant="outlined" variant="outlined"
value={data.shower_alert_coldshot} value={data.shower_alert_coldshot}
@@ -429,13 +426,13 @@ const SettingsApplication: FC = () => {
)} )}
</Grid> </Grid>
<Typography sx={{ pt: 2 }} variant="h6" color="primary"> <Typography sx={{ pt: 2 }} variant="h6" color="primary">
Formatting Options {LL.FORMATTING_OPTIONS()}
</Typography> </Typography>
<Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start"> <Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start">
<Grid item xs={4}> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="bool_dashboard" name="bool_dashboard"
label="Boolean Format Dashboard" label={LL.BOOLEAN_FORMAT_DASHBOARD()}
value={data.bool_dashboard} value={data.bool_dashboard}
fullWidth fullWidth
variant="outlined" variant="outlined"
@@ -452,7 +449,7 @@ const SettingsApplication: FC = () => {
<Grid item xs={4}> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="bool_format" name="bool_format"
label="Boolean Format API/MQTT" label={LL.BOOLEAN_FORMAT_API()}
value={data.bool_format} value={data.bool_format}
fullWidth fullWidth
variant="outlined" variant="outlined"
@@ -471,7 +468,7 @@ const SettingsApplication: FC = () => {
<Grid item xs={4}> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="enum_format" name="enum_format"
label="Enum Format API/MQTT" label={LL.ENUM_FORMAT()}
value={data.enum_format} value={data.enum_format}
fullWidth fullWidth
variant="outlined" variant="outlined"
@@ -479,29 +476,29 @@ const SettingsApplication: FC = () => {
margin="normal" margin="normal"
select select
> >
<MenuItem value={1}>Value</MenuItem> <MenuItem value={1}>{LL.VALUE()}</MenuItem>
<MenuItem value={2}>Index</MenuItem> <MenuItem value={2}>{LL.INDEX()}</MenuItem>
</ValidatedTextField> </ValidatedTextField>
</Grid> </Grid>
</Grid> </Grid>
{data.dallas_gpio !== 0 && ( {data.dallas_gpio !== 0 && (
<> <>
<Typography sx={{ pt: 2 }} variant="h6" color="primary"> <Typography sx={{ pt: 2 }} variant="h6" color="primary">
Temperature Sensors {LL.TEMP_SENSORS()}
</Typography> </Typography>
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.dallas_parasite} onChange={updateFormValue} name="dallas_parasite" />} control={<Checkbox checked={data.dallas_parasite} onChange={updateFormValue} name="dallas_parasite" />}
label="Enable parasite power" label={LL.ENABLE_PARASITE()}
disabled={saving} disabled={saving}
/> />
</> </>
)} )}
<Typography sx={{ pt: 2 }} variant="h6" color="primary"> <Typography sx={{ pt: 2 }} variant="h6" color="primary">
Logging {LL.LOGGING()}
</Typography> </Typography>
<BlockFormControlLabel <BlockFormControlLabel
control={<Checkbox checked={data.trace_raw} onChange={updateFormValue} name="trace_raw" />} control={<Checkbox checked={data.trace_raw} onChange={updateFormValue} name="trace_raw" />}
label="Log EMS telegrams in hexadecimal" label={LL.LOG_HEX()}
disabled={saving} disabled={saving}
/> />
<BlockFormControlLabel <BlockFormControlLabel
@@ -513,7 +510,7 @@ const SettingsApplication: FC = () => {
disabled={saving} disabled={saving}
/> />
} }
label="Enable Syslog" label={LL.ENABLE_SYSLOG()}
/> />
{data.syslog_enabled && ( {data.syslog_enabled && (
<Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start"> <Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start">
@@ -568,9 +565,9 @@ const SettingsApplication: FC = () => {
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="syslog_mark_interval" name="syslog_mark_interval"
label="Mark Interval" label={LL.MARK_INTERVAL()}
InputProps={{ InputProps={{
endAdornment: <InputAdornment position="end">seconds</InputAdornment> endAdornment: <InputAdornment position="end">{LL.SECONDS()}</InputAdornment>
}} }}
fullWidth fullWidth
variant="outlined" variant="outlined"
@@ -584,9 +581,9 @@ const SettingsApplication: FC = () => {
</Grid> </Grid>
)} )}
{restartNeeded && ( {restartNeeded && (
<MessageBox my={2} level="warning" message="EMS-ESP needs to be restarted to apply changed system settings"> <MessageBox my={2} level="warning" message={LL.RESTART_TEXT()}>
<Button startIcon={<PowerSettingsNewIcon />} variant="contained" color="error" onClick={restart}> <Button startIcon={<PowerSettingsNewIcon />} variant="contained" color="error" onClick={restart}>
Restart {LL.RESTART()}
</Button> </Button>
</MessageBox> </MessageBox>
)} )}
@@ -600,7 +597,7 @@ const SettingsApplication: FC = () => {
type="submit" type="submit"
onClick={validateAndSubmit} onClick={validateAndSubmit}
> >
Save {LL.SAVE()}
</Button> </Button>
</ButtonRow> </ButtonRow>
)} )}
@@ -609,7 +606,7 @@ const SettingsApplication: FC = () => {
}; };
return ( return (
<SectionContent title="Application Settings" titleGutter> <SectionContent title={LL.APPLICATION_SETTINGS()} titleGutter>
{content()} {content()}
</SectionContent> </SectionContent>
); );

View File

@@ -44,9 +44,13 @@ import { extractErrorMessage } from '../utils';
import { DeviceShort, Devices, DeviceEntity, DeviceEntityMask } from './types'; import { DeviceShort, Devices, DeviceEntity, DeviceEntityMask } from './types';
import { useI18nContext } from '../i18n/i18n-react';
export const APIURL = window.location.origin + '/api/'; export const APIURL = window.location.origin + '/api/';
const SettingsCustomization: FC = () => { const SettingsCustomization: FC = () => {
const { LL } = useI18nContext();
const { enqueueSnackbar } = useSnackbar(); const { enqueueSnackbar } = useSnackbar();
const [deviceEntities, setDeviceEntities] = useState<DeviceEntity[]>([{ id: '', v: 0, n: '', m: 0, w: false }]); const [deviceEntities, setDeviceEntities] = useState<DeviceEntity[]>([{ id: '', v: 0, n: '', m: 0, w: false }]);
@@ -148,9 +152,9 @@ const SettingsCustomization: FC = () => {
try { try {
setDevices((await EMSESP.readDevices()).data); setDevices((await EMSESP.readDevices()).data);
} catch (error: unknown) { } catch (error: unknown) {
setErrorMessage(extractErrorMessage(error, 'Failed to fetch device list')); setErrorMessage(extractErrorMessage(error, LL.PROBLEM_LOADING()));
} }
}, []); }, [LL]);
const setInitialMask = (data: DeviceEntity[]) => { const setInitialMask = (data: DeviceEntity[]) => {
setDeviceEntities(data.map((de) => ({ ...de, om: de.m }))); setDeviceEntities(data.map((de) => ({ ...de, om: de.m })));
@@ -161,7 +165,7 @@ const SettingsCustomization: FC = () => {
const data = (await EMSESP.readDeviceEntities({ id: unique_id })).data; const data = (await EMSESP.readDeviceEntities({ id: unique_id })).data;
setInitialMask(data); setInitialMask(data);
} catch (error: unknown) { } catch (error: unknown) {
setErrorMessage(extractErrorMessage(error, 'Problem fetching device entities')); setErrorMessage(extractErrorMessage(error, LL.PROBLEM_LOADING()));
} }
}; };
@@ -184,7 +188,7 @@ const SettingsCustomization: FC = () => {
if (de.n === undefined || de.n === de.id) { if (de.n === undefined || de.n === de.id) {
return de.id; return de.id;
} else if (de.n === '') { } else if (de.n === '') {
return 'Command: ' + de.id; return LL.COMMAND() + ': ' + de.id;
} }
return ( return (
<> <>
@@ -250,9 +254,9 @@ const SettingsCustomization: FC = () => {
const resetCustomization = async () => { const resetCustomization = async () => {
try { try {
await EMSESP.resetCustomizations(); await EMSESP.resetCustomizations();
enqueueSnackbar('All customizations have been removed. Restarting...', { variant: 'info' }); enqueueSnackbar(LL.CUSTOMIZATIONS_RESTART(), { variant: 'info' });
} catch (error: unknown) { } catch (error: unknown) {
enqueueSnackbar(extractErrorMessage(error, 'Problem resetting customizations'), { variant: 'error' }); enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_UPDATING()), { variant: 'error' });
} finally { } finally {
setConfirmReset(false); setConfirmReset(false);
} }
@@ -265,7 +269,7 @@ const SettingsCustomization: FC = () => {
.map((new_de) => new_de.m.toString(16).padStart(2, '0') + new_de.id); .map((new_de) => new_de.m.toString(16).padStart(2, '0') + new_de.id);
if (masked_entities.length > 60) { if (masked_entities.length > 60) {
enqueueSnackbar('Selected entities exceeded limit of 60. Please Save in batches', { variant: 'warning' }); enqueueSnackbar(LL.CUSTOMIZATIONS_FULL(), { variant: 'warning' });
return; return;
} }
@@ -275,12 +279,12 @@ const SettingsCustomization: FC = () => {
entity_ids: masked_entities entity_ids: masked_entities
}); });
if (response.status === 200) { if (response.status === 200) {
enqueueSnackbar('Customization saved', { variant: 'success' }); enqueueSnackbar(LL.CUSTOMIZATIONS_SAVED(), { variant: 'success' });
} else { } else {
enqueueSnackbar('Customization save failed', { variant: 'error' }); enqueueSnackbar(LL.PROBLEM_UPDATING(), { variant: 'error' });
} }
} catch (error: unknown) { } catch (error: unknown) {
enqueueSnackbar(extractErrorMessage(error, 'Problem sending entity list'), { variant: 'error' }); enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_UPDATING()), { variant: 'error' });
} }
setInitialMask(deviceEntities); setInitialMask(deviceEntities);
} }
@@ -294,21 +298,17 @@ const SettingsCustomization: FC = () => {
return ( return (
<> <>
<Box mb={2} color="warning.main"> <Box mb={2} color="warning.main">
<Typography variant="body2">Select a device and customize the entities using the options:</Typography> <Typography variant="body2">{LL.CUSTOMIZATIONS_HELP_1()}:</Typography>
<Typography variant="body2"> <Typography variant="body2">
<OptionIcon type="favorite" isSet={true} /> <OptionIcon type="favorite" isSet={true} />={LL.CUSTOMIZATIONS_HELP_2()}&nbsp;&nbsp;
=mark as favorite&nbsp;&nbsp; <OptionIcon type="readonly" isSet={true} />={LL.CUSTOMIZATIONS_HELP_3()}&nbsp;&nbsp;
<OptionIcon type="readonly" isSet={true} /> <OptionIcon type="api_mqtt_exclude" isSet={true} />={LL.CUSTOMIZATIONS_HELP_4()}&nbsp;&nbsp;
=disable write action&nbsp;&nbsp; <OptionIcon type="web_exclude" isSet={true} />={LL.CUSTOMIZATIONS_HELP_5()}
<OptionIcon type="api_mqtt_exclude" isSet={true} />
=exclude from MQTT and API&nbsp;&nbsp;
<OptionIcon type="web_exclude" isSet={true} />
=hide from Dashboard
</Typography> </Typography>
</Box> </Box>
<ValidatedTextField <ValidatedTextField
name="device" name="device"
label="EMS Device" label={'EMS ' + LL.DEVICE()}
variant="outlined" variant="outlined"
fullWidth fullWidth
value={selectedDevice} value={selectedDevice}
@@ -317,7 +317,7 @@ const SettingsCustomization: FC = () => {
select select
> >
<MenuItem disabled key={0} value={-1}> <MenuItem disabled key={0} value={-1}>
Select a device... {LL.SELECT_DEVICE()}...
</MenuItem> </MenuItem>
{devices.devices.map((device: DeviceShort, index) => ( {devices.devices.map((device: DeviceShort, index) => (
<MenuItem key={index} value={index}> <MenuItem key={index} value={index}>
@@ -401,7 +401,7 @@ const SettingsCustomization: FC = () => {
color="inherit" color="inherit"
onClick={() => maskDisabled(false)} onClick={() => maskDisabled(false)}
> >
set all&nbsp; {LL.SET_ALL()}&nbsp;
<OptionIcon type="api_mqtt_exclude" isSet={false} /> <OptionIcon type="api_mqtt_exclude" isSet={false} />
<OptionIcon type="web_exclude" isSet={false} /> <OptionIcon type="web_exclude" isSet={false} />
</Button> </Button>
@@ -416,7 +416,7 @@ const SettingsCustomization: FC = () => {
color="inherit" color="inherit"
onClick={() => maskDisabled(true)} onClick={() => maskDisabled(true)}
> >
set all&nbsp; {LL.SET_ALL()}&nbsp;
<OptionIcon type="api_mqtt_exclude" isSet={true} /> <OptionIcon type="api_mqtt_exclude" isSet={true} />
<OptionIcon type="web_exclude" isSet={true} /> <OptionIcon type="web_exclude" isSet={true} />
</Button> </Button>
@@ -428,7 +428,7 @@ const SettingsCustomization: FC = () => {
<> <>
<Header> <Header>
<HeaderRow> <HeaderRow>
<HeaderCell stiff>OPTIONS</HeaderCell> <HeaderCell stiff>{LL.OPTIONS()}</HeaderCell>
<HeaderCell resize> <HeaderCell resize>
<Button <Button
fullWidth fullWidth
@@ -436,10 +436,10 @@ const SettingsCustomization: FC = () => {
endIcon={getSortIcon(entity_sort.state, 'NAME')} endIcon={getSortIcon(entity_sort.state, 'NAME')}
onClick={() => entity_sort.fns.onToggleSort({ sortKey: 'NAME' })} onClick={() => entity_sort.fns.onToggleSort({ sortKey: 'NAME' })}
> >
NAME {LL.NAME()}
</Button> </Button>
</HeaderCell> </HeaderCell>
<HeaderCell resize>VALUE</HeaderCell> <HeaderCell resize>{LL.VALUE()}</HeaderCell>
</HeaderRow> </HeaderRow>
</Header> </Header>
<Body> <Body>
@@ -503,14 +503,11 @@ const SettingsCustomization: FC = () => {
const renderResetDialog = () => ( const renderResetDialog = () => (
<Dialog open={confirmReset} onClose={() => setConfirmReset(false)}> <Dialog open={confirmReset} onClose={() => setConfirmReset(false)}>
<DialogTitle>Reset</DialogTitle> <DialogTitle>{LL.RESET()}</DialogTitle>
<DialogContent dividers> <DialogContent dividers>{LL.CUSTOMIZATIONS_RESET()}</DialogContent>
Are you sure you want remove all customizations including the custom settings of the Temperature and Analog
sensors?
</DialogContent>
<DialogActions> <DialogActions>
<Button startIcon={<CancelIcon />} variant="outlined" onClick={() => setConfirmReset(false)} color="secondary"> <Button startIcon={<CancelIcon />} variant="outlined" onClick={() => setConfirmReset(false)} color="secondary">
Cancel {LL.CANCEL()}
</Button> </Button>
<Button <Button
startIcon={<SettingsBackupRestoreIcon />} startIcon={<SettingsBackupRestoreIcon />}
@@ -519,7 +516,7 @@ const SettingsCustomization: FC = () => {
autoFocus autoFocus
color="error" color="error"
> >
Reset {LL.RESET()}
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
@@ -529,7 +526,7 @@ const SettingsCustomization: FC = () => {
return ( return (
<> <>
<Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary"> <Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary">
Device Entities {LL.DEVICE_ENTITIES()}
</Typography> </Typography>
{renderDeviceList()} {renderDeviceList()}
{renderDeviceData()} {renderDeviceData()}
@@ -537,7 +534,7 @@ const SettingsCustomization: FC = () => {
<Box flexGrow={1}> <Box flexGrow={1}>
<ButtonRow> <ButtonRow>
<Button startIcon={<SaveIcon />} variant="outlined" color="primary" onClick={() => saveCustomization()}> <Button startIcon={<SaveIcon />} variant="outlined" color="primary" onClick={() => saveCustomization()}>
Save {LL.SAVE()}
</Button> </Button>
</ButtonRow> </ButtonRow>
</Box> </Box>
@@ -548,7 +545,7 @@ const SettingsCustomization: FC = () => {
color="error" color="error"
onClick={() => setConfirmReset(true)} onClick={() => setConfirmReset(true)}
> >
Reset {LL.RESET()}
</Button> </Button>
</ButtonRow> </ButtonRow>
</Box> </Box>
@@ -558,7 +555,7 @@ const SettingsCustomization: FC = () => {
}; };
return ( return (
<SectionContent title="User Customization" titleGutter> <SectionContent title={LL.USER_CUSTOMIZATION()} titleGutter>
{content()} {content()}
</SectionContent> </SectionContent>
); );