Carterlake/AJAX/PHP Multilingual template available

Dang… thought I’d caught them all… thanks again, Jozef.

Change (in language-nl.txt)

langlookup|Forecast & Advisories|Vooruitzicht & waarschuwingen|

to

langlookup|Forecast & Advisories|Vooruitzicht & waarschuwingen|

and it should validate fine.

I’ve updated the distribution WD-World-ML and the Dutch language pack (language-nl.zip)

Best regards,
Ken

Edit: Caught the same naked ‘&’ instead of ‘&’ in the Danish, Italian, Norwegian and Swedish translations too, so I’ve updated the distribution and those language packs. They now validate XHTML1.0-Transitional too.

Heat color word shows 1 step “colder” than correct word. It shows correct during page load, but when ajax kicks in, its wrong.

var langHeatWords = new Array ( /* used for Heat Color Word */
‘Unknown’, ‘Extreme Heat Danger’, ‘Heat Danger’, ‘Extreme Heat Caution’, ‘Extremely Hot’, ‘Uncomfortably Hot’,
‘Hot’, ‘Warm’, ‘Comfortable’, ‘Cool’, ‘Cold’, ‘Uncomfortably Cold’, ‘Very Cold’, ‘Extreme Cold’ );

If putting in another ‘Unknown’ so that its 2 in a row, correct heat color word is shown.

Arnt

Update: Things are probably correct, it may be my own personal settings in WD that causes it.

Sorry Ken for leaving out this phrase from the translation! #-o

That happens when somebody works late at night! :sleepy3:

Thanos

Hi

Regarding the session wide cookie.

I have now tried 3 different computers and I can’t keep the chosen language for the whole seesion. When You have a spare minute could you please try:

toppen-vejr.info

to see if you can do it.

Thanks

Rgds
Gert

It’s quite ok, Thanos! I hope I copied the correct Greek from other entries to make it linguistically correct :slight_smile:
Best regards,
Ken

Hi Gert!

I think the issue is caused by not having the style switcher enabled … the PHP Session is established in that code.

Try enabling the style switcher in your Settings.php … if that works out, I’ll do an update that checks for that and establishes the session elsewhere.

Change in Settings.php to

$SITE['allowThemeSwitch']   = true;  // set to false to disable the the use of Theme Switcher 

Best regards,
Ken

Hi Arnt!

The AJAX code uses the default settings for HeatColorWord in WD … it will look different if you’ve changed your WD settings to different values. If you want to keep your WD values, then you can change ajaxWDwx.js heat color word routine to match your WD values instead.

Best regards,
Ken

Hi Ken

You’re right, turning on the Style Switcher did the trick. If possible, it could be nice to do session cookie elsewhere.

I have another question to the Astronomy page. My default Language is English and on the page I have some weird dates, but using other languages everything seems to be fine.

toppen-vejr.info

Thanks a lot for helping.

Rgds
Gert

Ken,

Maybe you could check my astronomy page too http://home.halden.net/mordor/berdalweather/wxastronomy.php I have many weird dates at 1970. Why is that?

Gert,
Here’s a fix for the language not sticking when the style switcher is not enabled. In Settings.php (near the end) replace

if($SITE['allowThemeSwitch']) {
  # begin Color Theme Switcher Plugin by Mike Challis
  # http://www.carmosaic.com/weather/scripts.php
  include_once('include-style-switcher.php');
  $SITE['CSSscreen'] = validate_style_choice();
  # end Color Theme Switcher Plugin
}

with

if($SITE['allowThemeSwitch']) {
  # begin Color Theme Switcher Plugin by Mike Challis
  # http://www.carmosaic.com/weather/scripts.php
  include_once('include-style-switcher.php');
  $SITE['CSSscreen'] = validate_style_choice();
  # end Color Theme Switcher Plugin
} else {
  session_start(); // for preservation of language settings.
  if ($SITE['CSSwideOrNarrowDefault'] == 'wide') {
          $_SESSION['CSSwidescreen'] = 1;
          $CSSstyle = str_replace ('.css','-wide.css',$SITE['CSSscreenDefault']);
  } else {
          $_SESSION['CSSwidescreen'] = 0;
          $CSSstyle = str_replace ('.css','-narrow.css',$SITE['CSSscreenDefault']);
  }
  $SITE['CSSscreen'] = $CSSstyle;
}

and that allows the theme switcher to be disabled, and the language to ‘stick’ for the session.
You’ll also need to change

$SITE['CSSscreenDefault'] = 'weather-screen-blue-wide.css'; 
$SITE['CSSwideOrNarrowDefault'] = 'narrow';

