cloudy cloudy

Author Topic: WxSim Online Forecast Display language translation  (Read 32978 times)

0 Members and 1 Guest are viewing this topic.

Offline MD5

  • Posts: 161
  • Pieve Ligure - Italy
    • PLMeteo.Info Weather Station
WxSim Online Forecast Display language translation
« on: March 20, 2007, 08:53:57 PM »
I want add WxSim Online Forecast Display to my site:

www.plmeteo.info

I discovered WxSim only today :oops: and I'm now try to learn it's features, usage mode and requirements, I've a few questions to ask:

- Is possible to display online forecast in italian language ?
- I've a VP2 weather station with optional solar station added. I'm actually miss the UV sensor, do WxSim require it ?
- How WxSim could perform here in north west Italy ? Will data source be enough for acceptable forecast ?

Thanks for any answer!

Mario
« Last Edit: March 20, 2007, 08:57:19 PM by MD5 »

Offline Tom Ehrensperger

  • Posts: 2,570
Re: WxSim Online Forecast Display language translation
« Reply #1 on: March 21, 2007, 02:45:53 AM »
Hi Mario,

I responded to an email from you (I think) earlier, but I see a couple more questions here.

No, you don't need a UV sensor.  You don't really need a solar sensor, either, though it helps a bit in initializing the forecast.

Northwest Italy shouldn't present any special problems.  I have done a customization near Genova before, actually.

Thanks for your interest!

Tom

Offline MD5

  • Posts: 161
  • Pieve Ligure - Italy
    • PLMeteo.Info Weather Station
Re: WxSim Online Forecast Display language translation
« Reply #2 on: March 21, 2007, 12:23:10 PM »
Thanks for your reply,

I spent a couple of hours surfing the web and reading more about your interesting WxSim, at the end I purchased the software bundle + customization.

Output forecast in other language than English would be much appreciated in future. In the meantime could you please post a list of all the words, sentences of the forecast ? The idea is to make a "translator" with AutoIt that read the English forecast and swap/translate it.

Or if someone know other way to translate, using .pho for example, any idea welcomed!

Thanks again.

Mario
« Last Edit: March 21, 2007, 01:41:42 PM by MD5 »

Offline MD5

  • Posts: 161
  • Pieve Ligure - Italy
    • PLMeteo.Info Weather Station
Re: WxSim Online Forecast Display language translation
« Reply #3 on: March 22, 2007, 05:49:19 AM »
I received an email message from Gerard of
http://www.doornenburgweer.nl

He did a .php language translator, I'm now waiting to receive more details.

Thanks in the meantime!

Offline jwwd

  • WML testers
  • Posts: 3,692
  • Silkeborg, Denmark (56:10:58 N-09:30:26 E) - Elevation 75,35 meters
    • Weather at Silkeborg, Denmark
Re: WxSim Online Forecast Display language translation
« Reply #4 on: March 22, 2007, 06:07:36 AM »
Hi

Im very interested if someone can make an "easy to install" guide of Gerards script - its very impressive.

But also a bit complicated for a newbie to php scripts..

Offline doornenburgweer

  • Posts: 309
  • Intel D945SGLF 1 G, XP, VantagePro 2
  • Doornenburg, The Netherlands
    • Doornenburg weer
Re: WxSim Online Forecast Display language translation
« Reply #5 on: March 22, 2007, 06:46:48 AM »
this script is not so impressive, I could start with the help of Jardan. Jordan thanks for your help. So in the script there is a translation of the daynames and the text. There are not so many words used in the forecast. with trial and many errors I could figure out the right ranking of the translation, because our Dutch language is "so nice". The most words are translated now. And with the help of php, nobody can see the mass I made with this translation, I am not a programmer, I like to show the things on the right way. so this is a part of Jordan wdsofd file with some adaptations:
Jordan thanks for your help and I had no problems to pay for the donation.



