set your location

Any weather enabled widget can be customised to display the weather for your location (or any other location you choose). However, the way each widget does this is a little different. Often the widget makers make things easy and have a separate file that contains all the configuration data. However, sometimes you have to delve into the bowels of the Lockbackground.html or Wallpaper.html file (depending on whether you’re dealing with a lockscreen or springboard widget).

However, luckily, theme makers tend to use only a handful of scripts, so the variety is not that great.

find your location code

The first step is to get a weather code for your location. Generally you need one of two types which will be clearly stated in the configuration part of the theme file (more on that later). The theme will require either:

  • an alphanumeric code from weather.com, which has the form UKXX0085 – four capital letters and four numbers.
  • a numeric code from yahoo.weather.com.

To get the relevant location code, go to either weather.com or yahoo.weather.com – the theme file should give you an indication of which kind of code you need. Then enter the location you want in the search box and navigate to the page showing the weather for that location in your browser. Then go up to the address bar in your browser and look for the part of the URL highlighted below:

weather.com
weather.com location code
yahoo weather
yahoo weather location code

Once you have your location code, you can move on to the next step.

enter your location code into the theme

There are about three places that you might find the file that you have to modify to get the weather widget to show weather for your location.

stand alone configuration file

If you open the theme directory in a browser, there will occasionally be a configuration file called ConfigureMe.js or Config.js in the main directory, or in a directory called config inside the theme directory. This file will usually tell you what needs to be changed to customise the widget for your location. Typically it will look like this:

var locale = 44418; // The location code is using WOEID, go to weather.yahoo.com type in your zip code and retrive the code from the end of the URL in Safari.
var isCelsius = true;
var enableBG = true; // Enable semi-transparent background or not. Recommended for bright/light coloured wallpapers.
var updateInterval = 1800; // In seconds, time between a new update is fetched
var failedInterval = 300; // In seconds, time between another attempt is made for an update when the previous one fails
var ampm_format = false; // Weather to have in 12 hour format(true) or 24 hour format(false)
var show_ampm = false; // Weather to show AM/PM in time display(true) or not(false)

In this example, change the line var locale = 44418 and add in your yahoo weather code.

LockBackground.html or Wallpaper.html

More often than not, there is no standalone configuration file, and you’ll have to make your changes to the main script file. For lockscreens, this is found in the main directory of the theme and is called LockBackground.html. For springboard widgets, this file is called Wallpaper.html. In these files, you’ll have to look for a section of text that looks a bit like this:

<!---------------------------------------------------------------------------------------------------------------->
<!-- Weather Script -->
 
	var locale = "UKXX0085"
 
<!-- A few examples: ITXX0042=Milan/UKXX0085=London/USNY0996=NYC/USCA0638=LA/FRXX0023=Cannes-->
 
	var isCelsius = true
	var useRealFeel = false
 
	var enableWallpaper = true;
	var enableLockScreen = true;
 
	var stylesheetWall = 'mini'
	var stylesheetLock = 'mini'
	var stylesheet = 'mini'
 
	var iconSetWall = 'stardock'
	var iconExtWall = ".png"
	var iconSetLock = 'stardock'
	var iconExtLock = '.png'
 
	var source = 'yahooWeather'
 
	var updateInterval = 30
 
	var postal;
	var demoMode = false;
	var enabled;

The bit you need to change is var locale = “UKXX0085″. Substitute your location code for the part after the “=” sign (you’ll need to keep the quote marks) and you should be good to go.