Welcome to the Cumulus Support forum.

Latest Cumulus MX release 3.6.6 (build 3082) - 1 June 2020 (please see important 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)

See the Wiki to download the software or click on the Downloads link in the Forum Banner.

Changing lang dynamically ...

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Post Reply
User avatar
beteljuice
Posts: 2921
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: ex XP SP3 - now W10 laptop grr
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: 6490
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: 2921
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: ex XP SP3 - now W10 laptop grr
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: 6490
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