Page 14 of 54
Re: Now available: AJAX/PHP multilingual website templates
Posted: Sat 12 Mar 2011 1:03 am
by actioman
saratogaWX wrote:Sure, it's possible for the WU forecast since it's 'English' is quite simple and predictable like the WXSIM forecast, so fairly easy to parse and do substitutions like with the plaintext-parser for WXSIM.
For the EC, it's a bit more difficult as their words/phrases are not always constructed in the simple manner that the WU forecast is done. For the NWS forecast, it is unlikely, as the wording of the text forecasts is highly nuanced and regional. Currently, the only other language offered by the NWS is Spanish, so that language could be offered I suppose with a minor tweak to the code.
I'd tried to rely on WU, and EC for their own translations .. the EC does a good job (IMHO) of providing forecasts in the dual languages official in Canada, so I'd just leveraged it to simplify the script. WU had done many translations (probably mechanically based) and except for converting from UTF-8 to the desired character set, no other work was needed (and I like saving effort). However... WU's translations leave much to be desired in some languages with their choice of vastly looonnnngggg words (instead of abbreviations) for some terms, which necessitated the 2x5 icon instead of the 1x10 icon presentations.
I'll look at trying a WU-forecast script that uses the english forecast and the plaintext-parser-lang-LL.txt files to do the translations
Best regards,
Ken
This would be very good certainly! And yes it's true, as you say "WU's translations leave much to be desired in some languages with their choice of vastly looonnnngggg words (instead of abbreviations) for some terms". As the example I showed before: "Mostly Cloudly" in a bad portuguese translation "Predominantemente Nublado". A better one "Muito Nublado" And thats all. They complicate the simple things.
Why the temperature value is without decimals in the top of the home page? Is there any simple whay to change this?
Best Regards,
Manuel
Re: Now available: AJAX/PHP multilingual website templates
Posted: Sat 12 Mar 2011 5:56 am
by saratogaWX
Sadly, no good way to get additional precision in the forecast numbers .. they only use integer numbers in either Centigrade or Fahrenheit. Given the forecast is largely done via modeling, that's probably all the precision that is meaningful (with integer degrees).
Re: Now available: AJAX/PHP multilingual website templates
Posted: Sat 12 Mar 2011 1:41 pm
by gemini06720
Thank you Ken, for your reply.
I did not really want the 'ec-forecast.php' script to be 'converted' to the 'plaintext-parser.php' script format - for the time being, Canada has only two official languages ... althought that might eventually change in some areas of the country...

