Projet

Général

Profil

0001-misc-translate-geolocation-error-messages-12965.patch

Frédéric Péters, 02 septembre 2016 15:11

Télécharger (2,79 ko)

Voir les différences:

Subject: [PATCH] misc: translate geolocation error messages (#12965)

 wcs/qommon/http_response.py        | 1 +
 wcs/qommon/static/js/qommon.map.js | 6 +++++-
 wcs/root.py                        | 4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)
wcs/qommon/http_response.py
75 75
                    self.add_javascript(['jquery.js'])
76 76
                    self.add_javascript(['../leaflet/leaflet.js'])
77 77
                    self.add_css_include('../leaflet/leaflet.css')
78
                    self.add_javascript(['../../i18n.js'])
78 79
                if script_name == 'jquery-ui.js':
79 80
                    self.add_css_include('../xstatic/themes/smoothness/jquery-ui.min.css')
80 81
                self.javascript_scripts.append(str(mapped_script_name))
wcs/qommon/static/js/qommon.map.js
62 62
         }
63 63
       });
64 64
       map.on('locationerror', function(e) {
65
         var message = WCS_I18N.geoloc_unknown_error;
66
         if (e.code == 1) message = WCS_I18N.geoloc_permission_denied;
67
         else if (e.code == 2) message = WCS_I18N.geoloc_position_unavailable;
68
         else if (e.code == 3) message = WCS_I18N.geoloc_timeout;
65 69
         $map_widget.parent().parent().find('label').removeClass('activity');
66
         $map_widget.parent().parent().find('label').after('<span class="geoloc-error">' + e.message + '</span>');
70
         $map_widget.parent().parent().find('label').after('<span class="geoloc-error">' + message + '</span>');
67 71
       });
68 72
       $map_widget.parent().parent().find('label').addClass('activity')
69 73
       map.locate({timeout: 10000, maximumAge: 60000});
wcs/root.py
368 368
        get_response().set_content_type('text/javascript')
369 369
        strings = {
370 370
            'confirmation': _('Are you sure?'),
371
            'geoloc_unknown_error': _('Geolocation: unknown error'),
372
            'geoloc_permission_denied': _('Geolocation: permission denied'),
373
            'geoloc_position_unavailable': _('Geolocation: position unavailable'),
374
            'geoloc_timeout': _('Geolocation: timeout'),
371 375
        }
372 376
        return 'WCS_I18N = %s;\n' % json.dumps(strings)
373 377

  
374
-