Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.4: Personalise the World Clock widget System 10.4
Tiger only hintThe World Clock widget is fine, it does what it says, but it can easily be made a little better. Like including your home town, or the town where your family is, rather than the fairly generic ones Apple includes. To do this, you need to edit two files. Start by control-clicking on /Library: Widgets: World Clock.wdgt, and choosing Show Package Contents from the pop-up menu. In the top-level folder that just opened, you need to edit WorldClock.js

Open it up in you favourite text editor, and find a line with a city in the time zone you'd like to use. Duplicate that line, and change it to your desired town. I searched for Wellington in WorldClock.js, duplicated it, and changed the new line, so it now looks like this:
 {city:'Wellington', offset:720, timezone:'Pacific/Auckland'},
 {city:'Auckland', offset:720, timezone:'Pacific/Auckland'}
Note the comma after the first line. This change adds Auckland to the drop down list on the back of the widget. Next, navigate into the English.lproj (or whatever language you're using) folder, and open localizedStrings.js. Once again, I found Wellington, and added the second line, as shown below:
  localizedCityNames['Wellington'] = 'Wellington';
  localizedCityNames['Auckland'] = 'Auckland';
The bracketed name must be the same as the name in WorldClock.js. The name on the right is what World Clock will display below the time. The folders that hold these files are read-only, so I tend to save the modified files to the Desktop, and then drag them back into place and Authenticate as an admin.

Next time you restart Dashboard or create a World Clock, the new town(s) will be available.

[robg adds: You may wish to create a backup before you start, especially if you're not used to mucking about with application bundles...]
    •    
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[32,682 views]  

10.4: Personalise the World Clock widget | 13 comments | Create New Account
Click here to return to the '10.4: Personalise the World Clock widget' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.4: Personalise the World Clock widget
Authored by: ajr on Tue, May 3 2005 at 1:50PM PDT
To simplify you can just change the second file, modifying the location to whatever name you want.

So using the above example you could just do:

localizedCityNames['Wellington'] = 'Aukland';

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: indyslim on Tue, May 3 2005 at 4:20PM PDT
That was an easy to implement hint. Thank you.
I wonder if you can go one step further and work the magic with the weather widget. The town I live in is very small and has no listing @ accuweather. But, is reasonably close to a big city that is listed. Can you figure out some manipulation to replace the name of the big city with my small town in the weather widget? It seems like there is no list of names to edit, and probably pulls the names from the accu-weather database.

Thanks
Indy

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: zane on Tue, May 3 2005 at 6:48PM PDT
Awesome, I was looking for a way to do this (and for Auckland too, no less ;¬))

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: jimphelps on Fri, May 6 2005 at 10:09PM PDT
I would like to add UTC to the list. Any idea what the valid timezone entry would be for UTC?

- Jim

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: jimphelps on Fri, May 6 2005 at 10:25PM PDT
Figured it out.

var Europe = [
{city:'UTC', offsett:0, timezone:'UTC'},

Enter the name as per the hint into the English.lproj file.

- Jim

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: john love on Sun, May 8 2005 at 7:59AM PDT
Works as advertised. However, what changes do I make to make my added home time show up when this widget is re-opened. Can select my City on back side, but after closing and re-opening, Detroit always shows. Changed defaultCityIndex within WorldClock.js and no change.

---
Touch the Future! Teach!!

[ Reply to This | # ]
10.4: Think Different World Clock widget
Authored by: ekerkhoff on Wed, May 18 2005 at 8:04PM PDT
Does anyone have the expertise to develope a Think Different World Clock widget that runs backwards?

Take a look at the link below for an example:
http://www.welovemacs.com/alogowww.html

[ Reply to This | # ]
10.4: Think Different World Clock widget
Authored by: mcswgn on Mon, May 23 2005 at 9:03AM PDT
Getting the clock to run backwards is very straight forward. Open WorldClock.js as was described above for adding a city. There are three places where the function "drawHands" appears--the first two when it is being used and the last where it is defined. Change the first two uses by inserting a negative sign in front of each of the angles so it looks like:

drawHands ( - hoursAngle, - minutesAngle, - secondsAngle);
Now the clock runs backwards. The problem is that the clock face is still numbered forward! The tedious part is fixing this. If you are creative, you can completely redo the face to your liking. The two images that draw the clock face (one for day time and one for night) are "base.png" and "pmbase.png" in the images subdirectory. I just used Graphic Converter to flip the entire image horizontally (that put the digits in the right locations but mirror image) and then carefully selected each number and flipped it back again. Add a "Think different" to the face and, viola!, you have your clock. If you want to look at my modified images you can get them here: base.png and pmbase.png. If you don't want to modify the original widgit (a good idea if only to keep your changes from being overwritten if the original gets an update), duplicate the entire World Clock.wdgt, name it "TD World Clock.wdgt", and make the changes inside that. Then you can have both types of clocks at the same time.

[ Reply to This | # ]
10.4: Think Different World Clock widget
Authored by: ekerkhoff on Wed, May 25 2005 at 10:34PM PDT
Very cool!!! Thank you so much for the help. I appreciate the images too. Thanks!

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: ebukva on Mon, Jul 25 2005 at 8:48PM PDT
The other day I noticed that Apple's world clock widget changes the
background of the clock from black to white and vice versa not
according to the real daylight conditions but according to some fixed
schedule (when I walked out of the room it was still day outside but
the clock had turned black).

Now, Apple's documentation for Dashboard says that this is the purpose
of the color switch:
"The clock's background changes from white to black to indicate day
and night." (http://images.apple.com/macosx/pdf/MacOSX_Dashboard_TB.pdf)

Is there a way (or has it been done?) to hack the clock widget so that
it pulls the data about the sunrise and sunset times in my area and
change the background of the clock accordingly?

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: bashibazouk on Sat, May 3 2008 at 11:43AM PDT
I'm pretty new at OS X. I've got some linux experience, though.

Stymied about how to get permission to save the Worldclock.js file. I've tried changing all of the permissions on the file to read/write, but I still get a privileges popup when I try to save the file.

su open Textedit.app didn't seem to do the trick, either. What am I missing?

Josh



[ Reply to This | # ]
10.6: Personalise the World Clock widget
Authored by: joshturse on Fri, Oct 9 2009 at 9:19AM PDT
In the past, I have hacked the clock, under 10.4, following the directions here. I try to do the same in 10.6.1, but when I open WorldClock.js, I notice there's a new field "id". From the head of the file, it looks like some sort of "geoID". Anyone know what this number represents? Where to find others?

[ Reply to This | # ]
10.6: Personalise the World Clock widget
Authored by: joshturse on Fri, Oct 9 2009 at 9:53AM PDT
Figured it out - it's a standardized Geoname: www.geonames.org

[ Reply to This | # ]