From bf2e281c40ea1b60b78664f746f105497b1be1bf Mon Sep 17 00:00:00 2001 From: Tim Young Date: Fri, 17 May 2024 16:06:03 -0600 Subject: [PATCH] Use the translated version of the puzzle description. --- Web/ui.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Web/ui.js b/Web/ui.js index 4150efb..a9519f5 100644 --- a/Web/ui.js +++ b/Web/ui.js @@ -17,7 +17,7 @@ var ui_HadHighlight = false; var ui_status_height = 25; var ui_StatusText = ""; var ui_HighlightArray = []; -var translator = new Language('en'); +var translator = new Language("en"); //The user interface mode. 0=network, 1=network information, 2=puzzle-selection menu var uiMode=1; @@ -191,7 +191,8 @@ function PrintScreen(WhatPassedIn=-1) else if(what == 1) //PuzzleDescription/Info { //Display the text about the puzzle - textMenuPrint(puzzle.en_message); + console.log("Using language: " + ui_language); + textMenuPrint(eval('puzzle.' + ui_language + '_message')); } else if(what == 2) //PuzzleSelect { @@ -890,17 +891,18 @@ function device_clickOn(point, actionrec) { } } -function Language(lang) { +function Language(lang = null) { var __construct = function () { - if (eval('typeof ' + lang) == 'undefined') { + if (lang == null) { lang = "en"; } - ui_language = 'language.' + lang; + //console.log("Defining language:" + lang); + ui_language = lang; return; }() this.getStr = function (str, defaultStr) { - var toget = ui_language + "." + str + ".value"; + var toget = 'language.' + ui_language + "." + str + ".value"; //console.log("Translating: " + toget); var retStr = eval(toget); if (typeof retStr != 'undefined') {