Jacques has done a great job integrating my WU-forecast.php script into the Weather Blue 2 template set. Because the WU-forecast.php script does a default translation from UTF-8 to ISO-8859-1 character set, and the Weather Blue template uses UTF-8 natively, there can be issues displaying non-English forecasts. Also, for non-English forecasts that contain more than three words, the WU icon name is used with English text under the icon displayed. That English text would normally be translated in the Saratoga template set, but since Jacques uses a very different method for translation files, the WU English text remained just English.
I wrote a 'shim' program to establish the environment for WU-forecast so that translations and proper UTF-8 output could be provided for the Weather Blue 2 template.
To use it, the text_standard_
LL.php file needs new variables
$Tr_Chance_flurries = 'Chance flurries';
$Tr_Chance_rain = 'Chance rain';
$Tr_Chance_sleet = 'Chance sleet';
$Tr_Chance_snow = 'Chance snow';
$Tr_Chance_thunderstorms = 'Chance thunderstorms';
$Tr_Clear = 'Clear';
$Tr_Cloudy = 'Cloudy';
$Tr_Flurries = 'Flurries';
$Tr_Fog = 'Fog';
$Tr_Hazy = 'Hazy';
$Tr_Mostly_cloudy = 'Mostly cloudy';
$Tr_Partly_cloudy = 'Partly cloudy';
$Tr_Mostly_sunny = 'Mostly sunny';
$Tr_Rain = 'Rain';
$Tr_Sleet = 'Sleet';
$Tr_Snow = 'Snow';
$Tr_Sunny = 'Sunny';
$Tr_Thunderstorms = 'Thunderstorms';
with the
LL target language replacing the English word(s) in the variable definitions.
Like for French in text_standard_fr.php,
$Tr_Clear = 'Ciel dégagé';
and remember to use UTF-8 character set for the translation.
Then download the attached Saratoga-translation.php.txt file and upload it as
Saratoga-translation.php to your ./include/ directory.
Then change your forecast_wu.php page from
<?php
// That is what we call a php file inclusion
// WU forecast is takin place in that "hole" in your page
include('include/WU-forecast.php');
?>
to
<?php
// That is what we call a php file inclusion
// WU forecast is takin place in that "hole" in your page
$_REQUEST['lang'] = $lang; // send WUforecast the language
include_once("include/Saratoga-translate.php");
include('include/WU-forecast.php');
?>
and your forecast should support the translations.
You can also specify multiple forecasts by using
<?php
// That is what we call a php file inclusion
// WU forecast is takin place in that "hole" in your page
$_REQUEST['lang'] = $lang; // send WUforecast the language
include_once("include/Saratoga-translate.php");
global $SITE;
$SITE['WUforecasts'] = array(
// Location|forecast-URL (separated by | characters
'Saratoga|http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query=95070',
'Vamdrup|http://www.wunderground.com/global/stations/06108.html', // Vamdrup, Denmark
'Amsterdam|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Amsterdam%2C+Netherlands',
'Paris|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Paris%2C+France',
'Stockholm|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Stockholm%2C+Sweden',
'Oslo|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Oslo%2C+Norway',
'Moscow|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Moscow%2C+Russia',
'Athens|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Athens%2C+Greece',
'Tel Aviv|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Tel+Aviv%2C+Israel',
'Madrid|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Madrid%2C+Spain',
'Helsinki|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Helsinki%2C+Finland',
'Krakow|http://polish.wunderground.com/cgi-bin/findweather/getForecast?query=Krakow%2C+Poland',
'Florence|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=zmw:00000.1.16170',
);
include('include/WU-forecast.php');
?>
and the first entry will be the default forecast location.
You can see my working copy at
http://saratoga-weather.org/WB2/forecast_wu.phpEnjoy...
Best regards,
Ken