Quarter Life Crisis

The world according to Sven-S. Porst

« 10 Mac ApplicationsMainZu naß hier? »


757 words on ,

Back when I looked a the new features of Mac OS X.4, I took a good look at the Dashboard and was disappointed by its lack of proper localisation. This was particularly evident in the Weather widget which not only has the annoying habit of preferring small U.S. towns which nicked the names of their European ancestors when you enter them – and giving very little feedback about it. It also gives you Fahrenheit temperatures for every new widget you open.

Weather widget icon That’s not only annoying for the user but also quite stupid. The system knows where I am, which language I prefer and whether I’m using metric units. From these informations quite a good guess regarding the preferred temperature scale could be made: E.g. Having German as the preferred system language, not being located in the U.S. (or Jamaica) and preferring metric units should allow a pretty safe prediction in favour of degrees Celsius.

All this is quite annoying and really puts me off the weather widget which I otherwise like for its shiny prettiness and its forecasts. So I decided to have a look at it. After all the Dashboard is mostly driven by JavaScript which means you can read the code and change it. And my hope was that even with my JavaScript experience being rather low-key (I’d say a single digit number of lines so far), I should be able to figure out what goes wrong, why it goes wrong and how to fix it.

Looking at the relevant scripts made me realise that closed source software has a definite advantage. While you can’t fix things yourself and can’t learn from what other people did, it also keeps you from thinking that the people who wrote the software should be embarrassed. It seems that the Weather widget gets it wrong in a number of places. Ranging from a lack of resources or interest in localisation to really, erm, odd ways of programming and weaknesses in spelling.

My first impression while looking at the code was that the widget isn’t as bad as it seems as it in fact has hooks for localised strings all over the place in its JavaScript code. It even contains a string UseCelcius which can be set to zero or one and determines the widget’s default temperature scale. It also showcases a strange form of humour or ignorance about the spelling of Mr Celsius’ name – which is found throughout the JavaScript code. I’d like to make the sad sidenote at this place that the Google fight Celsius vs. Celcius ended with the ridiculous score of 8.4million:1.3 million. Eeek.

Thus a quick solution for the problem was to just localise the widget myself. With about twenty strings this wasn’t too hard to do and has the advantage of giving me German day names as well for the forecast:

German Weather Widget

Dashboard Wetter Icon And while I was at it, I also updated the widget’s icon to display a temperature that’s reasonable in Celsius and localised the name as well. Unfortunately you can’t have localised icons so the original icon had to be overwritten for this.

But then, just for the heck of it, I thought I should try whether I could now use Fahrenheit temperatures with my new version of the widget. And the result was that I couldn’t in the German localisation. Hence another look at the JavaScript code was needed and it exhibited two things. First, that the choice of Fahrenheit or Celsius is stored on a per-widget basis. Doing this probably avoids the (IMO small) problem of having to update all widgets which are already running to reflect the change. But it is also the reason why we had to re-set the temperature scale to Celsius for each new widget we opened before. Personally I think a global preference would be better here. And second, the preference for the temperature scale to be used is saved like this:

widget.setPreferenceForKey(isCelcius ? true : null, createkey("celcius"));
I.e. if the scale is Celsius we save ‘Yes’ and if it isn’t we save nothing at all. In particular this is the reason why I couldn’t save the Fahrenheit scale in my German localisation. Luckily a problem that could be fixed with a few keystrokes.

Contents of downloaded folder I put together the files I changed for download:

Mac OS X.3-X.5:
You need to add the German localisation, replace the icon and patch the JavaScript.
Mac OS X.6:
You only need to add the German files and replace the icon.

Enjoy at your own risk.

September 12, 2005, 1:15

Tagged as dashboard, Mac OS X, patch, weather.


Comment by Jack: User icon

Do you know the formula to convert celsius to fahrenhiet?

October 2, 2005, 23:25

Comment by ssp: User icon

Yup, not that this is particularly hard to find out…

Fahrenheit temperature = (Celsius temperature * 1,8) + 32

October 3, 2005, 1:28

Comment by Anonymous: User icon

do zombies have teeth

November 2, 2005, 17:50

Comment by Rafael Bellini: User icon

I think the formula to convert celsius to fahrenhiet is more like:

Fahrenheit temperature = (Celsius temperature * 0.55) + 32


Celsius temperature = (Fahrenheit temperature / 0.55) - 32


By the way nice website!

December 15, 2005, 17:54

Add your comment

« 10 Mac ApplicationsMainZu naß hier? »

Comments on




This page

Out & About

pinboard Links


Received data seems to be invalid. The wanted file does probably not exist or the guys at last.fm changed something.