Page 1 of 1

DarkSky forecast script - multilingual for standalone/Saratoga templates

Posted: Sat 17 Nov 2018 12:03 am
by saratogaWX
Given that WeatherUnderground has announced shutoff of the WU API on 31-Dec-2018, I thought it prudent to locate another source for forecasts that still offers free (low volume) access, is multilingual, and international coverage. DarkSky.net fits that with some caveats:

1) forecasts are for 8 days (including today) and day-only forecasts are available (no night-time specific forecasts), but high/low expected temperatures are included for each day.

2) The DarkSky text forecast is quite terse (more like an icon description), so the script 'fleshes out' the text forecast a bit by adding High/Low temperatures, Chance of Precipitation (if>0%), Wind direction, speed->gust, and UV index to the text.
Because of the latter additions, for internationalization there is a required DS-forecast-lang.php which includes a encoded lookup array for day names+some weather terms in each supported language. All languages supported in the current Saratoga templates are covered (af,bg,cs,ct,de,dk,el,en,es,fi,fr,he,hu,it,nl,no,pl,pt,ro,se,si,sk).

The DS-forecast.php script is for standalone or Saratoga-template usage, and can output the text in either UTF-8 or the ISO-8859-n languages used in the Saratoga templates.

I'll be doing some work to replace WU-forecast.php with DS-forecast.php in the Base-World template set soon.

You'll find the docs/downloads/demo at the scripts page https://saratoga-weather.org/scripts-DSforecast.php
and a Demo page at https://saratoga-weather.org/DS-forecast-demo.php

Enjoy!

Re: DarkSky forecast script - multilingual for standalone/Saratoga templates

Posted: Sat 17 Nov 2018 11:31 pm
by Mapantz
Fantastic work you've done there, Ken.

I like the fact I am able to have °C and mph together.

Great stuff! :)