$kcounter = 0;
for ($k=0; $k<count($castpd); $k++) {

$spltcln = explode(":", $castpd[$k]);
$pdname = str_replace(' night', ' Night', $spltcln[0]);
$pdname = str_replace(' afternoon', ' Afternoon', $spltcln[0]);
$pdverb = str_replace("\n", "", $spltcln[1]);

$pdverb = str_replace('Cloudy in the morning', 'Bewolkt in de morgen', $pdverb);
$pdverb = str_replace('becoming', 'overgaand in ', $pdverb);
$pdverb = str_replace('dense overcast', 'dichte bewolking', $pdverb);
$pdverb = str_replace('then', 'dan', $pdverb);
$pdverb = str_replace('the', 'de', $pdverb);
$pdverb = str_replace('afternoon', 'middag', $pdverb);
$pdverb = str_replace('cloudy', 'bewolkt', $pdverb);
$pdverb = str_replace('Patchy', 'Gedeeltelijk', $pdverb);
$pdverb = str_replace('slight', 'kleine', $pdverb);
$pdverb = str_replace('light', 'lichte', $pdverb);
$pdverb = str_replace('fog', 'mist', $pdverb);
$pdverb = str_replace('Partly', 'Gedeeltelijk', $pdverb);
$pdverb = str_replace('to', 'tot', $pdverb);
$pdverb = str_replace('gusting', 'windvlagen', $pdverb);
$pdverb = str_replace('mostly', 'overwegend', $pdverb);
$pdverb = str_replace('after', 'na', $pdverb);
$pdverb = str_replace('midnight', 'middernacht', $pdverb);
$pdverb = str_replace('morning', 'morgen', $pdverb);
$pdverb = str_replace('Mostly', 'Overwegend', $pdverb);
$pdverb = str_replace('partly', 'gedeeltelijk', $pdverb);
$pdverb = str_replace('Light', 'Lichte', $pdverb);
$pdverb = str_replace('moderate', 'matige', $pdverb);
$pdverb = str_replace('evening', 'avond', $pdverb);
$pdverb = str_replace('Dense', 'Dichte', $pdverb);
$pdverb = str_replace('overcast', 'bewolking', $pdverb);
$pdverb = str_replace('Moderate', 'Matige', $pdverb);
$pdverb = str_replace('dense', 'dichte', $pdverb);
$pdverb = str_replace('sunny', 'zonnig', $pdverb);
$pdverb = str_replace('Rain likely', 'Grote kans op regen', $pdverb);
$pdverb = str_replace('rain', 'regen', $pdverb);
$pdverb = str_replace('A', 'Een', $pdverb);
$pdverb = str_replace('chance of', 'kans op', $pdverb);
$pdverb = str_replace('High', 'Maximum:', $pdverb);
$pdverb = str_replace('Low', 'Minimum :', $pdverb);
$pdverb = str_replace('but', 'maar', $pdverb);
$pdverb = str_replace('temperatures falling', 'temperatuur daalt', $pdverb);
$pdverb = str_replace('temperatures rising', 'temperatuur stijgt', $pdverb);
$pdverb = str_replace('north', 'noord', $pdverb);
$pdverb = str_replace('nordeast', 'noordoost', $pdverb);
$pdverb = str_replace('east-', 'oost-', $pdverb);
$pdverb = str_replace('down ', 'daalt ', $pdverb);
$pdverb = str_replace('or ', 'of ', $pdverb);
$pdverb = str_replace('east ', 'oost ', $pdverb);
$pdverb = str_replace('southeast', 'zuidoost', $pdverb);
$pdverb = str_replace('southwest', 'zuidwest', $pdverb);
$pdverb = str_replace('south ', 'zuid ', $pdverb);
$pdverb = str_replace('south-', 'zuid-', $pdverb);
$pdverb = str_replace('around', 'rond', $pdverb);
$pdverb = str_replace('kph', 'km/uur', $pdverb);
$pdverb = str_replace('Chance of precipitation', 'Kans op neerslag', $pdverb);
$pdverb = str_replace('near', 'bijna', $pdverb);
$pdverb = str_replace('percent', 'procent', $pdverb);
$pdverb = str_replace('less than', 'minder dan', $pdverb);
$pdverb = str_replace('snow', 'sneeuw', $pdverb);
$pdverb = str_replace('Precipitation (liquid equivalent)', 'Neerslag (gesmolten)', $pdverb);
$pdverb = str_replace('between', 'tussen', $pdverb);
$pdverb = str_replace('and', 'en', $pdverb);
$pdverb = str_replace('Precipitation', 'Neerslag', $pdverb);
$pdverb = str_replace('accumulation expected', 'ophoping verwacht', $pdverb);
$pdverb = str_replace('Little', 'Weinig', $pdverb);
$pdverb = str_replace('no ', 'geen ', $pdverb);
$pdverb = str_replace('snow ', 'sneeuw ', $pdverb);
$pdverb = str_replace('Snow accumulation', 'Sneeuw ophoping ', $pdverb);
$pdverb = str_replace('about', 'ongeveer', $pdverb);
$pdverb = str_replace('one', '1', $pdverb);
$pdverb = str_replace('overgaen', 'overgaand', $pdverb);
$pdverb = str_replace('soudoost', 'zuidoost', $pdverb);
$pdverb = str_replace('showery of intermittent', 'afwisselend droog met buien', $pdverb);
$pdverb = str_replace('No ', 'Geen ', $pdverb);
$pdverb = str_replace('Fair ', 'Bijna geen bewolking ', $pdverb);
$pdverb = str_replace('Cloudy', 'Bewolkt', $pdverb);
$pdverb = str_replace('calm', 'kalm', $pdverb);
$pdverb = str_replace('Clear', 'Helder', $pdverb);
$pdverb = str_replace('clear', 'helder', $pdverb);
$pdverb = str_replace('Sunny', 'Zonnig', $pdverb);
$pdverb = str_replace('dan a', 'dan een', $pdverb);
$pdverb = str_replace('ice', 'ijs', $pdverb);
$pdverb = str_replace('freezing', 'bevriezende', $pdverb);
$pdverb = str_replace('sleet', 'natte sneeuw', $pdverb);
$pdverb = str_replace('a mix of', 'een mix van', $pdverb);
$pdverb = str_replace('if any', 'tot geen', $pdverb);
$pdverb = str_replace('on ground', 'op de grond', $pdverb);
$pdverb = str_replace('patchy', 'gedeeltelijk', $pdverb);
$pdverb = str_replace('Thunderstotrms likely, some possibly severe.', 'Kans op (zware) onweersbuien.', $pdverb);
$pdverb = str_replace('Some thunder possible.', 'Kans op onweer. ', $pdverb);
$pdverb = str_replace('Some thunderstotrms likely', 'Kans op onweersbuien ', $pdverb);



$lwrpdvb = strtolower($pdverb);
#
# TRANSLATION DAYS IN DUTCH
# WX-SIM Online Forecast Display
# VERSION 1.12, revision A
# Author:         Jordan Gerth
#

$pdname = str_replace('Sunday', 'Zondag', $pdname);
$pdname = str_replace('Monday', 'Maandag', $pdname);
$pdname = str_replace('Tuesday', 'Dinsdag', $pdname);
$pdname = str_replace('Wednesday', 'Woensdag', $pdname);
$pdname = str_replace('Thursday', 'Donderdag', $pdname);
$pdname = str_replace('Friday', 'Vrijdag', $pdname);
$pdname = str_replace('Saturday', 'Zaterdag', $pdname);
$pdname = str_replace('Today', 'Vandaag', $pdname);
$pdname = str_replace('Tonight', 'Vannacht', $pdname);
$pdname = str_replace('afternoon', 'vanmiddag', $pdname);
$pdname = str_replace('night', 'nacht', $pdname);


if (strlen($pdname) < 2) {
   break;
}


have fun with the Dutch language. This is all I can do for you, I am too busy with my job.

gerard

Offline Rush

  • Posts: 160
  • Bergen, Norway
    • Bergen lightning detector
Re: WxSim Online Forecast Display language translation
« Reply #6 on: March 22, 2007, 08:12:55 AM »
Perfect, then I can use this to present the forecast in norwegian :)

