Carterlake/AJAX/PHP Multilingual template available

That’s a bit strange, Arnt. Since your station is recording and reporting in metric, I’d expect the

%dayrn% === %todayraininmm% and
%yesterdayrain% === %yesterdayraininmm%

Sounds like a question for Brian to look at ?!?

Best regards,
Ken

Hi Ken… E-mail received, and homework done :slight_smile: Here you have it.


language-es.txt (12.9 KB)

Thanks Luis!
I’ve added it (and an update for Greek from Thanos) to the distribution and the language packs for Spanish and Greek.

Best regards,
Ken

Hi Ken

Excellent job you have done.

I have one question. When I choose a language, should that choice be valid for the session. When I move to a new page the language seems to shift to the default language. I then need to press the flag again in order to have the page translated.

Is that by purpose or should the choice be valid for the whole session?

Thanks

Rgds
Gert

Hi Gert!

Yes, it should preserve your language selection (once made) across the section of languges.
It does rely on a cookie to support the choice … do you have cookies enabled for your site?

Best regards,
Ken

Hi Ken,

Great job, like always! :smiley: :smiley:

some minor things(on test-site)

only one found so far, translation in el of ‘Minimum temperature’ is not there

you can see it here

Jozef

You’re very correct, Jozef. I think Thanos missed one. I took a stab at it and came up with

langlookup|Minimum temperature|

we have no validation on some languages(i.e fly-out menu)

langlookup|Forecast & Advisories|Vooruitzicht & waarschuwingen|

this is for the language-nl.txt

it is the &–bug #-o

Jozef

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!