-
-
Notifications
You must be signed in to change notification settings - Fork 2
Move localization to ESPHome compile-time substitutions #58
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
Changes from 3 commits
1b2fd96
fb45784
77e10fb
4e96e7a
010185a
023ecb7
94b5b8f
5cb7bae
9b48ac0
8554c57
045400f
5da1de4
2074c27
e95c1bb
e9e5292
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ | |
| wifi_ssid: !secret wifi_ssid | ||
| wifi_password: !secret wifi_password | ||
| ota_password: "" # Optional: set OTA password, or use ${wifi_password} for backward compatibility (see migration guide) | ||
| language: en # Language code - see docs/localization.md for all supported codes | ||
|
|
||
| # Add-on configuration (if needed) | ||
| ## Upload TFT | ||
|
|
@@ -68,23 +69,23 @@ | |
| The following keys are available to be used in your `substitutions`: | ||
|
|
||
| <!-- markdownlint-disable MD013 MD033 --> | ||
| Key|Required|Supported values|Default|Description | ||
| :-|:-:|:-:|:-:|:- | ||
| cooler_relay|Mandatory for *cool* and *dual*|`1` or `2`|`0` (disabled)|Relay used to control the cooler. Use `1` for "Relay 1" or `2` for "Relay 2". | ||
| heater_relay|Mandatory for *heat* and *dual*|`1` or `2`|`0` (disabled)|Relay used to control the heater. Use `1` for "Relay 1" or `2` for "Relay 2". | ||
| temp_units|Optional|`°C` or `°F`|`°C`|Temperature unit. | ||
| min_off_time|Optional|Positive integer representing the number of seconds|`300`|Minimum duration (in seconds) the cooling/heating action must be disengaged before it may be engaged. | ||
| min_run_time|Optional|Positive integer representing the number of seconds|`300`|Minimum duration (in seconds) the cooling/heating action must be engaged before it may be disengaged. | ||
| min_idle_time|Optional|Positive integer representing the number of seconds|`30`|Minimum duration (in seconds) the idle action must be active before calling another climate action. | ||
| target_low|Optional|Number representing a temperature in the selected unit|`18` (°C) or `64` (°F)|The initial lower threshold for the target temperature. | ||
| target_high|Optional|Number representing a temperature in the selected unit|`24` (°C) or `75` (°F)|The initial higher threshold for the target temperature. | ||
| temp_min|Optional|Number representing a temperature in the selected unit|*cool: `15` (°C) or `60` (°F)*<br>*heat: `7` (°C) or `45` (°F)*<br>*dual: `7` (°C) or `45` (°F)* |The minimum temperature the climate device can reach. Used to set the range of the frontend gauge. | ||
| temp_max|Optional|Number representing a temperature in the selected unit|*cool: `45` (°C) or `113` (°F)*<br>*heat: `35` (°C) or `95` (°F)*<br>*dual: `45` (°C) or `113` (°F)* |The maximum temperature the climate device can reach. Used to set the range of the frontend gauge. | ||
| ~temp_step~|Deprecated|~Number representing a temperature in the selected unit~|~`0.5`~<br>`0.5` (°C) or `1` (°F)|~The granularity with which the target temperature can be controlled.~ | ||
| cool_deadband|Optional|Number representing a temperature hysteresis in the selected unit|`0.5` (°C) or `1` (°F)|The minimum temperature differential (temperature above the set point) before engaging cooling. | ||
| cool_overrun|Optional|Number representing a temperature hysteresis in the selected unit|`0.5` (°C) or `1` (°F)|The minimum temperature differential (cooling beyond the set point) before disengaging cooling. | ||
| heat_deadband|Optional|Number representing a temperature hysteresis in the selected unit|`0.5` (°C) or `1` (°F)|The minimum temperature differential (temperature below the set point) before engaging heat. | ||
| heat_overrun|Optional|Number representing a temperature hysteresis in the selected unit|`0.5` (°C) or `1` (°F)|The minimum temperature differential (heating beyond the set point) before disengaging heat. | ||
| | Key | Required | Supported values | Default | Description | | ||
| | :- | :-: | :-: | :-: | :- | | ||
|
Check failure on line 73 in docs/addon_climate.md
|
||
| | cooler_relay | Mandatory for *cool* and *dual* | `1` or `2` | `0` (disabled)|Relay used to control the cooler. Use `1` for "Relay 1" or `2` for "Relay 2". | | ||
|
Check failure on line 74 in docs/addon_climate.md
|
||
| | heater_relay | Mandatory for *heat* and *dual* | `1` or `2` | `0` (disabled)|Relay used to control the heater. Use `1` for "Relay 1" or `2` for "Relay 2". | | ||
|
Check failure on line 75 in docs/addon_climate.md
|
||
| | temp_units | Optional | `°C` or `°F` | `°C` | Temperature unit. | | ||
| | min_off_time | Optional | Positive integer representing the number of seconds | `300` | Minimum duration (in seconds) the cooling/heating action must be disengaged before it may be engaged. | | ||
| | min_run_time | Optional | Positive integer representing the number of seconds | `300` | Minimum duration (in seconds) the cooling/heating action must be engaged before it may be disengaged. | | ||
| | min_idle_time | Optional | Positive integer representing the number of seconds | `30` | Minimum duration (in seconds) the idle action must be active before calling another climate action. | | ||
| | target_low | Optional | Number representing a temperature in the selected unit | `18` (°C) or `64` (°F) | The initial lower threshold for the target temperature. | | ||
| | target_high | Optional | Number representing a temperature in the selected unit | `24` (°C) or `75` (°F) | The initial higher threshold for the target temperature. | | ||
| | temp_min | Optional | Number representing a temperature in the selected unit | *cool: `15` (°C) or `60` (°F)*<br>*heat: `7` (°C) or `45` (°F)*<br>*dual: `7` (°C) or `45` (°F)* | The minimum temperature the climate device | can reach. Used to set the range of the frontend gauge. | | ||
|
Check failure on line 82 in docs/addon_climate.md
|
||
| | temp_max | Optional | Number representing a temperature in the selected unit | *cool: `45` (°C) or `113` (°F)*<br>*heat: `35` (°C) or `95` (°F)*<br>*dual: `45` (°C) or `113` (°F)* | The maximum temperature the climate device can reach. Used to set the range of the frontend gauge. | | ||
| | ~temp_step~ | Deprecated | ~Number representing a temperature in the selected unit~ | ~`0.5`~<br>`0.5` (°C) or `1` (°F) | ~The granularity with which the target temperature can be controlled.~ | | ||
| | cool_deadband | Optional | Number representing a temperature hysteresis in the selected unit | `0.5` (°C) or `1` (°F) | The minimum temperature differential (temperature above the set point) before engaging cooling. | | ||
| | cool_overrun | Optional | Number representing a temperature hysteresis in the selected unit | `0.5` (°C) or `1` (°F) | The minimum temperature differential (cooling beyond the set point) before disengaging cooling. | | ||
| | heat_deadband | Optional | Number representing a temperature hysteresis in the selected unit | `0.5` (°C) or `1` (°F) | The minimum temperature differential (temperature below the set point) before engaging heat. | | ||
| | heat_overrun | Optional | Number representing a temperature hysteresis in the selected unit | `0.5` (°C) or `1` (°F) | The minimum temperature differential (heating beyond the set point) before disengaging heat. | | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <!-- markdownlint-enable MD013 MD033 --> | ||
|
|
||
|
|
@@ -104,6 +105,7 @@ | |
| wifi_ssid: !secret wifi_ssid | ||
| wifi_password: !secret wifi_password | ||
| ota_password: "" # Optional: set OTA password, or use ${wifi_password} for backward compatibility (see migration guide) | ||
| language: en # Language code - see docs/localization.md for all supported codes | ||
|
|
||
| # Add-on configuration (if needed) | ||
| ## Upload TFT | ||
|
|
@@ -146,6 +148,7 @@ | |
| wifi_ssid: !secret wifi_ssid | ||
| wifi_password: !secret wifi_password | ||
| ota_password: "" # Optional: set OTA password, or use ${wifi_password} for backward compatibility (see migration guide) | ||
| language: en # Language code - see docs/localization.md for all supported codes | ||
|
|
||
| # Add-on configuration (if needed) | ||
| ## Upload TFT | ||
|
|
@@ -188,6 +191,7 @@ | |
| wifi_ssid: !secret wifi_ssid | ||
| wifi_password: !secret wifi_password | ||
| ota_password: "" # Optional: set OTA password, or use ${wifi_password} for backward compatibility (see migration guide) | ||
| language: en # Language code - see docs/localization.md for all supported codes | ||
|
|
||
| # Add-on configuration (if needed) | ||
| ## Upload TFT | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Localization | ||
|
|
||
| NSPanel Easy supports displaying dates, weekdays, and UI strings in your local language. | ||
| Language selection is configured at compile time in your ESPHome YAML, so only the strings for your chosen language | ||
| are loaded onto the device — saving memory and allowing the panel to display correct strings even when offline. | ||
|
|
||
| ## Setting Your Language | ||
|
|
||
| Add the `language` substitution to your ESPHome YAML configuration: | ||
|
|
||
| ```yaml | ||
| substitutions: | ||
| device_name: "your_nspanel_name" | ||
| friendly_name: "Your Panel Name" | ||
| wifi_ssid: !secret wifi_ssid | ||
| wifi_password: !secret wifi_password | ||
| language: pt # Set your language code here | ||
| ``` | ||
|
|
||
| The default language is `en` (English). If no `language` substitution is set, or if an unsupported code is provided, | ||
| English will be used as a fallback. | ||
|
|
||
| After changing the language, you must recompile and flash your panel for the change to take effect. | ||
|
|
||
| ## Supported Languages | ||
|
|
||
| | Code | Language | | ||
| | :--- | :------- | | ||
| | `af` | Afrikaans | | ||
| | `ar` | Arabic | | ||
| | `bg` | Bulgarian | | ||
| | `bn` | Bengali | | ||
| | `bs` | Bosnian | | ||
| | `ca` | Catalan | | ||
| | `cs` | Czech | | ||
| | `cy` | Welsh | | ||
| | `da` | Danish | | ||
| | `de` | German | | ||
| | `el` | Greek | | ||
| | `en` | English *(default)* | | ||
| | `es` | Spanish | | ||
| | `et` | Estonian | | ||
| | `eu` | Basque | | ||
| | `fa` | Persian (Farsi) | | ||
| | `fi` | Finnish | | ||
| | `fr` | French | | ||
| | `gl` | Galician | | ||
| | `he` | Hebrew | | ||
| | `hi` | Hindi | | ||
| | `hr` | Croatian | | ||
| | `hu` | Hungarian | | ||
| | `id` | Indonesian | | ||
| | `is` | Icelandic | | ||
| | `it` | Italian | | ||
| | `ja` | Japanese | | ||
| | `jv` | Javanese | | ||
| | `ko` | Korean | | ||
| | `lt` | Lithuanian | | ||
| | `lv` | Latvian | | ||
| | `mk` | Macedonian | | ||
| | `ms` | Malay | | ||
| | `nb` | Norwegian Bokmål | | ||
| | `nl` | Dutch | | ||
| | `pa` | Punjabi (Gurmukhi) | | ||
| | `pl` | Polish | | ||
| | `pt` | Portuguese | | ||
| | `ro` | Romanian | | ||
| | `ru` | Russian | | ||
| | `sk` | Slovak | | ||
| | `sl` | Slovenian | | ||
| | `sq` | Albanian | | ||
| | `sr` | Serbian | | ||
| | `sv` | Swedish | | ||
| | `sw` | Swahili | | ||
| | `ta` | Tamil | | ||
| | `th` | Thai | | ||
| | `tr` | Turkish | | ||
| | `uk` | Ukrainian | | ||
| | `ur` | Urdu | | ||
| | `vi` | Vietnamese | | ||
| | `zh-cn` | Chinese (Simplified) | | ||
| | `zh-tw` | Chinese (Traditional) | | ||
|
|
||
| > [!NOTE] | ||
| > Languages using non-Latin scripts (Arabic, Bengali, Chinese, Cyrillic, Devanagari, Greek, Gurmukhi, | ||
| > Hebrew, Japanese, Korean, Persian, Tamil, Thai, Urdu) require a Nextion TFT font that supports the | ||
| > relevant character set. If your panel displays boxes or question marks instead of characters, | ||
| > your TFT file may not include the required font glyphs. | ||
|
|
||
| ## Missing Your Language? | ||
|
|
||
| If your language is not listed, please [open a feature request](https://github.com/edwardtfn/NSPanel-Easy/issues/new) | ||
| and it will be added in a future release. |
Uh oh!
There was an error while loading. Please reload this page.