Could yo uplease tell me exactly where in wsofd.php I should insert this translation and do I need to remove any existing code?

Offline MD5

  • Posts: 161
  • Pieve Ligure - Italy
    • PLMeteo.Info Weather Station
Re: WxSim Online Forecast Display language translation
« Reply #7 on: March 22, 2007, 08:26:18 AM »
Gerard, thanks for sharing the translation code, I will try to made it work after WxSim become registered and customized for my site, I'm now waiting Tom work.

I now kindly ask Tom if he can supply the full words and sentences list available in the registered version.

Thanks again!

Mario

Offline Rush

  • Posts: 160
  • Bergen, Norway
    • Bergen lightning detector
Re: WxSim Online Forecast Display language translation
« Reply #8 on: March 22, 2007, 03:22:54 PM »
I managed to make a successful Norwegian translation, but off course that will mass up so that images and the temperature and chance of precip tables are all messed up and/or empty ..

So I guess theire is a more logical place to put in the "translator" without it messing up the rest ...

Offline doornenburgweer

  • Posts: 309
  • Intel D945SGLF 1 G, XP, VantagePro 2
  • Doornenburg, The Netherlands
    • Doornenburg weer
Re: WxSim Online Forecast Display language translation
« Reply #9 on: March 22, 2007, 03:32:25 PM »
o yes I forget: you have to translate the last words in the other data textfile,

sorry for that.

success,

gerard

Offline doornenburgweer

  • Posts: 309
  • Intel D945SGLF 1 G, XP, VantagePro 2
  • Doornenburg, The Netherlands
    • Doornenburg weer