to

$SITE['CSSscreenDefault'] = 'weather-screen-blue.css'; 
$SITE['CSSwideOrNarrowDefault'] = 'wide';

as this mod uses the values in those two settings to construct the $SITE[‘CSSscreen’] contents.

The dates on the wxastronomy.php page are trying to be translated from Danish to English and back again.
Since you are running WD in English, change

$SITE['WDlanguage'] = 'dk';

to

$SITE['WDlanguage'] = 'en';

and it should work fine :slight_smile:

Best regards,
Ken

You’re not running the World-ML template, and you’re using Norwegian dates in WD so it’s setting testtags.php with

$marchequinox = “05:49 UTC 20 mars 2008”; // March equinox date
$junesolstice = “00:00 UTC 21 juni 2008”; // June solstice date
$sepequinox = “15:45 UTC 22 september 2008”; // September equinox date
$decsolstice = “12:04 UTC 21 desember 2008”; // December solstice date
$moonperihel = “08:14 UTC 3 januar 2009”; // Next Moon perihel date
$moonaphel = “17:08 UTC 4 juli 2008”; // Next moon perihel date
$moonperigee = “23:20 UTC 29 juli 2008”; // Next moon perigee date
$moonapogee = “04:14 UTC 14 juli 2008”; // Next moon apogee date
$newmoon = “02:19 UTC 3 juli 2008”; // Date/time of the next/last new moon
$nextnewmoon = “10:13 UTC 1 august 2008”; // Date/time of the next new moon for next month
$firstquarter = “04:35 UTC 10 juli 2008”; // Date/time of the next/last first quarter moon
$lastquarter = “18:42 UTC 25 juli 2008”; // Date/time of the next/last last quarter moon
$fullmoon = “08:00 UTC 18 juli 2008”; // Date/time of the next/last full moon
$fullmoondate = " 18 juli 2008"; // Date of the next/last full moon (date only)
$suneclipse = “10:22 UTC 1 august 2008 Eclipse Total”; // Next sun eclipse
$mooneclipse = “14:39 UTC 9 februar 2009 Eclipse Half shadow”; // Next moon eclipse date
$easterdate = “23 mars 2008”; // Next easter date
$chinesenewyear = “7 februar 2008 ()”; // Chinese new year

In your Settings.php, just fix up the

# if your WD uploads almanac dates using a language OTHER THAN English, please put the month
# names in your language to replace the English ones below.  This is used primarily by the
# wxastronomy.php page for the local dates of moon phases, solistices, and equinoxes
$SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language 
'January','February','March','April','May','June',
'July','August','September','October','November','December'
);

and replace the English month names with Norwegian (using lower case for Norwegian names) and that should fix the wxastronomy.php page.

# if your WD uploads almanac dates using a language OTHER THAN English, please put the month
# names in your language to replace the English ones below.  This is used primarily by the
# wxastronomy.php page for the local dates of moon phases, solistices, and equinoxes
$SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language 
'januar','februar','mars','april','mai','juni',
'juli','august','september','oktober','november','desember'
);

Best regards,
Ken

Ken,

Thank you very much. That did the trick. I think I was misunderstanding the meaning of the “other than English” in the Settings.php, because I have read that text several times before without thinking about needing to change (I think that is because I have an English language template…).

Again, thanks!

Hi Ken

Now the session cookie is working fine.

I have changed the WdLanguage to ‘en’, but the problem is stille on the astronomy page.

Rgds
Gert

Gert,
You have the opposite issue as berdalweather … your testtags.php is uploading in English as you said

$marchequinox = “05:49 UTC 20 March 2008”; // March equinox date
$junesolstice = “00:00 UTC 21 June 2008”; // June solstice date
$sepequinox = “15:45 UTC 22 September 2008”; // September equinox date
$decsolstice = “12:04 UTC 21 December 2008”; // December solstice date
$moonperihel = “08:14 UTC 3 January 2009”; // Next Moon perihel date
$moonaphel = “17:08 UTC 4 July 2008”; // Next moon perihel date
$moonperigee = “21:21 UTC 1 July 2008”; // Next moon perigee date
$moonapogee = “04:14 UTC 14 July 2008”; // Next moon apogee date
$newmoon = “19:23 UTC 3 June 2008”; // Date/time of the next/last new moon
$nextnewmoon = “02:19 UTC 3 July 2008”; // Date/time of the next new moon for next month
$firstquarter = “15:04 UTC 10 June 2008”; // Date/time of the next/last first quarter moon
$lastquarter = “12:10 UTC 26 June 2008”; // Date/time of the next/last last quarter moon
$fullmoon = “17:31 UTC 18 June 2008”; // Date/time of the next/last full moon
$fullmoondate = " 18 June 2008"; // Date of the next/last full moon (date only)
$suneclipse = “10:22 UTC 1 August 2008 Eclipse Total”; // Next sun eclipse
$mooneclipse = “14:39 UTC 9 February 2009 Eclipse Half shadow”; // Next moon eclipse date
$easterdate = “23 March 2008”; // Next easter date
$chinesenewyear = “7 February 2008 ()”; // Chinese new year

