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:
Philip Abbey
2023-11-02 21:32:42 +00:00
parent 694f312075
commit 816b0dc890
80 changed files with 1784 additions and 19 deletions

View File

@ -23,6 +23,7 @@ using Toybox.Graphics;
using Toybox.WatchUi;
class HomeAssistantView extends WatchUi.Menu2 {
hidden var strMenuItemTap as Lang.String;
function initialize(
definition as Lang.Dictionary,
@ -32,9 +33,10 @@ class HomeAssistantView extends WatchUi.Menu2 {
:theme as WatchUi.MenuTheme or Null
} or Null
) {
strMenuItemTap = WatchUi.loadResource($.Rez.Strings.MenuItemTap);
var toggle_obj = {
:enabled => "On",
:disabled => "Off"
:enabled => WatchUi.loadResource($.Rez.Strings.MenuItemOn) as Lang.String,
:disabled => WatchUi.loadResource($.Rez.Strings.MenuItemOff) as Lang.String
};
if (options == null) {
@ -66,7 +68,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
addItem(
new HomeAssistantMenuItem(
name,
"Tap",
strMenuItemTap,
entity,
null
)
@ -115,6 +117,9 @@ class HomeAssistantView extends WatchUi.Menu2 {
}
//
// Reference: https://developer.garmin.com/connect-iq/core-topics/input-handling/
//
class HomeAssistantViewDelegate extends WatchUi.Menu2InputDelegate {
function initialize() {