Re: Now available: AJAX/PHP multilingual website templates
Posted: Mon 14 Mar 2011 12:28 am
by n9mfk
Hi ken,
what the best way to get the url for the Point Forecast
tried from here
http://www.crh.noaa.gov/ilx/
but that gives odd url like
http://forecast.weather.gov/MapClick.ph ... mx=1&zmy=1
thanks Beau
Re: Now available: AJAX/PHP multilingual website templates
Posted: Mon 14 Mar 2011 3:17 am
by saratogaWX
The best way to find the URL to use is:
1) go to
www.weather.gov
2) search for your city, and when the forecast page comes up,
3) look at the right hand side near the bottom of the page for the 'printable forecast' link
4) right-click on that link and copy the URL to the clipboard .. that's the link you should use for the point-printable forecast
5) just a bit up from the 'printable forecast' link is the "Zone area forecast for ..." link, place your mouse over that, and the status bar on your browser will show a link like
http://forecast.weather.gov/MapClick.ph ... =[b]CAZ513[/b] and you can use the zoneid= value as your forecast Zone.
Repeat 2-5 for each city you want to offer.
Edit your Base-USA settings.php to add something like my example
Code: Select all
$SITE['NWSforecasts'] = array( // for the advforecast2.php V3.xx version script
// use "Zone|Location|Point-printableURL", as entries .. first one will be the default forecast.
"CAZ513|Saratoga|http://forecast.weather.gov/MapClick.php?CityName=Saratoga&state=CA&site=MTR&textField1=37.2639&textField2=-122.022&e=1&TextType=2",
"CAZ513|Los Gatos|http://forecast.weather.gov/MapClick.php?CityName=Los+Gatos&state=CA&site=MTR&textField1=37.2267&textField2=-121.974&e=0&TextType=2",
"CAZ513|Cupertino|http://forecast.weather.gov/MapClick.php?CityName=Cupertino&state=CA&site=MTR&textField1=37.3231&textField2=-122.031&e=0&TextType=2",
"CAZ513|Sunnyvale|http://forecast.weather.gov/MapClick.php?CityName=Sunnyvale&state=CA&site=MTR&textField1=37.3689&textField2=-122.035&e=0&TextType=2",
"CAZ513|Santa Clara|http://forecast.weather.gov/MapClick.php?CityName=Santa+Clara&state=CA&site=MTR&textField1=37.3542&textField2=-121.954&e=0&TextType=2",
"CAZ513|San Jose|http://forecast.weather.gov/MapClick.php?CityName=San+Jose&state=CA&site=MTR&textField1=37.3394&textField2=-121.894&e=0&TextType=2",
"CAZ508|Mountain View|http://forecast.weather.gov/MapClick.php?CityName=Mountain+View&state=CA&site=MTR&textField1=37.3861&textField2=-122.083&TextType=2",
"CAZ529|Santa Cruz|http://forecast.weather.gov/MapClick.php?CityName=Santa+Cruz&state=CA&site=MTR&textField1=36.9742&textField2=-122.03&e=0&TextType=2",
"CAZ006|San Francisco|http://forecast.weather.gov/MapClick.php?CityName=San+Francisco&state=CA&site=MTR&textField1=37.775&textField2=-122.418&e=0&TextType=2",
);
for the advforecast2.php V3.00 script to use.
Best regards,
Ken
Re: Now available: AJAX/PHP multilingual website templates
Posted: Mon 14 Mar 2011 9:50 pm
by PaulMy
Hi Ken,
I have added David's (daj) Yearly Data Summary to my site and asked the following in the "embedding Yearly Data Summary into exitsing site" thread.
I have this working ok in my
http://www.komokaweather.com/weather/datasummary.php page. As well in my AJAX/PHP template page
http://www.komokaweather.com/wxrecords.php but would instead like to have it in the 'Almanac' flyout-menu maintaining the AJAX/PHP heading and side menu but it is not displaying properly. I am uploading the dayfile.txt to my Godaddy remote site root/weather folder and have edited readDayfile.php this way. The datasummary.css and .php, readDayfile.php and dayfile.txt are all now in both the remote root and root/weather - I have been experimenting to make this work but without success. What have I done wrong?
I have edited the wxnewpage.php file in your template set and renamed wxhistorical.php. While David is not up to speed with my specific setup he did provide some suggestion, but in trying that it was not successful. Can you give any suggestions?
Paul
Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 12:56 am
by PaulMy
Hi Ken,
David has given futher suggestion and it is now working.
Thanks,
Paul
Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 1:18 am
by actioman
Hello people!
Here I am again with my dummie questions...
How to put in my index page a warning advisory, like Paul's have in his
website? Is something exclusive for the US and Canada templates or it is possible to customise in the world templates?
I only can see my weather advisories in this link of my website:
http://meteoelvas.com/wxadvisory.php. And another question, is this page possible to translate like the other ones in the template? Because is only in english. And speaking of translations, I am also testing with sucess the spaceweather page and the secure contact form from Mike Challis, like you can see here:
SpaceWeather Page:
http://www.meteoelvas.com/wxspace.php
Secure Contact Form Page:
http://www.meteoelvas.com/contact.php
It is possible to use the automatic translation of this template with this pages too?
Thak you all again for reading my questions and for the help!

Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 3:05 am
by gemini06720
actioman wrote:How to put in my index page a warning advisory ... Is something exclusive for the US and Canada templates or it is possible to customise in the world templates?
Manuel, the advisory (weather watch, warning or advisory) page you see on Paul's site is produced by the 'ec-canada.php' script (canadian templates) using data from Environment Canada (the canadian government weather services) - the 'advforecast2.php' script will produce similar warnings for the USA templates using data from the National Weather Service (the US government weather services) - the 'get-meteoalarm-warning-inc.php' script seems designed to offer warnings for the world templates using data from Meteoalarm (I have not tried the script nor looked into the code to find out what king of warnings are produced by the script).
actioman wrote:...is this page possible to translate like the other ones in the template...
The english text for the advisory page can certainly be translated, but you will have to do the translation yourself as the english texts have not been provided with translation functions nor an external language file.
The scripts for the pages you are pointing to (space weather observations, contact form, etc.) have been written in english with no built in facility to translate the texts - I have not bothered to add the translation functions in my space weather page - I have added the translation functions into my highly customised/modified contact page (with external language files).
Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 3:10 am
by gemini06720
PaulMy wrote:David has given futher suggestion and it is now working.
Paul, were you planning to incorporate David's 'Yearly Data Summary' into a template such as this (still incomplete)
Annual Weather Data Summary page?
Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 3:57 am
by PaulMy
Ray,
Yes, it is working but working on it/learning to get it correct...
http://www.komokaweather.com/wxhistorical.php
Paul
Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 9:15 am
by kinder
Any guess why the next update time shows always next update at 2:01?
Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 11:21 am
by actioman
gemini06720 wrote:PaulMy wrote:David has given futher suggestion and it is now working.
Paul, were you planning to incorporate David's 'Yearly Data Summary' into a template such as this (still incomplete)
Annual Weather Data Summary page?
Ray, great weather website you have there! And I was amazed when I see this page:
http://70.67.42.236/canada/wxcudata.php!
Great work of synthesis! You have all the data there!
It would be possible, if you do not mind of course, to share the php page code (I suppose it is a great work with the cumulus tags...) so I put one on my website?
Thank you very much, again!

Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 11:42 am
by gemini06720
kinder wrote:Any guess why the next update time shows always next update at 2:01?
Just noticed that on my main page...
I checked the value of the variable '$timeofnextupdate' - it seems to always give me 16:10, no matter what time the next update should be.
I then checked how the the variable '$timeofnextupdate' was calculated/created (in the 'CU-defs.php' script):
Code: Select all
$timeofnextupdate = date('H:i',strtotime($date.' '.$time)+$WX['interval']*60);
It first converts (parse) the current date and the current time into a Unix timestamp and then adds the time interval (in minutes, as setup in Cumulus) multiplied by 60 (so the time interval is really in seconds).
But, for some reasons, the PHP function 'strtotime' refuses to convert (parse) the date in this format '15/03/2011' !
So, what I have done to eliminate the error (or lack of proper data) was to add the following line directly into my 'ajax-dashboard.php' script, just before the start of the display of the weather data:
Code: Select all
$timeofnextupdate = date('H:i',strtotime($time)+$WX['interval']*60);
I do not know why it is happening ... Ken is probably the only one that will be able to provide an explanation...
Re: Now available: AJAX/PHP multilingual website templates
Posted: Tue 15 Mar 2011 11:50 am
by gemini06720
actioman wrote: It would be possible, if you do not mind of course, to share the php page code (I suppose it is a great work with the cumulus tags...) so I put one on my website?
Manuel, let me check the template to make sure I have the translation functions for all the terms/words used on the page - I will then produce an external english-to-english template where you will be able to translate the terms/words used on the page. If you do not hear/read from me in a couple of day, please remind me ... short term memory is not as good as it used to be when I was in my twenties...