But you have the Danish months set in $SITE[‘monthNames’]. You should put the English version back in the Settings.php for the month names and then the translations for the wxastronomy.php page should work fine.

# if your WD uploads almanac dates using a language OTHER THAN English, please put the month
# names in your language to replace the English ones below.  This is used primarily by the
# wxastronomy.php page for the local dates of moon phases, solistices, and equinoxes
$SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language 
'January','February','March','April','May','June',
'July','August','September','October','November','December'
);

Best regards,
Ken

Hi Ken

I have replace the danish month names with english month names, but the problem is still there.

First Quarter Moon, Full Moon, Last Quarter Moon, Start opf Summer and Start of Winter are wrong.

New Moon, Sart of Fall and Start of Winter seems to be ok.

rgds
Gert

WDL and WD-AJAX-PHP-World-ML (a perfect wedding)

First thing to do: configure wdlconfig.xml to your needs.
See if WDL is looking the way you want.

Done ??

Now the easy part:
open wdlconfig.xml with your favorite text-editor
between put english and save the file as wdlconfig-en.xml
between put danish and save the file as wdlconfig-dk.xml
between put dutch and save the file as wdlconfig-nl.xml
between put finnish and save the file as wdlconfig-fi.xml
between put greek and save the file as wdlconfig-el.xml
between put italian and save the file as wdlconfig-it.xml
between put norwegian and save the file as wdlconfig-no.xml
between put spanish and save the file as wdlconfig-es.xml
between put swedish and save the file as wdlconfig-se.xml
…and now
open wxlive.php from the WD-AJAX-PHP-World-ML package
find
var pathToConfig = “http://your domain here/wdlconfig.xml”;
and change it to
var pathToConfig = “http://your domain here/wdlconfig-<?php echo $SITE['lang']?>.xml”;

Upload all the files where they belong, and …watch the magic

PS.You have to take care the var pathToConfig points to the right place.
If you have an error telling you, you have the wrong serial number, take another look at the file-names.
They MUST be like wdlconfig-xx.xml.

Jozef

You can do exactly the same for your MML, but…greek is not available, so I used english between the tags and save as mmlconfig-el.xml

EDIT:link to testsite so you can see (click the flags)

Ken (or anyone),

For some reason my new testpage doesn’t work. I’ve decided to change to the ML template so I’ve uploaded and configured everything in a test folder on my website.

http://home.halden.net/mordor/berdalweather/test/wxindex.php

The dashboard won’t show at all

Hi Ken,

about wxastronomy

strange things are happening here

http://www.joske-online.be/WD-AJAX-PHP-World-ML/wxastronomy.php

some languages display ok, while others don’t

uploading testtags.php from an english XP-box => everything works(english month names in settings)
uploading from dutch XP-box SOME languages work(dutch month names in settings)

note: testtags is in the root and using dutch XP-box now
I guess it has to do with the language your OS is

Jozef

Edit: both times using english Weather Display

Thanks Jozef! This is brilliant!! 8) :smiley: =D> =D> =D>

I’m going to take this and add it to the FAQ section on my site.

Best regards,
Ken

You’ll need to make some adjustments to Settings.php if you locate the site in a subdirectory.
$SITE[‘WXtags’] = ‘…/testtags.php’;
$SITE[‘clientrawfile’] = ‘…/clientraw.txt’;
and maybe
$SITE[‘fcsticonsdir’] = ‘…/forecast/images/’;
$SITE[‘imagesDir’] = ‘…/ajax-images/’;

to name a few. The graphs and wxhistory won’t work either, since they’re expected to be in the same directory as the respective pages (wxgraphs.php, wxhistory.php).

Your page doesn’t finish loading the dashboard because it currently can’t find the testtags.php file.

It’s why I disrecommend installing the template set in a subdirectory … lots of fiddly bits to adjust.

Best regards,
Ken