Use the translated version of the puzzle description.

This commit is contained in:
Tim Young 2024-05-17 16:06:03 -06:00
parent 98733d1ad5
commit bf2e281c40

View File

@ -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') {