Re: WxSim Online Forecast Display language translation
« Reply #10 on: March 22, 2007, 04:37:50 PM »
Oh yes I forgot, see here the modified wxtypedata file:
severe!tornado-d!tornado-n!Zware storm
showers and thunder!showersstorms-d!showersstorms-n!Regen storm
thunder!thunderstorm-d!thunderstorm-n!Onweer
rain and sleet!rainsleet-d!rainsleet-n!Natte sneeuw
freezing rain and snow!freezingrainsnow-d!freezingrainsnow-n!Ijzel/sneeuw
rain and snow!rainsnow-d!rainsnow-n!Sneeuwregen
freezing rain!freezingrain!freezingrain!Ijzel
rain!rain-d!rain-n!Regen
mix!freezingrainsnow-d!freezingrainsnow-n!Ijzel/sneeuw
sleet!sleet-d!sleet-n!Natte sneeuw
snow!snow-d!snow-n!Sneeuw
fog!fog-d!fog-n!Mist
partly cloudy!partlycloudy-d!partlycloudy-n!Gedeeltelijk bewolkt
mostly cloudy!mostlycloudy-d!mostlycloudy-n!Overwegend bewolkt
cloudy!cloudy-d!cloudy-n!Bewolkt
overcast!cloudy-d!cloudy-n!Bewolkt
partly sunny!partlysunny-d!partlysunny-n!Gedeeltelijk zonnig
mostly sunny!mostlysunny-d!mostlysunny-n!Overwegend zonnig
mostly clear!mostlysunny-d!mostlyclear-n!Overwegend helder
sunny!sunny-d!sunny-n!Zonnig
clear!sunny-d!clear-n!Helder
fair!fair-d!fair-n!Stapelwolken
cloud!variableclouds-d!variableclouds-n!Half bewolkt
wind chill down to -!verycold!verycold!Erg koud
heat ind!hot!hot!Erg warm
severe!tornado-d!tornado-n!Zware storm
buien en onweer!showersstorms-d!showersstorms-n!Regen storm
onweer!thunderstorm-d!thunderstorm-n!Onweer
natte sneeuw!rainsleet-d!rainsleet-n!Natte sneeuw
ijzel en sneeuw!freezingrainsnow-d!freezingrainsnow-n!Ijzel/sneeuw
sneeuwregen!rainsnow-d!rainsnow-n!Sneeuwregen
ijzel!freezingrain!freezingrain!Ijzel
regen!rain-d!rain-n!Regen
ijzel/sneeuw mix!freezingrainsnow-d!freezingrainsnow-n!Ijzel/sneeuw
natte nseeuw!sleet-d!sleet-n!Natte sneeuw
sneeuw!snow-d!snow-n!Sneeuw
mist!fog-d!fog-n!Mist
gedeeltelijk bewolkt!partlycloudy-d!partlycloudy-n!Gedeeltelijk bewolkt
overwegend bewolkt!mostlycloudy-d!mostlycloudy-n!Overwegend bewolkt
bewolkt!cloudy-d!cloudy-n!Bewolkt
dichte bewolking!cloudy-d!cloudy-n!Dichte bewolking
gedeeltelijk zonnig!partlysunny-d!partlysunny-n!Gedeeltelijk zonnig
overwegend zonnig!mostlysunny-d!mostlysunny-n!Overwegend zonnig
overwegend helder!mostlysunny-d!mostlyclear-n!Overwegend helder
zonnig!sunny-d!sunny-n!Zonnig
helder!sunny-d!clear-n!Helder
fair!fair-d!fair-n!Stapelwolken
cloud!variableclouds-d!variableclouds-n!Half bewolkt
wind chill down to -!verycold!verycold!Erg koud
heat ind!hot!hot!Erg warm


Offline doornenburgweer

  • Posts: 309
  • Intel D945SGLF 1 G, XP, VantagePro 2
  • Doornenburg, The Netherlands
    • Doornenburg weer
Re: WxSim Online Forecast Display language translation
« Reply #11 on: March 23, 2007, 06:12:06 AM »
hi, it was already a long time ago I made this, see here the whole changed wdsoft.txt. Now I see I changed more, not so strange because it took me some evenings. when I have more time, I think I would do it different: translate after all the calculations are done.
But as I told you I am not the programmer, I just like to show the forecast in Dutch.



regards,

gerard



<?php
require("config.php");

# CREDIT - DO NOT REMOVE WITHOUT PERMISSION
# WX-SIM Online Forecast Display
# VERSION 1.16
# Author:         Jordan Gerth
# Last modified:  01/05/2007
# Dutch translation by Gerard van 't Klooster
# last modified 03/21/2007
# Documentation:  http://www.wiscwx.com/jordan/wsofd/index.html
# If you find this script useful, please consider a donation.
#####################################
?>

<?php
$ptf = @fopen( $slplaintxt, "r" ) or die("Error opening the plain text forecast.  It may not exist or does not have read permissions.");
$wdt = @fopen( $slwxtypdat, "r" ) or die("Error opening the weather type file.  It may not exist or does not have read permissions.");
$prc = @fopen( $slprecipam, "r" ) or die("Error opening the fallen precip file.  It may not exist or does not have read permissions.");

while (!feof($ptf)) {
   $tfc .= fgets($ptf, 1024);
}
fclose($ptf);

