The GeekTool Weather and Forecast script has been updated to handle multiple languages and with a system that allows for more languages to be added easily. It comes with Spanish, German, Dutch, Japanese and French.
It uses two files now, the main script and a localized file, both in the same folder. You can maintain as many localized settings as you need, and only change the name of the file to load in the main script. Each localized file has its own copy of the main settings that will override what’s in the primary config.
Just download the package below and put it all in a folder to be referenced from GeekTool. There are sample Geeklet files included, just modify the path to match yours. Then edit the main script (
weatherparser.rb) to set a localization file, and edit your settings in that localization file. If you remove the localization file load from the main script, it will function as it used to.
Translator credits for localizations include:
- Japanese: Brandon Pittman
- French: Guillaume Kuster
- Dutch: Bart Tilburgs
- Spanish: Pedro G
- German: Nils Fischer
- Italian: Daniela Gallazzi
- Sweden: Robin Dorand
- Polish: Joanna Kamrowska & Sebastian Szwac
- Norwegian: Helge Rosseboe
To edit a localization file, copy the main
weather_localization.rb to a new file with a country code extension (e.g. “weather_localization_de.rb”). Then edit the empty strings in the file and optionally change the time format in the last function. Any strings left blank will default to the original English translation.
If you build a new translation file, please send it to me for inclusion in the package. Include your name and a link for attribution.
There are a couple of other things you could add to this script. I didn’t build them in, but if you (or someone you know) knows just a little Ruby, it would be easy to implement them.
You could use command line arguments to set the localization file used. That file contains its own configuration settings, so by adding just one command line argument that tells it which file to use, each Geeklet could have a different city, langauge and additional configuration. You can duplicate the same localization file multiple times to get multiple cities without changing languages, as long as the function sets the proper file. You could also just hardcode an array of locations for the $mycity variable and select them via the argument.
With a little creative effort, you can make switching between locations automatic. Once you’ve set up the various localized settings files, use a function such as Jay posted to dynamically set the localization_file variable. The method he uses also returns a CountryAbbreviation field that you can use to load files ending with _EN, _DE, etc. Then reset the $mycity value immediately after the localization file loads in the main script.
Hopefully that makes sense. I didn’t build this feature in because there are too many variables in the way people would use it, but hopefully someone will pick it up and provide options for that kind of feature.
You can replace any of the PNG files in the zip with your own, and the PSD and AI files for the current set can be downloaded here.
Localized GeekTool Weather and Forecast v1.3
Get the weather and forecast on your desktop in multiple languages. Includes French, German, Dutch, Italian, Norwegian, Swedish, Polish, Spanish and Japanese with easy extensibility.
Updated Tue Jan 08 2013.