modified: po/fr.po

modified:   src/extension.js
	modified:   src/org.gnome.shell.extensions.weather.gschema.xml.in
	modified:   weather-extension-configurator.py
yahoo_weather
Christian METZLER 13 years ago
parent 7189277f08
commit 8f8213407e
  1. 77
      po/fr.po
  2. 90
      src/extension.js
  3. 9
      src/org.gnome.shell.extensions.weather.gschema.xml.in
  4. 8
      weather-extension-configurator.py

@ -243,6 +243,18 @@ msgstr "Chargement ..."
msgid "Please wait" msgid "Please wait"
msgstr "Patientez s'il vous plaît" msgstr "Patientez s'il vous plaît"
#: extension.js:459
msgid "SW"
msgstr "SO"
#: extension.js:459
msgid "W"
msgstr "O"
#: extension.js:459
msgid "NW"
msgstr "NO"
#: extension.js:467 #: extension.js:467
msgid "Temperature:" msgid "Temperature:"
msgstr "Température :" msgstr "Température :"
@ -258,3 +270,68 @@ msgstr "Pression :"
#: extension.js:473 #: extension.js:473
msgid "Wind:" msgid "Wind:"
msgstr "Vent :" msgstr "Vent :"
#: weather-extension-configurator.py:113
msgid "City"
msgstr "Ville"
#: weather-extension-configurator.py:114
msgid "Example : New York, USA"
msgstr "Exemple : Toulouse, France"
#: weather-extension-configurator.py:115
msgid "Temperature Unit"
msgstr "Unité de temperature"
#: weather-extension-configurator.py:117
msgid "Position in Panel"
msgstr "Position sur le panel"
#: weather-extension-configurator.py:118
msgid "left"
msgstr "gauche"
#: weather-extension-configurator.py:118
msgid "center"
msgstr "centre"
#: weather-extension-configurator.py:118
msgid "right"
msgstr "droite"
#: weather-extension-configurator.py:119
msgid "The position of this GNOME Shell extension in the panel. (Requires restart of GNOME Shell.)"
msgstr "La position de cette extension GNOME Shell sur le panel. (Requière le redémarrage de GNOME Shell.)"
#: weather-extension-configurator.py:120
msgid "Translate Weather Conditions"
msgstr "Traduction des conditions météo"
#: weather-extension-configurator.py:121
msgid "If enabled, the condition is translated based on the weather code.\nIf disabled, the condition string from Yahoo is taken.\nNote: Enabling the translation sometimes results in loss of accuracy, e.g., the condition string “PM Thunderstorms” cannot be expressed in terms of weather codes."
msgstr "Si activé, les conditions météo seront traduites à partir du code météo.\nSi désactivé, elles seront en langue originale.\nNote: Activer la traduction peut parfois réduire l'acuité, p. ex., le code météo \"Orage nocturne\" n'existe pas et il sera traduit par \"Orage\"."
#: weather-extension-configurator.py:122
msgid "Symbolic Icons"
msgstr "Icones symboliques"
#: weather-extension-configurator.py:123
msgid "Display symbolic icons instead of full-colored icons"
msgstr "Affiche des icones symboliques à la place des icones colorés"
#: weather-extension-configurator.py:124
msgid "Show Text in Panel"
msgstr "Afficher le texte dans le panel"
#: weather-extension-configurator.py:125
msgid "Display current temperature in panel. If disabled, only the current condition icon is shown. (Requires restart of GNOME Shell.)"
msgstr "Affiche la temperature actuel dans le panel. Si désactivé, seul l'icone de l'actuel condition météo est affiché. (Requière le redémarrage de GNOME Shell.)"
#: weather-extension-configurator.py:126
msgid "Include Condition"
msgstr "Inclure les conditions météo"
#: weather-extension-configurator.py:127
msgid "Whether to show the weather condition (e.g., “Windy”, “Clear”) in the panel."
msgstr "Affiche la condition météo actuel (p. ex., “Venteux”, “Beau”) dans le panel."