$txtforecast = str_replace("\r", "\n", str_replace("\r\n", "\n", $tfc));
$header = substr($txtforecast, 0, strpos($txtforecast, "\n "));

$header = str_replace( 'WXSIM text forecast for Doornenburg, initialized at', 'WXSIM tekst voorspelling voor Doornenburg weerstation, gemaakt op', $header);
 


$cstrst = substr($txtforecast, strpos($txtforecast, "__\n \n ") + 6);
$endtxt = strpos($cstrst, "\n * T");
$cstbdy = substr($cstrst, 0, $endtxt - 2);
if ($endtxt !== false) {
   $footer = substr($cstrst, $endtxt + 2);
} else {
   $footer = "Deze voorspelling is gemaakt met plaatselijke informatie en kan afwijken van de werkelijkheid.";
}
$castpd = explode("\n \n ", $cstbdy);

while (!feof($wdt)) {
   $wxls .= fgets($wdt, 1024);
}
fclose($wdt);

$eachtype = explode("\n", $wxls);
for ($j=0; $j<count($eachtype); $j++) {
 $oneline = explode("!", $eachtype[$j]);
 $wxtype[$j] = $oneline[0];
 if (strlen($oneline[0]) < 2) {
  $oneline[0] = " ";
 }
 if (strlen($oneline[1]) < 2) {
  $oneline[1] = "na";
 }
 $wxfldy[$j] = $oneline[1];
 if (strlen($oneline[2]) < 2) {
  $oneline[2] = "na";
 }
 $wxflnt[$j] = $oneline[2];
 $wxflwd[$j] = $oneline[3];
}

while (!feof($prc)) {
   $amln .= fgets($prc, 1024);
}
fclose($prc);

$eachamnt = explode("\n", $amln);
for ($p=0; $p<count($eachamnt); $p++) {
 $pamount = explode("!", $eachamnt[$p]);
 $pamfind[$p] = $pamount[0];
 $pamshow[$p] = $pamount[1];
}

