Ah yes... now I remember! Using Google here causes all sorts of difficulties, eg: http://ubiquity.mozilla.com/trac/ticket/268
If anyone's willing to re-write the preview to use WeatherUnderground's API, Satyr has some sample code in the above ticket, and there's the Weather verb from Taskfox that you can use code from: http://hg.mozilla.org/incubator/taskfox/file/tip/browser/components/tasks/src/verbWeather.js - Blair On 16/06/09 9:07 PM, esquifit wrote: > > A common problem is that the Google API requires you to parse a locale > dependent string. The Weather command currently supports only > English. > If your Firefox is configured to use a different language preference > for loading pages, then the command will fail. > > I fixed this by redefining the command: > > Change: > CmdUtils.previewGet( pblock, url, {weather: location}, function > (xml) { > by > CmdUtils.previewGet( pblock, url, {weather: location, hl:'en'}, > function(xml) { > > I addition, I enclosed the parsing routine in a try-catch block and > issue a notification in case Google does not supply the information > for some reason: > > try > { > var wind_speed = parseInt(wind_text[1].split(" ")[1]); > var wind_units = "mph"; > //http://en.wikipedia.org/wiki/Si_units > //UK uses mph > if (user_location&& ["US","UM", "LR", "MM", > "GB"].indexOf(user_location.country_code) == -1) { > wind_units = "km/h"; > wind_speed = wind_speed * 1.6; > } > var wind = wind_text[0] + " at " + wind_speed.toFixed(1) + > wind_units; > } > catch(ex) > { > displayMessage("Information not available"); > > On 15 Juny, 15:48, Heather<[email protected]> wrote: >> Trac doesn't seem excited about loading that ticket for me, so here's >> some more information about the weather command problem. >> >> http://getsatisfaction.com/mozilla/topics/no_weather_preview_with_the... >> >> On Jun 15, 9:04 am, Heather<[email protected]> wrote: >> >>> Bug #210 >> >>> https://ubiquity.mozilla.com/trac/ticket/210 >> >>> The bug affects non-english users. >> >>> On Jun 14, 11:18 pm, Blair McBride<[email protected]> wrote: >> >>>> Hi! >> >>>> I'm not aware of any problems with the Weather command not working. >> >>>> What version of Ubiquity are you running? >>>> Can you post a screenshot? >>>> Can you check the error log (main menu -> Tools -> Error Console) for >>>> anything about Ubiquity? >> >>>> - Blair >> >>>> On 14/06/09 3:56 AM, bastiano wrote: >> >>>>> When I type in Weather, it doesn't show a preview as it did before >>>>> (showing temperature, location and image). Why? > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ubiquity-firefox" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ubiquity-firefox?hl=en -~----------~----~----~----~------~----~------~--~---