@ -48,7 +48,6 @@ const PopupMenu = imports.ui.popupMenu;
const WEATHER_SETTINGS_SCHEMA = 'org.gnome.shell.extensions.weather'; const WEATHER_SETTINGS_SCHEMA = 'org.gnome.shell.extensions.weather';
const WEATHER_UNIT_KEY = 'unit'; const WEATHER_UNIT_KEY = 'unit';
const WEATHER_CITY_KEY = 'city'; const WEATHER_CITY_KEY = 'city';
const WEATHER_WOEID_KEY = 'woeid';
const WEATHER_TRANSLATE_CONDITION_KEY = 'translate-condition'; const WEATHER_TRANSLATE_CONDITION_KEY = 'translate-condition';
const WEATHER_USE_SYMBOLIC_ICONS_KEY = 'use-symbolic-icons'; const WEATHER_USE_SYMBOLIC_ICONS_KEY = 'use-symbolic-icons';
const WEATHER_SHOW_TEXT_IN_PANEL_KEY = 'show-text-in-panel'; const WEATHER_SHOW_TEXT_IN_PANEL_KEY = 'show-text-in-panel';
@ -85,7 +84,6 @@ WeatherMenuButton.prototype = {
this._settings = getSettings(WEATHER_SETTINGS_SCHEMA); this._settings = getSettings(WEATHER_SETTINGS_SCHEMA);
this._units = this._settings.get_enum(WEATHER_UNIT_KEY); this._units = this._settings.get_enum(WEATHER_UNIT_KEY);
this._city = this._settings.get_string(WEATHER_CITY_KEY); this._city = this._settings.get_string(WEATHER_CITY_KEY);
this._woeid = this._settings.get_string(WEATHER_WOEID_KEY);
this._translate_condition = this._settings.get_boolean(WEATHER_TRANSLATE_CONDITION_KEY); this._translate_condition = this._settings.get_boolean(WEATHER_TRANSLATE_CONDITION_KEY);
this._icon_type = this._settings.get_boolean(WEATHER_USE_SYMBOLIC_ICONS_KEY) ? St.IconType.SYMBOLIC : St.IconType.FULLCOLOR; this._icon_type = this._settings.get_boolean(WEATHER_USE_SYMBOLIC_ICONS_KEY) ? St.IconType.SYMBOLIC : St.IconType.FULLCOLOR;
this._text_in_panel = this._settings.get_boolean(WEATHER_SHOW_TEXT_IN_PANEL_KEY); this._text_in_panel = this._settings.get_boolean(WEATHER_SHOW_TEXT_IN_PANEL_KEY);
@ -97,7 +95,6 @@ WeatherMenuButton.prototype = {
let load_settings_and_refresh_weather = Lang.bind(this, function() { let load_settings_and_refresh_weather = Lang.bind(this, function() {
this._units = this._settings.get_enum(WEATHER_UNIT_KEY); this._units = this._settings.get_enum(WEATHER_UNIT_KEY);
this._city = this._settings.get_string(WEATHER_CITY_KEY); this._city = this._settings.get_string(WEATHER_CITY_KEY);
this._woeid = this._settings.get_string(WEATHER_WOEID_KEY);
this._translate_condition = this._settings.get_boolean(WEATHER_TRANSLATE_CONDITION_KEY); this._translate_condition = this._settings.get_boolean(WEATHER_TRANSLATE_CONDITION_KEY);
this._icon_type = this._settings.get_boolean(WEATHER_USE_SYMBOLIC_ICONS_KEY) ? St.IconType.SYMBOLIC : St.IconType.FULLCOLOR; this._icon_type = this._settings.get_boolean(WEATHER_USE_SYMBOLIC_ICONS_KEY) ? St.IconType.SYMBOLIC : St.IconType.FULLCOLOR;
this._comment_in_panel = this._settings.get_boolean(WEATHER_SHOW_COMMENT_IN_PANEL_KEY); this._comment_in_panel = this._settings.get_boolean(WEATHER_SHOW_COMMENT_IN_PANEL_KEY);
@ -105,7 +102,6 @@ WeatherMenuButton.prototype = {
}); });
this._settings.connect('changed::' + WEATHER_UNIT_KEY, load_settings_and_refresh_weather); this._settings.connect('changed::' + WEATHER_UNIT_KEY, load_settings_and_refresh_weather);
this._settings.connect('changed::' + WEATHER_CITY_KEY, load_settings_and_refresh_weather); this._settings.connect('changed::' + WEATHER_CITY_KEY, load_settings_and_refresh_weather);
this._settings.connect('changed::' + WEATHER_WOEID_KEY, load_settings_and_refresh_weather);
this._settings.connect('changed::' + WEATHER_TRANSLATE_CONDITION_KEY, load_settings_and_refresh_weather); this._settings.connect('changed::' + WEATHER_TRANSLATE_CONDITION_KEY, load_settings_and_refresh_weather);
this._settings.connect('changed::' + WEATHER_SHOW_COMMENT_IN_PANEL_KEY, load_settings_and_refresh_weather); this._settings.connect('changed::' + WEATHER_SHOW_COMMENT_IN_PANEL_KEY, load_settings_and_refresh_weather);
this._settings.connect('changed::' + WEATHER_USE_SYMBOLIC_ICONS_KEY, Lang.bind(this, function() { this._settings.connect('changed::' + WEATHER_USE_SYMBOLIC_ICONS_KEY, Lang.bind(this, function() {
@ -221,7 +217,8 @@ WeatherMenuButton.prototype = {
}, },
get_weather_url: function() { get_weather_url: function() {
return 'http://query.yahooapis.com/v1/public/yql?format=json&q=select location,wind,atmosphere,units,item.condition,item.forecast from weather.forecast where location="' + this._woeid + '" and u="' + this.unit_to_url() + '"'; return encodeURI('http://query.yahooapis.com/v1/public/yql?format=json&q=select location,wind,atmosphere,units,item.condition,item.forecast from weather.forecast where location in (select id from xml where url="http://xoap.weather.com/search/search?where='+ encodeURI( this._city ) +'" and itemPath="search.loc") and u="' + this.unit_to_url() + '"');
/* see http://jonathantrevor.net/?p=40 */
}, },
get_weather_icon: function(code) { get_weather_icon: function(code) {
@ -472,9 +469,8 @@ WeatherMenuButton.prototype = {
let message = Soup.Message.new('GET', url); let message = Soup.Message.new('GET', url);
session.queue_message(message, function(session, message) { session.queue_message(message, function(session, message) {
let jp = new Json.Parser(); let jp = JSON.parse(message.response_body.data);
jp.load_from_data(message.response_body.data, -1); fun.call(here, jp);
fun.call(here, jp.get_root().get_object());
}); });
}, },
@ -482,50 +478,38 @@ WeatherMenuButton.prototype = {
this.load_json_async(this.get_weather_url(), function(json) { this.load_json_async(this.get_weather_url(), function(json) {
try { try {
let weather = json.get_object_member('query').get_object_member('results').get_object_member('channel'); let weather = json.query.results.channel;
let weather_c = weather.get_object_member('item').get_object_member('condition'); let many = 0;
let forecast = weather.get_object_member('item').get_array_member('forecast').get_elements(); if(typeof weather[0] != "undefined")
{
/* TODO won't work with the new URL weather = weather[0];
// Fixes wrong woeid if necessary many = 1;
try {
// Wrong woeid specified
if (weather.has_member('code') && weather.get_int_member('code') == 500) {
// Fetch correct woeid
this.load_json_async(this.get_weather_url().replace('p=', 'w='), function(weather) {
try {
// Take correct woeid, update gsettings
this._woeid = weather.get_object_member('location').get_string_member('location_id');
this._settings.set_string(WEATHER_WOEID_KEY, this._woeid);
// Load weather with correct woeid
this.refreshWeather(false);
} catch(e) {
}
});
return;
} }
} catch(e) { let weather_c = weather.item.condition;
global.log('A ' + e.name + ' has occured: ' + e.message); let forecast = weather.item.forecast;
} let location = this._city;
*/ if (weather.location.city)
location = weather.location.city;
let location = weather.get_object_member('location').get_string_member('city');
if (this._city != null && this._city.length > 0) if (many && weather.location.region)
location = this._city; location = location +", "+ weather.location.region;
else
if (many && weather.location.country)
location = location +", "+ weather.location.country;
// Refresh current weather // Refresh current weather
let comment = weather_c.get_string_member('text'); let comment = weather_c.text;
if (this._translate_condition) if (this._translate_condition)
comment = this.get_weather_condition(weather_c.get_string_member('code')); comment = this.get_weather_condition(weather_c.code);
let temperature = weather_c.get_string_member('temp'); let temperature = weather_c.temp;
let humidity = weather.get_object_member('atmosphere').get_string_member('humidity') + ' %'; let humidity = weather.atmosphere.humidity + ' %';
let pressure = weather.get_object_member('atmosphere').get_string_member('pressure'); let pressure = weather.atmosphere.pressure;
let pressure_unit = weather.get_object_member('units').get_string_member('pressure'); let pressure_unit = weather.units.pressure;
let wind_direction = this.get_compass_direction(weather.get_object_member('wind').get_string_member('direction')); let wind_direction = this.get_compass_direction(weather.wind.direction);
let wind = weather.get_object_member('wind').get_string_member('speed'); let wind = weather.wind.speed;
let wind_unit = weather.get_object_member('units').get_string_member('speed'); let wind_unit = weather.units.speed;
let iconname = this.get_weather_icon_safely(weather_c.get_string_member('code')); let iconname = this.get_weather_icon_safely(weather_c.code);
this._currentWeatherIcon.icon_name = this._weatherIcon.icon_name = iconname; this._currentWeatherIcon.icon_name = this._weatherIcon.icon_name = iconname;
@ -545,17 +529,17 @@ WeatherMenuButton.prototype = {
let date_string = [_('Today'), _('Tomorrow')]; let date_string = [_('Today'), _('Tomorrow')];
for (let i = 0; i <= 1; i++) { for (let i = 0; i <= 1; i++) {
let forecastUi = this._forecast[i]; let forecastUi = this._forecast[i];
let forecastData = forecast[i].get_object(); let forecastData = forecast[i];
let code = forecastData.get_string_member('code'); let code = forecastData.code;
let t_low = forecastData.get_string_member('low'); let t_low = forecastData.low;
let t_high = forecastData.get_string_member('high'); let t_high = forecastData.high;
let comment = forecastData.get_string_member('text'); let comment = forecastData.text;
if (this._translate_condition) if (this._translate_condition)
comment = this.get_weather_condition(code); comment = this.get_weather_condition(code);
forecastUi.Day.text = date_string[i] + ' (' + this.get_locale_day(forecastData.get_string_member('day')) + ')'; forecastUi.Day.text = date_string[i] + ' (' + this.get_locale_day(forecastData.day) + ')';
forecastUi.Temperature.text = t_low + '\u2013' + t_high + ' ' + this.unit_to_unicode(); forecastUi.Temperature.text = t_low + '\u2013' + t_high + ' ' + this.unit_to_unicode();
forecastUi.Summary.text = comment; forecastUi.Summary.text = comment;
forecastUi.Icon.icon_name = this.get_weather_icon_safely(code); forecastUi.Icon.icon_name = this.get_weather_icon_safely(code);

@ -14,11 +14,6 @@
<_summary>Units</_summary> <_summary>Units</_summary>
<_description>Choose the unit system for temperatures etc. Allowed values are 'celsius' or 'fahrenheit'.</_description> <_description>Choose the unit system for temperatures etc. Allowed values are 'celsius' or 'fahrenheit'.</_description>
</key> </key>
<key name="woeid" type="s">
<default>'AUXX0010'</default>
<_summary>Yahoo WOEID</_summary>
<_description>Set the Yahoo location ID (aka. WOEID, Where On Earth Identifier), which is used to retrieve the corresponding weather+forecast information.</_description>
</key>
<key name="city" type="s"> <key name="city" type="s">
<default>''</default> <default>''</default>
<_summary>City to be displayed</_summary> <_summary>City to be displayed</_summary>
@ -30,7 +25,7 @@
<_description>Whether to translate the weather condition. If enabled, the condition is translated based on the weather code. If disabled, the condition string from Yahoo is taken. Note: Enabling the translation sometimes results in loss of accuracy, e.g., the condition string "PM Thunderstorms" cannot be expressed in terms of weather codes.</_description> <_description>Whether to translate the weather condition. If enabled, the condition is translated based on the weather code. If disabled, the condition string from Yahoo is taken. Note: Enabling the translation sometimes results in loss of accuracy, e.g., the condition string "PM Thunderstorms" cannot be expressed in terms of weather codes.</_description>
</key> </key>
<key name="use-symbolic-icons" type="b"> <key name="use-symbolic-icons" type="b">
<default>false</default> <default>true</default>
<_summary>Whether to use symbolic icons</_summary> <_summary>Whether to use symbolic icons</_summary>
<_description>Whether to use symbolic icons instead of full-colored icons.</_description> <_description>Whether to use symbolic icons instead of full-colored icons.</_description>
</key> </key>
@ -50,7 +45,7 @@
<_description>Set the position of this GNOME Shell extension in the panel to either 'center', 'left' or 'right' (requires restart).</_description> <_description>Set the position of this GNOME Shell extension in the panel to either 'center', 'left' or 'right' (requires restart).</_description>
</key> </key>
<key name="refresh-interval" type="i"> <key name="refresh-interval" type="i">
<default>240</default> <default>300</default>
<_summary>Refresh interval in seconds</_summary> <_summary>Refresh interval in seconds</_summary>
<_description>The interval in seconds to refresh the weather information.</_description> <_description>The interval in seconds to refresh the weather information.</_description>
</key> </key>

@ -110,12 +110,10 @@ class WeatherConfigurator:
self.elements = [] self.elements = []
self.add_text('woeid', '<b>WOEID</b>', self.add_text('city', 'City',
"The Where On Earth ID determinees the location/city") "Example : New York, USA")
self.add_radio('unit', 'Temperature Unit', self.add_radio('unit', 'Temperature Unit',
[(0, 'celsius'), (1, 'fahrenheit')]) [(0, 'celsius'), (1, 'fahrenheit')])
self.add_text('city', 'Override Location Label',
"Sometimes your WOEID location isn’t quite right (it’s the next major city around). This label is used to override the location displayed.")
self.add_radio('position-in-panel', 'Position in Panel', self.add_radio('position-in-panel', 'Position in Panel',
[(2, 'left'), (0, 'center'), (1, 'right')], [(2, 'left'), (0, 'center'), (1, 'right')],
"The position of this GNOME Shell extension in the panel. (Requires restart of GNOME Shell.)") "The position of this GNOME Shell extension in the panel. (Requires restart of GNOME Shell.)")
@ -125,7 +123,7 @@ class WeatherConfigurator:
"Display symbolic icons instead of full-colored icons") "Display symbolic icons instead of full-colored icons")
(b_text, _) = self.add_check('show-text-in-panel', 'Show Text in Panel', (b_text, _) = self.add_check('show-text-in-panel', 'Show Text in Panel',
"Display current temperature in panel. If disabled, only the current condition icon is shown. (Requires restart of GNOME Shell.)") "Display current temperature in panel. If disabled, only the current condition icon is shown. (Requires restart of GNOME Shell.)")
(b_cond, l_cond) = self.add_check('show-comment-in-panel', ' Include Condition', (b_cond, l_cond) = self.add_check('show-comment-in-panel', 'Include Condition',
"Whether to show the weather condition (e.g., “Windy”, “Clear”) in the panel.") "Whether to show the weather condition (e.g., “Windy”, “Clear”) in the panel.")
# add dependency between text-in-panel and comment-in-panel # add dependency between text-in-panel and comment-in-panel

Loading…
Cancel
Save