mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-06-16 19:38:34 +00:00
Internationalisation & Multi-watch support
Copied two methods from GarminThermoNest to translate languages and manage different sized icons for the various sizes of watch. Also copied ErrorView for smaller wrapped text for error messages.
This commit is contained in:
@ -25,6 +25,7 @@ using Toybox.Application.Properties;
|
||||
|
||||
class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
hidden var api_key = Properties.getValue("api_key");
|
||||
hidden var strNoInternet as Lang.String;
|
||||
|
||||
function initialize(
|
||||
label as Lang.String or Lang.Symbol,
|
||||
@ -39,6 +40,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
:icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol
|
||||
} or Null
|
||||
) {
|
||||
strNoInternet = WatchUi.loadResource($.Rez.Strings.NoInternet);
|
||||
WatchUi.ToggleMenuItem.initialize(label, subLabel, identifier, enabled, options);
|
||||
api_key = Properties.getValue("api_key");
|
||||
}
|
||||
@ -100,7 +102,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
new Alert({
|
||||
:timeout => Globals.alertTimeout,
|
||||
:font => Graphics.FONT_SYSTEM_MEDIUM,
|
||||
:text => "No Internet connection",
|
||||
:text => strNoInternet,
|
||||
:fgcolor => Graphics.COLOR_RED,
|
||||
:bgcolor => Graphics.COLOR_BLACK
|
||||
}).pushView(WatchUi.SLIDE_IMMEDIATE);
|
||||
@ -164,7 +166,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
new Alert({
|
||||
:timeout => Globals.alertTimeout,
|
||||
:font => Graphics.FONT_SYSTEM_MEDIUM,
|
||||
:text => "No Internet connection",
|
||||
:text => strNoInternet,
|
||||
:fgcolor => Graphics.COLOR_RED,
|
||||
:bgcolor => Graphics.COLOR_BLACK
|
||||
}).pushView(WatchUi.SLIDE_IMMEDIATE);
|
||||
|
Reference in New Issue
Block a user