$kcounter = 0;
for ($k=0; $k<count($castpd); $k++) {

$spltcln = explode(":", $castpd[$k]);
$pdname = str_replace(' night', ' Night', $spltcln[0]);
$pdname = str_replace(' afternoon', ' Afternoon', $spltcln[0]);
$pdverb = str_replace("\n", "", $spltcln[1]);

$pdverb = str_replace('Cloudy in the morning', 'Bewolkt in de morgen', $pdverb);
$pdverb = str_replace('becoming', 'overgaand in ', $pdverb);
$pdverb = str_replace('dense overcast', 'dichte bewolking', $pdverb);
$pdverb = str_replace('then', 'dan', $pdverb);
$pdverb = str_replace('the', 'de', $pdverb);
$pdverb = str_replace('afternoon', 'middag', $pdverb);
$pdverb = str_replace('cloudy', 'bewolkt', $pdverb);
$pdverb = str_replace('Patchy', 'Gedeeltelijk', $pdverb);
$pdverb = str_replace('slight', 'kleine', $pdverb);
$pdverb = str_replace('light', 'lichte', $pdverb);
$pdverb = str_replace('fog', 'mist', $pdverb);
$pdverb = str_replace('Partly', 'Gedeeltelijk', $pdverb);
$pdverb = str_replace('to', 'tot', $pdverb);
$pdverb = str_replace('gusting', 'windvlagen', $pdverb);
$pdverb = str_replace('mostly', 'overwegend', $pdverb);
$pdverb = str_replace('after', 'na', $pdverb);
$pdverb = str_replace('midnight', 'middernacht', $pdverb);
$pdverb = str_replace('morning', 'morgen', $pdverb);
$pdverb = str_replace('Mostly', 'Overwegend', $pdverb);
$pdverb = str_replace('partly', 'gedeeltelijk', $pdverb);
$pdverb = str_replace('Light', 'Lichte', $pdverb);
$pdverb = str_replace('moderate', 'matige', $pdverb);
$pdverb = str_replace('evening', 'avond', $pdverb);
$pdverb = str_replace('Dense', 'Dichte', $pdverb);
$pdverb = str_replace('overcast', 'bewolking', $pdverb);
$pdverb = str_replace('Moderate', 'Matige', $pdverb);
$pdverb = str_replace('dense', 'dichte', $pdverb);
$pdverb = str_replace('sunny', 'zonnig', $pdverb);
$pdverb = str_replace('Rain likely', 'Grote kans op regen', $pdverb);
$pdverb = str_replace('rain', 'regen', $pdverb);
$pdverb = str_replace('A', 'Een', $pdverb);
$pdverb = str_replace('chance of', 'kans op', $pdverb);
$pdverb = str_replace('High', 'Maximum:', $pdverb);
$pdverb = str_replace('Low', 'Minimum :', $pdverb);
$pdverb = str_replace('but', 'maar', $pdverb);
$pdverb = str_replace('temperatures falling', 'temperatuur daalt', $pdverb);
$pdverb = str_replace('temperatures rising', 'temperatuur stijgt', $pdverb);
$pdverb = str_replace('north', 'noord', $pdverb);
$pdverb = str_replace('nordeast', 'noordoost', $pdverb);
$pdverb = str_replace('east-', 'oost-', $pdverb);
$pdverb = str_replace('down ', 'daalt ', $pdverb);
$pdverb = str_replace('or ', 'of ', $pdverb);
$pdverb = str_replace('east ', 'oost ', $pdverb);
$pdverb = str_replace('southeast', 'zuidoost', $pdverb);
$pdverb = str_replace('southwest', 'zuidwest', $pdverb);
$pdverb = str_replace('south ', 'zuid ', $pdverb);
$pdverb = str_replace('south-', 'zuid-', $pdverb);
$pdverb = str_replace('around', 'rond', $pdverb);
$pdverb = str_replace('kph', 'km/uur', $pdverb);
$pdverb = str_replace('Chance of precipitation', 'Kans op neerslag', $pdverb);
$pdverb = str_replace('near', 'bijna', $pdverb);
$pdverb = str_replace('percent', 'procent', $pdverb);
$pdverb = str_replace('less than', 'minder dan', $pdverb);
$pdverb = str_replace('snow', 'sneeuw', $pdverb);
$pdverb = str_replace('Precipitation (liquid equivalent)', 'Neerslag (gesmolten)', $pdverb);
$pdverb = str_replace('between', 'tussen', $pdverb);
$pdverb = str_replace('and', 'en', $pdverb);
$pdverb = str_replace('Precipitation', 'Neerslag', $pdverb);
$pdverb = str_replace('accumulation expected', 'ophoping verwacht', $pdverb);
$pdverb = str_replace('Little', 'Weinig', $pdverb);
$pdverb = str_replace('no ', 'geen ', $pdverb);
$pdverb = str_replace('snow ', 'sneeuw ', $pdverb);
$pdverb = str_replace('Snow accumulation', 'Sneeuw ophoping ', $pdverb);
$pdverb = str_replace('about', 'ongeveer', $pdverb);
$pdverb = str_replace('one', '1', $pdverb);
$pdverb = str_replace('overgaen', 'overgaand', $pdverb);
$pdverb = str_replace('soudoost', 'zuidoost', $pdverb);
$pdverb = str_replace('showery of intermittent', 'afwisselend droog met buien', $pdverb);
$pdverb = str_replace('No ', 'Geen ', $pdverb);
$pdverb = str_replace('Fair ', 'Bijna geen bewolking ', $pdverb);
$pdverb = str_replace('Cloudy', 'Bewolkt', $pdverb);
$pdverb = str_replace('calm', 'kalm', $pdverb);
$pdverb = str_replace('Clear', 'Helder', $pdverb);
$pdverb = str_replace('clear', 'helder', $pdverb);
$pdverb = str_replace('Sunny', 'Zonnig', $pdverb);
$pdverb = str_replace('dan a', 'dan een', $pdverb);
$pdverb = str_replace('ice', 'ijs', $pdverb);
$pdverb = str_replace('freezing', 'bevriezende', $pdverb);
$pdverb = str_replace('sleet', 'natte sneeuw', $pdverb);
$pdverb = str_replace('a mix of', 'een mix van', $pdverb);
$pdverb = str_replace('if any', 'tot geen', $pdverb);
$pdverb = str_replace('on ground', 'op de grond', $pdverb);
$pdverb = str_replace('patchy', 'gedeeltelijk', $pdverb);
$pdverb = str_replace('Thunderstotrms likely, some possibly severe.', 'Kans op (zware) onweersbuien.', $pdverb);
$pdverb = str_replace('Some thunder possible.', 'Kans op onweer. ', $pdverb);
$pdverb = str_replace('Some thunderstotrms likely', 'Kans op onweersbuien ', $pdverb);



$lwrpdvb = strtolower($pdverb);
#
# TRANSLATION DAYS IN DUTCH
# WX-SIM Online Forecast Display
# VERSION 1.12, revision A
# Author:         Jordan Gerth
#

$pdname = str_replace('Sunday', 'Zondag', $pdname);
$pdname = str_replace('Monday', 'Maandag', $pdname);
$pdname = str_replace('Tuesday', 'Dinsdag', $pdname);
$pdname = str_replace('Wednesday', 'Woensdag', $pdname);
$pdname = str_replace('Thursday', 'Donderdag', $pdname);
$pdname = str_replace('Friday', 'Vrijdag', $pdname);
$pdname = str_replace('Saturday', 'Zaterdag', $pdname);
$pdname = str_replace('Today', 'Vandaag', $pdname);
$pdname = str_replace('Tonight', 'Vannacht', $pdname);
$pdname = str_replace('afternoon', 'vanmiddag', $pdname);
$pdname = str_replace('night', 'nacht', $pdname);


if (strlen($pdname) < 2) {
   break;
}

$daypd = 0;
$gtpos = strpos($pdname, 'acht');
if ($gtpos === false) {
   $daypd = 1;
}

$trenda = "";
$hghpos = strpos($pdverb, 'Maximum:');
if ($hghpos === false) {
   $lowpos = strpos($pdverb, 'Minimum : ');
   $maxmin = substr($pdverb, $lowpos + 10, strpos($pdverb, '. ', $lowpos) - $lowpos - 10);
} else {
   $maxmin = substr($pdverb, $hghpos + 9, strpos($pdverb, '. ', $hghpos) - $hghpos - 9);
}
if (strlen($maxmin) > 4) {
 if ($hghpos === false) {
   $maxmin = substr($pdverb, $lowpos + 10, strpos($pdverb, ', maar ', $lowpos) - $lowpos - 10);
   $fllpos = strpos($pdverb, 'temperatuur stijgt');
   if ($fllpos !== false) {
    $trenda = "\n".'<img src="'.$imglnkloc.'rising.gif" width="15" height="15" alt="Rising">';
   }
 } else {
   $maxmin = substr($pdverb, $hghpos + 9, strpos($pdverb, ', maar ', $hghpos) - $hghpos - 9);
   $fllpos = strpos($pdverb, 'temperatuur daalt');
   if ($fllpos !== false) {
    $trenda = "\n".'<img src="'.$imglnkloc.'falling.gif" width="15" height="15" alt="Falling">';
   }
 }
}

$pcppos = strpos($pdverb, 'Kans op neerslag ');
if ($pcppos === false) {
# hier zit nog ergens een grote fout
  $percntg = 0;
   $pladd = "";
} else {
   $percntg = str_replace("bijna 100", "100", str_replace("minder dan", "&lt;", substr($pdverb, $pcppos + 17, strpos($pdverb, 'procent', $pcppos) - $pcppos - 17)));
   #dmprca = count($pamfind);
    #$ppnum = 0;
    #while ($ppnum < $dmprca) {
    # $pppos = strpos($lwrpdvb, strtolower($pamfind[$ppnum]));
     #if ($pppos === false) {
      # $ppnum++;
    # } else {
    #   break;
    # }
    #}
   # $pladd = '<br><small>'.$pamshow[$ppnum].'</small>';
   # if (strlen($pladd) < 11) {
    # $pladd = "";
   # }
  # } else {
  #  $pladd = "";
   #}
}

$lkpos = strpos($lwrpdvb, "waarschijnlijk");
$chpos = strpos($lwrpdvb, "kans op");

$dmwxty = count($wxtype);
$wxnum = 0;
while ($wxnum < $dmwxty) {
 $wxpos = strpos($lwrpdvb, strtolower($wxtype[$wxnum]));
 if ($wxpos === false) {
   $wxnum++;
 } else {
   break;
 }
}

$cellwidth = $imgwidth + 10;

$daytitle[$k]="\n";
$daytitle[$k].='<td bgcolor="'.$pdbgdclr.'" width="'.$cellwidth.'" align="center"><b><font face="'.$fontface.'" color="'.$pdtxtclr.'" size="-1">';
$daytitle[$k].=$pdname;
$daytitle[$k].='</font></b></td>';
$daypictu[$k]="\n";
$daypictu[$k].='<td bgcolor="'.$imgbackg.'" width="'.$cellwidth.'" align="center">';
if ($daypd == '0') {
$daypictu[$k].='<img src="'.$imglnkloc.$wxflnt[$wxnum].$imglnktyp.'" width="'.$imgwidth.'" height="'.$imgheight.'" alt="'.$wxflwd[$wxnum].'">';
} else {
$daypictu[$k].='<img src="'.$imglnkloc.$wxfldy[$wxnum].$imglnktyp.'" width="'.$imgwidth.'" height="'.$imgheight.'" alt="'.$wxflwd[$wxnum].'">';
};
$daypictu[$k].='</td>';
if ($lkpos !== false) {
$dayverbi[$k]=$wxflwd[$wxnum].' waarschijnlijk';
} elseif ($chpos !== false) {
$dayverbi[$k]='Kans op '.$wxflwd[$wxnum];
} else {
$dayverbi[$k]=$wxflwd[$wxnum];
}
$daytempr[$k]="\n";
if ($daypd == '0') {
 $daytempr[$k].='<td bgcolor="'.$lowcolor.'" width="'.$cellwidth.'" align="center">';
} else {
 $daytempr[$k].='<td bgcolor="'.$hghcolor.'" width="'.$cellwidth.'" align="center">';
};
$daytempr[$k].='<font face="'.$fontface.'" color="'.$fontcolr.'" size="+1">';
$daytempr[$k].=$maxmin.'&deg;'.$trenda;
$daytempr[$k].='</font></td>';
$dayprecp[$k]="\n";
$dayprecp[$k].='<td bgcolor="'.$pcpcolor.'" width="'.$cellwidth.'" align="center"><font face="'.$fontface.'" size="+1">';
if ($percntg >= $boldpcp) {
 $dayprecp[$k].='<b>';
}
$dayprecp[$k].=$percntg.'%';
if ($percntg >= $boldpcp) {
 $dayprecp[$k].='</b>';
}
$dayprecp[$k].=$pladd;
$dayprecp[$k].='</font></td>';
$dayreman[$k]="\n";
$dayreman[$k].='<td bgcolor="'.$verbibgd.'" width="'.$verbiwid.'"><font face="'.$fontface.'" color="'.$fontcolr.'" size="-1">';
$dayreman[$k].=$pdverb;
$dayreman[$k].='</font></td>';

$kcounter = $k;
}

