Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Changing lang dynamically ...

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Post Reply
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Changing lang dynamically ...

Post by beteljuice »

The beteljuice has cause to investigate how change gauges language on-demand.

I'm using changeLang(res); where res = "LANG." + ??;

console.log() confirms action taken and res value.

Everything folds and comes back undefined ....

Edit: Ah .... It has to be without quotes ...

How do I code for that ???

Edit #2: Got it working with eval() .. changeLang(eval(res));

... but I thought that had been depreciated years ago ???
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Changing lang dynamically ...

Post by mcrossley »

Rather than using text for the "LANG.xxx", use

Code: Select all

changeLang(LANG["??"]);
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Changing lang dynamically ...

Post by beteljuice »

An object[array] :groan:

I must try and get some sleep this year ...
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Changing lang dynamically ...

Post by mcrossley »

Well it is an Object rather than an array, but JavaScript allows you to use array notation on objects as well as dot - probably for just this usage.
Post Reply