diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-01-24 15:22:39 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-01-24 15:22:39 +0000 |
commit | 42a4d0357fb887526727beb0804f06cf3b7dbd73 (patch) | |
tree | 422e57388b05b541966fde26d6f2b885a370465d | |
parent | 033eefc509fabf4046aba4e5dffe4eee758ef937 (diff) |
Get remaining English hardcoded strings from JavaScript into translatable template.
-rw-r--r-- | templates/web/default/js/translation_strings.html | 10 | ||||
-rw-r--r-- | web/js/fixmystreet.js | 8 | ||||
-rw-r--r-- | web/js/map-OpenLayers.js | 8 |
3 files changed, 18 insertions, 8 deletions
diff --git a/templates/web/default/js/translation_strings.html b/templates/web/default/js/translation_strings.html index 6e586d943..a0cfc02c9 100644 --- a/templates/web/default/js/translation_strings.html +++ b/templates/web/default/js/translation_strings.html @@ -26,5 +26,15 @@ back: '[% loc('Back') | replace("'", "\\'") %]', how_to_send: '[% loc('How to send successful reports') | replace("'", "\\'") %]', more_details: '[% loc('Details') | replace("'", "\\'") %]', + + geolocation_declined: '[% loc('You declined; please fill in the box above') | replace("'", "\\'") %]', + geolocation_no_position: '[% loc('Could not look up location') | replace("'", "\\'") %]', + geolocation_no_result: '[% loc('No result returned') | replace("'", "\\'") %]', + geolocation_unknown: '[% loc('Unknown error') | replace("'", "\\'") %]', + + reporting_a_problem: '[% loc('Reporting a problem') | replace("'", "\\'") %]', + ok: '[% loc('OK') | replace("'", "\\'") %]', + map: '[% loc('MAP') | replace("'", "\\'") %]', + report_problem_heading: '[% loc('Click map to report a problem') | replace("'", "\\'") %]' }; diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index 4ac467d49..fda019b1d 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -159,13 +159,13 @@ $(function(){ }, function(err) { $link.find('img').remove(); if (err.code == 1) { // User said no - $link.html("You declined; please fill in the box above"); + $link.html(translation_strings.geolocation_declined); } else if (err.code == 2) { // No position - $link.html("Could not look up location"); + $link.html(translation_strings.geolocation_no_position); } else if (err.code == 3) { // Too long - $link.html("No result returned"); + $link.html(translation_strings.geolocation_no_result); } else { // Unknown - $link.html("Unknown error"); + $link.html(translation_strings.geolocation_unknown); } }, { enableHighAccuracy: true, diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 19bf8ee94..3e4a4d703 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -16,7 +16,7 @@ function fixmystreet_update_pin(lonlat) { if (!$('#side-form-error').length) { $('<div id="side-form-error"/>').insertAfter($('#side-form')); } - $('#side-form-error').html('<h1>Reporting a problem</h1><p>' + data.error + '</p>').show(); + $('#side-form-error').html('<h1>' + translation_strings.reporting_a_problem + '</h1><p>' + data.error + '</p>').show(); $('#side-form').hide(); return; } @@ -545,7 +545,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { $map_box.append( '<p id="mob_sub_map_links">' + '<a href="#" id="try_again">' + translation_strings.try_again + '</a>' + - '<a href="#ok" id="mob_ok">OK</a>' + + '<a href="#ok" id="mob_ok">' + translation_strings.ok + '</a>' + '</p>' ).css({ position: 'relative', width: width, height: height, marginBottom: '1em' }); // Making it relative here makes it much easier to do the scrolling later @@ -559,12 +559,12 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { //to do this on other pages where #side-form might not be $('html, body').animate({ scrollTop: height-60 }, 1000, function(){ $('#mob_sub_map_links').addClass('map_complete'); - $('#mob_ok').text('MAP'); + $('#mob_ok').text(translation_strings.map); }); }, function(){ $('html, body').animate({ scrollTop: 0 }, 1000, function(){ $('#mob_sub_map_links').removeClass('map_complete'); - $('#mob_ok').text('OK'); + $('#mob_ok').text(translation_strings.ok); }); }); } |