if ($horizmax > $kcounter) {
 $horizmax = $kcounter;
}

$htbwidth = ($horizmax * (($imgwidth + 10) + 2)) + 2;
$vrtwidth = (($imgwidth + 10) * 4) + 12 + $verbiwid;
?>

Offline MD5

  • Posts: 161
  • Pieve Ligure - Italy
    • PLMeteo.Info Weather Station
Re: WxSim Online Forecast Display language translation
« Reply #12 on: March 23, 2007, 08:34:01 PM »
Gerard, thanks again for posting the modified code, I'm now trying to figure how to run it while waiting that Tom end Wx-Sim customization for my station.

I grabbed the latest Jordan files Version 1.51 - FINAL

To allow language translation I need to replace the file wsofd.php with Gerard supplied code modified to suit the language I need (Italian in my case)

I'm a little confused about the file wxtypedata.txt (see below) because is shorter than the one supplied by Gerard  and the structure is a little strange, I think I must translate each word leaving unchanged -n, for example rain-d will be translated in pioggia-d, could somone of you confirm please ?

Thanks!

Mario

severe!tornado-d!tornado-n!Severe storm
showery or intermittent. Some thunder!showersstorms-d!showersstorms-n!Showers storms
thunder!thunderstorm-d!thunderstorm-n!Thunder storm
rain and sleet!rainsleet-d!rainsleet-n!Rain Sleet
freezing rain and snow!freezingrainsnow-d!freezingrainsnow-n!FrzgRn Snow
rain and snow!rainsnow-d!rainsnow-n!Rain and Snow
freezing rain!freezingrain!freezingrain!Freezing Rain
rain!rain-d!rain-n!Rain
mix!freezingrainsnow-d!freezingrainsnow-n!Mix
sleet!sleet-d!sleet-n!Sleet
snow!snow-d!snow-n!Snow
fog!fog-d!fog-n!Fog
wind chill down to -!verycold!verycold!Very Cold
heat index up to 1!hot!hot!Very Hot
precip!rainsnow-d!rainsnow-n!Precip
partly cloudy!partlycloudy-d!partlycloudy-n!Partly Cloudy
mostly cloudy!mostlycloudy-d!mostlycloudy-n!Mostly Cloudy
cloudy!cloudy-d!cloudy-n!Cloudy
overcast!cloudy-d!cloudy-n!Cloudy
partly sunny!partlysunny-d!partlysunny-n!Partly Sunny
mostly sunny!mostlysunny-d!mostlyclear-n!Mostly Sunny
mostly clear!mostlysunny-d!mostlyclear-n!Mostly Clear
sunny!sunny-d!clear-n!Sunny
clear!sunny-d!clear-n!Clear
fair!fair-d!fair-n!Fair
cloud!variableclouds-d!variableclouds-n!Variable Clouds

Offline jwwd

  • WML testers
  • Posts: 3,692
  • Silkeborg, Denmark (56:10:58 N-09:30:26 E) - Elevation 75,35 meters
    • Weather at Silkeborg, Denmark
Re: WxSim Online Forecast Display language translation
« Reply #13 on: March 23, 2007, 08:55:03 PM »
Hi

Im not sure if Gerards modification of the wsofd.php is working ok with Jordans version 1.51

When I tried to use the modificaion together with ver. 1.51 the forecast pics were wrong.

Offline MD5

  • Posts: 161
  • Pieve Ligure - Italy
    • PLMeteo.Info Weather Station
Re: WxSim Online Forecast Display language translation
« Reply #14 on: March 23, 2007, 09:06:31 PM »
Thanks for your advice.