Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[56,715 views]  

10.4: Personalise the World Clock widget | 15 comments | Create New Account
Click here to return to the '10.4: Personalise the World Clock widget' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Personalise the World Clock widget
Authored by: ajr on May 03, '05 01:50:42PM

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: Anonymous on May 03, '05 04:20:16PM

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: Anonymous on Dec 13, '09 04:26:55PM

Better late than never...

Probably not possible, because the World Clock stores a set of locations internally, whereas the Weather widget makes a query to an external resource. You have control over the local stuff, like the World Clock, but to update the Weather widgets, you're looking at updating the remote site... or, putting in some logic after the location string has been read to convert certain instances into other instances for the query, and another when the results come back to ensure the displayed location is what was entered. No mean feat.



[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: zane on May 03, '05 06:48:39PM

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 May 06, '05 10:09:40PM

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 May 06, '05 10:25:20PM

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 May 08, '05 07:59:12AM

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 May 18, '05 08:04:16PM
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 May 23, '05 09:03:49AM
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 May 25, '05 10:34:00PM

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 Jul 25, '05 08:48:06PM

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 May 03, '08 11:43:44AM

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 Oct 09, '09 09:19:27AM

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 Oct 09, '09 09:53:45AM
Figured it out - it's a standardized Geoname: www.geonames.org

[ Reply to This | # ]
10.4: Personalise the World Clock widget
Authored by: jcodybaker on Mar 25, '10 12:58:02PM

It's probably worth mentioning that you can copy the whole bundle to your personal Widgets directory ~/Library/Widgets/. It will then be editable without admin privileges. It will also be persistent across operating system updates (ex. 10.5 -> 10.6) and will in general cause less headaches. Change the name of the widget bundle by renaming the package "World Clock.wdgt" -> "Better World Clock.wdgt" and editing the English.lproj/Info.Plist.strings file inside the bundle.



[ Reply to This | # ]