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"
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
msgid "Temperature:"
msgstr "Température :"
@ -258,3 +270,68 @@ msgstr "Pression :"
#: extension.js:473
msgid "Wind:"
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_UNIT_KEY = 'unit';
const WEATHER_CITY_KEY = 'city';
const WEATHER_WOEID_KEY = 'woeid';
const WEATHER_TRANSLATE_CONDITION_KEY = 'translate-condition';
const WEATHER_USE_SYMBOLIC_ICONS_KEY = 'use-symbolic-icons';
const WEATHER_SHOW_TEXT_IN_PANEL_KEY = 'show-text-in-panel';
@ -85,7 +84,6 @@ WeatherMenuButton.prototype = {
this._settings = getSettings(WEATHER_SETTINGS_SCHEMA);
this._units = this._settings.get_enum(WEATHER_UNIT_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._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);
@ -97,7 +95,6 @@ WeatherMenuButton.prototype = {
let load_settings_and_refresh_weather = Lang.bind(this, function() {
this._units = this._settings.get_enum(WEATHER_UNIT_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._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);
@ -105,7 +102,6 @@ WeatherMenuButton.prototype = {
});
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_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_SHOW_COMMENT_IN_PANEL_KEY, load_settings_and_refresh_weather);
this._settings.connect('changed::' + WEATHER_USE_SYMBOLIC_ICONS_KEY, Lang.bind(this, function() {
@ -221,7 +217,8 @@ WeatherMenuButton.prototype = {
},
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) {
@ -472,9 +469,8 @@ WeatherMenuButton.prototype = {
let message = Soup.Message.new('GET', url);
session.queue_message(message, function(session, message) {
let jp = new Json.Parser();
jp.load_from_data(message.response_body.data, -1);
fun.call(here, jp.get_root().get_object());
let jp = JSON.parse(message.response_body.data);
fun.call(here, jp);
});
},
@ -482,50 +478,38 @@ WeatherMenuButton.prototype = {
this.load_json_async(this.get_weather_url(), function(json) {
try {
let weather = json.get_object_member('query').get_object_member('results').get_object_member('channel');
let weather_c = weather.get_object_member('item').get_object_member('condition');
let forecast = weather.get_object_member('item').get_array_member('forecast').get_elements();
/* TODO won't work with the new URL
// Fixes wrong woeid if necessary
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;
let weather = json.query.results.channel;
let many = 0;
if(typeof weather[0] != "undefined")
{
weather = weather[0];
many = 1;
}
} catch(e) {
global.log('A ' + e.name + ' has occured: ' + e.message);
}
*/
let location = weather.get_object_member('location').get_string_member('city');
if (this._city != null && this._city.length > 0)
location = this._city;
let weather_c = weather.item.condition;
let forecast = weather.item.forecast;
let location = this._city;
if (weather.location.city)
location = weather.location.city;
if (many && weather.location.region)
location = location +", "+ weather.location.region;
else
if (many && weather.location.country)
location = location +", "+ weather.location.country;
// Refresh current weather
let comment = weather_c.get_string_member('text');
let comment = weather_c.text;
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 humidity = weather.get_object_member('atmosphere').get_string_member('humidity') + ' %';
let pressure = weather.get_object_member('atmosphere').get_string_member('pressure');
let pressure_unit = weather.get_object_member('units').get_string_member('pressure');
let wind_direction = this.get_compass_direction(weather.get_object_member('wind').get_string_member('direction'));
let wind = weather.get_object_member('wind').get_string_member('speed');
let wind_unit = weather.get_object_member('units').get_string_member('speed');
let iconname = this.get_weather_icon_safely(weather_c.get_string_member('code'));
let temperature = weather_c.temp;
let humidity = weather.atmosphere.humidity + ' %';
let pressure = weather.atmosphere.pressure;
let pressure_unit = weather.units.pressure;
let wind_direction = this.get_compass_direction(weather.wind.direction);
let wind = weather.wind.speed;
let wind_unit = weather.units.speed;
let iconname = this.get_weather_icon_safely(weather_c.code);
this._currentWeatherIcon.icon_name = this._weatherIcon.icon_name = iconname;
@ -545,17 +529,17 @@ WeatherMenuButton.prototype = {
let date_string = [_('Today'), _('Tomorrow')];
for (let i = 0; i <= 1; i++) {
let forecastUi = this._forecast[i];
let forecastData = forecast[i].get_object();
let forecastData = forecast[i];
let code = forecastData.get_string_member('code');
let t_low = forecastData.get_string_member('low');
let t_high = forecastData.get_string_member('high');
let code = forecastData.code;
let t_low = forecastData.low;
let t_high = forecastData.high;
let comment = forecastData.get_string_member('text');
let comment = forecastData.text;
if (this._translate_condition)
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.Summary.text = comment;
forecastUi.Icon.icon_name = this.get_weather_icon_safely(code);

@ -14,11 +14,6 @@
<_summary>Units</_summary>
<_description>Choose the unit system for temperatures etc. Allowed values are 'celsius' or 'fahrenheit'.</_description>
</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">
<default>''</default>
<_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>
</key>
<key name="use-symbolic-icons" type="b">
<default>false</default>
<default>true</default>
<_summary>Whether to use symbolic icons</_summary>
<_description>Whether to use symbolic icons instead of full-colored icons.</_description>
</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>
</key>
<key name="refresh-interval" type="i">
<default>240</default>
<default>300</default>
<_summary>Refresh interval in seconds</_summary>
<_description>The interval in seconds to refresh the weather information.</_description>
</key>

@ -110,12 +110,10 @@ class WeatherConfigurator:
self.elements = []
self.add_text('woeid', '<b>WOEID</b>',
"The Where On Earth ID determinees the location/city")
self.add_text('city', 'City',
"Example : New York, USA")
self.add_radio('unit', 'Temperature Unit',
[(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',
[(2, 'left'), (0, 'center'), (1, 'right')],
"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")
(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.)")
(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.")
# add dependency between text-in-panel and comment-in-panel

Loading…
Cancel
Save