Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Translate the Weather widget into other languages System 10.4
Tiger only hintThe Weather widget is English-only when you install Tiger. It can be translated as easily as it can be done for most any application.

The widget is located in /Library/Widgets. Change the permissions of the files so you can write to it (using File: Get Info). Open the widget's bundle (Control-click and Show Package Contents), and then copy the English.lproj to (for example) French.lproj. Then edit the file named localizedStrings.js with your favorite pure-text editor. When done, save the file, reset the permissions, and reload the widget.

Read the rest of the hint for the French translation instructions, including a caution about accented characters.

To translate in French, the localizedStrings.js file should look like this:
var localizedStrings = new Array;

localizedStrings['SUN'] = 'DIM';
localizedStrings['MON'] = 'LUN';
localizedStrings['TUE'] = 'MAR';
localizedStrings['WED'] = 'MER';
localizedStrings['THU'] = 'JEU';
localizedStrings['FRI'] = 'VEN';
localizedStrings['SAT'] = 'SAM';
localizedStrings['Include lows in 6-day forecast'] = 'Inclure les pr?©visions 6 jours';
localizedStrings['¬?F'] = '¬?F';
localizedStrings['¬?C'] = '¬?C';
localizedStrings['Degrees:'] = 'Degr?©s:';
localizedStrings['City, State or ZIP Code:'] = 'Ville ou code postal:';
localizedStrings['Validating'] = 'Validation';
localizedStrings['Done'] = 'Termin?©';
localizedStrings['No cities found'] = 'Ville introuvable';
localizedStrings['H: '] = 'H: ';
localizedStrings['L: '] = 'B: ';
localizedStrings['UseCelcius'] = '1';
localizedStrings['Try a more specific search'] = 'Essayer une recherche plus sp?©cifique';
Take note that accented characters are handled specially in this file. For instance, an "é" is représented by "?©". To find out which character representations were needed, I looked at other widgets, but I do not have a better source as for now.

[robg adds: I apologize in advance if Geeklog trashed any of the special characters -- if it did, will someone please let me know?]
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)

10.4: Translate the Weather widget into other languages | 3 comments | Create New Account
Click here to return to the '10.4: Translate the Weather widget into other languages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Translate the Weather widget into other languages
Authored by: xavierbdm on May 13, '05 06:59:59PM

Regarding accents and their interpretation:
beware! They are not encoded weirdly on purpose: they seem weird to you because the text file apparently DOES NOT specify its encoding.
So you text editor assumes by default it is in Western Mac OS Roman.
But the files are actually handled as UTF-8 (like most OS X default encoding is or should be). So the system (Safari to be exact) expects them to be UTF-8.

Take another already localized widget (the French.lproj localizedstrings.js from WordClock for instance)
If you use the (free for personal use and extremely powerful) marvelous SubEthaEdit text editor ( ), just open the file, and go to the menu "Format>File Encoding" and choose UTF-8: then choose "re-interpret" (which forces the text editor to re-read the file as encoded in UTF-8 and not its default interpreation): ta-daah! All accents are there.
(beware: don't use "convert" as the editor would parse the file as it is seen now and try and make sense of the bytes as if they meant something in UTF-8.
Now, if you want to make a localized version of any widget, remember to set the file's encoding to UTF-8, before writing into it.

Now, I'll leave it as an practical application to the reader to try and find why TextEdit persists in seeing Apple's own files as Western Mac Roman...

(...When it is all over the documentation that UTF-8 is the default encoding in Tiger, and the true way to have a system able to deal with the world's various langugaes.)

iMac G4 17 800/512/80 + powerbook firewire G3 500/512/30

[ Reply to This | # ]
10.4: Translate the Weather widget into other languages
Authored by: callefjant on May 14, '05 11:36:38AM

Choose Open from within Text Editor and UTF-8 in the popup.

It's an idea to just copy the widget to the desktop before editing. In that way, you have your backup and you get the right privileges in one shot.

[ Reply to This | # ]
10.4: Translate the Weather widget into other languages
Authored by: httpd on May 15, '05 06:03:54AM

Also users that prefer Celsius over Fahrenheit should change localizedStrings['UseCelcius'] = '0'; to localizedStrings['UseCelcius'] = '1';
Also one can edit the InfoPlist.strings file using UTF-16 encoding to localize the name of the widget.

[ Reply to This | # ]