Welcome to the Cumulus Support forum.

Latest Cumulus MX release 3.8.4 (build 3094) - 14 September 2020 (please see announcement regarding releases since 3.5.0)
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 the NOAA report and Snow Index drop-down menus to 2030)

Use this Wiki link to Download the Software (Cumulus MX / Cumulus 1 and other related items).

Changing lang dynamically ...

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Post Reply
User avatar
beteljuice
Posts: 3002
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: 6923
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Buster 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: 3002
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: 6923
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Buster 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