aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorFaton Selishta <fatonselishta@gmail.com>2011-06-30 16:15:39 +0200
committerFaton Selishta <fatonselishta@gmail.com>2011-06-30 16:15:39 +0200
commitc5ff3c917f1ba79ceea58c93092d59cc12f55459 (patch)
tree921ad4771f49eae82e8f98f2d8afbecc1c1c4882 /app/controllers
parent65fd8a972ba5e7d34c8e4ef772653fd90cb2eee3 (diff)
I18n string for controllers
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/controllers/comment_controller.rb13
-rw-r--r--app/controllers/help_controller.rb2
-rw-r--r--app/controllers/public_body_controller.rb2
-rw-r--r--app/controllers/request_controller.rb107
-rw-r--r--app/controllers/request_game_controller.rb10
-rw-r--r--app/controllers/track_controller.rb20
-rw-r--r--app/controllers/user_controller.rb52
8 files changed, 105 insertions, 103 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d4c70ed1e..516081d42 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base
helper_method :site_name, :locale_from_params
def site_name
# XXX should come from database:
- site_name = "Informata Zyrtare"
+ site_name = "InformataZyrtare.org"
return site_name
end
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index 4a0661f34..0bba0cfb8 100644
--- a/app/controllers/comment_controller.rb
+++ b/app/controllers/comment_controller.rb
@@ -52,14 +52,15 @@ class CommentController < ApplicationController
end
if authenticated?(
- :web => "To post your annotation",
- :email => "Then your annotation to " + @info_request.title + " will be posted.",
- :email_subject => "Confirm your annotation to " + @info_request.title
+ :web => _("To post your annotation"),
+ :email => _("Then your annotation to {{info_request_title}} will be posted.",:info_request_title=>@info_request.title),
+ :email_subject => _("Confirm your annotation to {{info_request_title}}",:info_request.title=>@info_request.title)
)
# Also subscribe to track for this request, so they get updates
# (do this first, so definitely don't send alert)
- flash[:notice] = "Thank you for making an annotation!"
+ flash[:notice] = _("Thank you for making an annotation!")
+
if params[:subscribe_to_request]
@track_thing = TrackThing.create_track_for_request(@info_request)
@existing_track = TrackThing.find_by_existing_track(@user, @track_thing)
@@ -69,9 +70,9 @@ class CommentController < ApplicationController
@track_thing.track_medium = 'email_daily'
@track_thing.tracking_user_id = @user.id
@track_thing.save!
- flash[:notice] += " You will also be emailed updates about the request."
+ flash[:notice] += _(" You will also be emailed updates about the request.")
else
- flash[:notice] += " You are already being emailed updates about the request."
+ flash[:notice] += _(" You are already being emailed updates about the request.")
end
end
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 5df701543..ab1ef5c5f 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -58,7 +58,7 @@ class HelpController < ApplicationController
@user,
@last_request, @last_body
)
- flash[:notice] = "Your message has been sent. Thank you for getting in touch! We'll get back to you soon."
+ flash[:notice] = _("Your message has been sent. Thank you for getting in touch! We'll get back to you soon.")
redirect_to frontpage_url
return
end
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 2d1577600..e31b52f9d 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -67,7 +67,7 @@ class PublicBodyController < ApplicationController
render :template => "public_body/view_email"
return
end
- flash.now[:error] = "There was an error with the words you entered, please try again."
+ flash.now[:error] = _("There was an error with the words you entered, please try again.")
end
render :template => "public_body/view_email_captcha"
end
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 0c02effa7..8987768e6 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -44,9 +44,9 @@ class RequestController < ApplicationController
if @update_status
return if !@is_owning_user && !authenticated_as_user?(@info_request.user,
- :web => "To update the status of this FOI request",
- :email => "Then you can update the status of your request to " + @info_request.public_body.name + ".",
- :email_subject => "Update the status of your request to " + @info_request.public_body.name
+ :web => _("To update the status of this FOI request"),
+ :email => _("Then you can update the status of your request to ") + @info_request.public_body.name + ".",
+ :email_subject => _("Update the status of your request to ") + @info_request.public_body.name
)
end
@@ -260,15 +260,15 @@ class RequestController < ApplicationController
message = ""
if @outgoing_message.contains_email?
if @user.nil?
- message += "<p>You do not need to include your email in the request in order to get a reply, as we will ask for it on the next screen (<a href=\"/help/privacy#email_address\">details</a>).</p>";
+ message += _("<p>You do not need to include your email in the request in order to get a reply, as we will ask for it on the next screen (<a href=\"%s\">details</a>).</p>") % [help_privacy_path+"#email_address"];
else
- message += "<p>You do not need to include your email in the request in order to get a reply (<a href=\"/help/privacy#email_address\">details</a>).</p>";
+ message += _("<p>You do not need to include your email in the request in order to get a reply (<a href=\"%s\">details</a>).</p>") % [help_privacy_path+"#email_address"];
end
- message += "<p>We recommend that you edit your request and remove the email address.
- If you leave it, the email address will be sent to the authority, but will not be displayed on the site.</p>"
+ message += _("<p>We recommend that you edit your request and remove the email address.
+ If you leave it, the email address will be sent to the authority, but will not be displayed on the site.</p>")
end
if @outgoing_message.contains_postcode?
- message += "<p>Your request contains a <strong>postcode</strong>. Unless it directly relates to the subject of your request, please remove any address as it will <strong>appear publicly on the Internet</strong>.</p>";
+ message += _("<p>Your request contains a <strong>postcode</strong>. Unless it directly relates to the subject of your request, please remove any address as it will <strong>appear publicly on the Internet</strong>.</p>");
end
if not message.empty?
flash.now[:error] = message
@@ -278,9 +278,9 @@ class RequestController < ApplicationController
end
if !authenticated?(
- :web => "To send your FOI request",
- :email => "Then your FOI request to " + @info_request.public_body.name + " will be sent.",
- :email_subject => "Confirm your FOI request to " + @info_request.public_body.name
+ :web => _("To send your FOI request"),
+ :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name),
+ :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name
)
# do nothing - as "authenticated?" has done the redirect to signin page for us
return
@@ -291,11 +291,11 @@ class RequestController < ApplicationController
@info_request.save!
# XXX send_message needs the database id, so we send after saving, which isn't ideal if the request broke here.
@outgoing_message.send_message
- flash[:notice] = "<p>Your " + @info_request.law_used_full + " request has been <strong>sent on its way</strong>!</p>
+ flash[:notice] = _("<p>Your {{law_used_full}} request has been <strong>sent on its way</strong>!</p>
<p><strong>We will email you</strong> when there is a response, or after 20 working days if the authority still hasn't
replied by then.</p>
<p>If you write about this request (for example in a forum or a blog) please link to this page, and add an
- annotation below telling people about your writing.</p>"
+ annotation below telling people about your writing.</p>",:law_used_full=>@info_request.law_used_full)
redirect_to request_url(@info_request)
end
@@ -317,22 +317,22 @@ class RequestController < ApplicationController
# Check authenticated, and parameters set. We check is_owning_user
# to get admin overrides (see is_owning_user? above)
if !@old_unclassified && !@is_owning_user && !authenticated_as_user?(@info_request.user,
- :web => "To classify the response to this FOI request",
- :email => "Then you can classify the FOI response you have got from " + @info_request.public_body.name + ".",
- :email_subject => "Classify an FOI response from " + @info_request.public_body.name
+ :web => _("To classify the response to this FOI request"),
+ :email => _("Then you can classify the FOI response you have got from ") + @info_request.public_body.name + ".",
+ :email_subject => _("Classify an FOI response from ") + @info_request.public_body.name
)
# do nothing - as "authenticated?" has done the redirect to signin page for us
return
end
if !params[:incoming_message]
- flash[:error] = "Please choose whether or not you got some of the information that you wanted."
+ flash[:error] = _("Please choose whether or not you got some of the information that you wanted.")
redirect_to request_url(@info_request)
return
end
if params[:last_info_request_event_id].to_i != @last_info_request_event_id
- flash[:error] = "The request has been updated since you originally loaded this page. Please check for any new incoming messages below, and try again."
+ flash[:error] = _("The request has been updated since you originally loaded this page. Please check for any new incoming messages below, and try again.")
redirect_to request_url(@info_request)
return
end
@@ -358,10 +358,10 @@ class RequestController < ApplicationController
# Don't give advice on what to do next, as it isn't their request
RequestMailer.deliver_old_unclassified_updated(@info_request)
if session[:request_game]
- flash[:notice] = 'Thank you for updating the status of the request \'<a href="' + CGI.escapeHTML(request_url(@info_request)) + '">' + CGI.escapeHTML(@info_request.title) + '</a>\'. There are some more requests below for you to classify.'
+ flash[:notice] = _('Thank you for updating the status of the request \'<a href="%s">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title)) % [CGI.escapeHTML(request_url(@info_request))]
redirect_to play_url
else
- flash[:notice] = 'Thank you for updating this request!'
+ flash[:notice] = _('Thank you for updating this request!')
redirect_to request_url(@info_request)
end
return
@@ -369,58 +369,59 @@ class RequestController < ApplicationController
# Display advice for requester on what to do next, as appropriate
if @info_request.calculate_status == 'waiting_response'
- flash[:notice] = "<p>Thank you! Hopefully your wait isn't too long.</p> <p>By law, you should get a response promptly, and " + (@info_request.public_body.is_school? ? "in term time" : "") + " normally before the end of <strong>" + simple_date(@info_request.date_response_required_by) + "</strong>.</p>"
+ flash[:notice] = _("<p>Thank you! Hopefully your wait isn't too long.</p> <p>By law, you should get a response promptly, and normally before the end of <strong>
+{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>simple_date(@info_request.date_response_required_by))
redirect_to request_url(@info_request)
elsif @info_request.calculate_status == 'waiting_response_overdue'
- flash[:notice] = "<p>Thank you! Hope you don't have to wait much longer.</p> <p>By law, you should have got a response promptly, and " + (@info_request.public_body.is_school? ? "in term time" : "") + " normally before the end of <strong>" + simple_date(@info_request.date_response_required_by) + "</strong>.</p>"
+ flash[:notice] = _("<p>Thank you! Hope you don't have to wait much longer.</p> <p>By law, you should have got a response promptly, and normally before the end of <strong>{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>simple_date(@info_request.date_response_required_by))
redirect_to request_url(@info_request)
elsif @info_request.calculate_status == 'waiting_response_very_overdue'
- flash[:notice] = "<p>Thank you! Your request is long overdue, by more than 40 working days. Most requests should be answered within 20 working days. You might like to complain about this, see below.</p>"
+ flash[:notice] = _("<p>Thank you! Your request is long overdue, by more than 40 working days. Most requests should be answered within 20 working days. You might like to complain about this, see below.</p>")
redirect_to unhappy_url(@info_request)
elsif @info_request.calculate_status == 'not_held'
- flash[:notice] = "<p>Thank you! Here are some ideas on what to do next:</p>
+ flash[:notice] = _("<p>Thank you! Here are some ideas on what to do next:</p>
<ul>
- <li>To send your request to another authority, first copy the text of your request below, then <a href=\"/new\">find the other authority</a>.</li>
+ <li>To send your request to another authority, first copy the text of your request below, then <a href=\"%s\">find the other authority</a>.</li>
<li>If you would like to contest the authority's claim that they do not hold the information, here is
- <a href=\"" + CGI.escapeHTML(unhappy_url(@info_request)) + "\">how to complain</a>.
+ <a href=\"%s\">how to complain</a>.
</li>
- <li>We have <a href=\"" + CGI.escapeHTML(unhappy_url(@info_request)) + "#other_means\">suggestions</a>
+ <li>We have <a href=\"%s\">suggestions</a>
on other means to answer your question.
</li>
</ul>
- "
+ ") % ["/new",CGI.escapeHTML(unhappy_url(@info_request)),CGI.escapeHTML(unhappy_url(@info_request)) + "#other_means"]
redirect_to request_url(@info_request)
elsif @info_request.calculate_status == 'rejected'
- flash[:notice] = "Oh no! Sorry to hear that your request was refused. Here is what to do now."
+ flash[:notice] = _("Oh no! Sorry to hear that your request was refused. Here is what to do now.")
redirect_to unhappy_url(@info_request)
elsif @info_request.calculate_status == 'successful'
- flash[:notice] = "<p>We're glad you got all the information that you wanted. If you write about or make use of the information, please come back and add an annotation below saying what you did.</p><p>If you found WhatDoTheyKnow useful, <a href=\"http://www.mysociety.org/donate/\">make a donation</a> to the charity which runs it.</p>"
+ flash[:notice] = _("<p>We're glad you got all the information that you wanted. If you write about or make use of the information, please come back and add an annotation below saying what you did.</p><p>If you found WhatDoTheyKnow useful, <a href=\"%s\">make a donation</a> to the charity which runs it.</p>") % ["http://www.mysociety.org/donate/"]
redirect_to request_url(@info_request)
elsif @info_request.calculate_status == 'partially_successful'
- flash[:notice] = "<p>We're glad you got some of the information that you wanted. If you found WhatDoTheyKnow useful, <a href=\"http://www.mysociety.org/donate/\">make a donation</a> to the charity which runs it.</p><p>If you want to try and get the rest of the information, here's what to do now.</p>"
+ flash[:notice] = _("<p>We're glad you got some of the information that you wanted. If you found WhatDoTheyKnow useful, <a href=\"%s\">make a donation</a> to the charity which runs it.</p><p>If you want to try and get the rest of the information, here's what to do now.</p>") % ["http://www.mysociety.org/donate/"]
redirect_to unhappy_url(@info_request)
elsif @info_request.calculate_status == 'waiting_clarification'
- flash[:notice] = "Please write your follow up message containing the necessary clarifications below."
+ flash[:notice] = _("Please write your follow up message containing the necessary clarifications below.")
redirect_to respond_to_last_url(@info_request)
elsif @info_request.calculate_status == 'gone_postal'
redirect_to respond_to_last_url(@info_request) + "?gone_postal=1"
elsif @info_request.calculate_status == 'deadline_extended'
- flash[:notice] = "Authority has requested extension of the deadline."
+ flash[:notice] = _("Authority has requested extension of the deadline.")
redirect_to unhappy_url(@info_request)
elsif @info_request.calculate_status == 'wrong_response'
- flash[:notice] = "Oh no! Sorry to hear that your request was wrong. Here is what to do now."
+ flash[:notice] = _("Oh no! Sorry to hear that your request was wrong. Here is what to do now.")
redirect_to unhappy_url(@info_request)
elsif @info_request.calculate_status == 'internal_review'
- flash[:notice] = "<p>Thank you! Hopefully your wait isn't too long.</p><p>You should get a response within 20 days, or be told if it will take longer (<a href=\"" + unhappy_url(@info_request) + "#internal_review\">details</a>).</p>"
+ flash[:notice] = _("<p>Thank you! Hopefully your wait isn't too long.</p><p>You should get a response within 20 days, or be told if it will take longer (<a href=\"%s\">details</a>).</p>") % [unhappy_url(@info_request) + "#internal_review"]
redirect_to request_url(@info_request)
elsif @info_request.calculate_status == 'error_message'
- flash[:notice] = "<p>Thank you! We'll look into what happened and try and fix it up.</p><p>If the error was a delivery failure, and you can find an up to date FOI email address for the authority, please tell us using the form below.</p>"
+ flash[:notice] = _("<p>Thank you! We'll look into what happened and try and fix it up.</p><p>If the error was a delivery failure, and you can find an up to date FOI email address for the authority, please tell us using the form below.</p>")
redirect_to help_general_url(:action => 'contact')
elsif @info_request.calculate_status == 'requires_admin'
- flash[:notice] = "Please use the form below to tell us more."
+ flash[:notice] = _("Please use the form below to tell us more.")
redirect_to help_general_url(:action => 'contact')
elsif @info_request.calculate_status == 'user_withdrawn'
- flash[:notice] = "If you have not done so already, please write a message below telling the authority that you have withdrawn your request. Otherwise they will not know it has been withdrawn."
+ flash[:notice] = _("If you have not done so already, please write a message below telling the authority that you have withdrawn your request. Otherwise they will not know it has been withdrawn.")
redirect_to respond_to_last_url(@info_request)
else
raise "unknown calculate_status " + @info_request.calculate_status
@@ -521,24 +522,24 @@ class RequestController < ApplicationController
# message and wasting their time if they are not the requester.
if !authenticated_as_user?(@info_request.user,
:web => @incoming_message.nil? ?
- "To send a follow up message to " + @info_request.public_body.name :
- "To reply to " + @info_request.public_body.name,
+ _("To send a follow up message to ") + @info_request.public_body.name :
+ _("To reply to ") + @info_request.public_body.name,
:email => @incoming_message.nil? ?
- "Then you can write follow up message to " + @info_request.public_body.name + "." :
- "Then you can write your reply to " + @info_request.public_body.name + ".",
+ _("Then you can write follow up message to ") + @info_request.public_body.name + "." :
+ _("Then you can write your reply to ") + @info_request.public_body.name + ".",
:email_subject => @incoming_message.nil? ?
- "Write your FOI follow up message to " + @info_request.public_body.name :
- "Write a reply to " + @info_request.public_body.name
+ _("Write your FOI follow up message to ") + @info_request.public_body.name :
+ _("Write a reply to ") + @info_request.public_body.name
)
return
end
if !params[:submitted_followup].nil? && !params[:reedit]
if @info_request.allow_new_responses_from == 'nobody'
- flash[:error] = 'Your follow up has not been sent because this request has been stopped to prevent spam. Please <a href="/help/contact">contact us</a> if you really want to send a follow up message.'
+ flash[:error] = _('Your follow up has not been sent because this request has been stopped to prevent spam. Please <a href="%s">contact us</a> if you really want to send a follow up message.') % [help_contact_path]
else
if @info_request.find_existing_outgoing_message(params[:outgoing_message][:body])
- flash[:error] = 'You previously submitted that exact follow up message for this request.'
+ flash[:error] = _('You previously submitted that exact follow up message for this request.')
render :action => 'show_response'
return
end
@@ -561,9 +562,9 @@ class RequestController < ApplicationController
@outgoing_message.send_message
@outgoing_message.save!
if @outgoing_message.what_doing == 'internal_review'
- flash[:notice] = "Your internal review request has been sent on its way."
+ flash[:notice] = _("Your internal review request has been sent on its way.")
else
- flash[:notice] = "Your follow up message has been sent on its way."
+ flash[:notice] = _("Your follow up message has been sent on its way.")
end
redirect_to request_url(@info_request)
end
@@ -681,9 +682,9 @@ class RequestController < ApplicationController
@info_request = InfoRequest.find_by_url_title(params[:url_title])
@reason_params = {
- :web => "To upload a response, you must be logged in using an email address from " + CGI.escapeHTML(@info_request.public_body.name),
- :email => "Then you can upload an FOI response. ",
- :email_subject => "Confirm your account on WhatDoTheyKnow.com"
+ :web => _("To upload a response, you must be logged in using an email address from ") + CGI.escapeHTML(@info_request.public_body.name),
+ :email => _("Then you can upload an FOI response. "),
+ :email_subject => _("Confirm your account on {{site_name}}",:site_name=>site_name)
}
if !authenticated?(@reason_params)
return
@@ -710,13 +711,13 @@ class RequestController < ApplicationController
body = params[:body] || ""
if file_name.nil? && body.empty?
- flash[:error] = "Please type a message and/or choose a file containing your response."
+ flash[:error] = _("Please type a message and/or choose a file containing your response.")
return
end
mail = RequestMailer.create_fake_response(@info_request, @user, body, file_name, file_content)
@info_request.receive(mail, mail.encoded, true)
- flash[:notice] = "Thank you for responding to this FOI request! Your response has been published below, and a link to your response has been emailed to " + CGI.escapeHTML(@info_request.user.name) + "."
+ flash[:notice] = _("Thank you for responding to this FOI request! Your response has been published below, and a link to your response has been emailed to ") + CGI.escapeHTML(@info_request.user.name) + "."
redirect_to request_url(@info_request)
return
end
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
index 0d70a2e03..b9440a906 100644
--- a/app/controllers/request_game_controller.rb
+++ b/app/controllers/request_game_controller.rb
@@ -20,7 +20,7 @@ class RequestGameController < ApplicationController
@requests = old.sort_by{ rand }.slice(0..2)
if @missing == 0
- flash[:notice] = '<p>All done! Thank you very much for your help.</p><p>There are <a href="/help/credits#helpus">more things you can do</a> to help WhatDoTheyKnow.</p>'
+ flash[:notice] = _('<p>All done! Thank you very much for your help.</p><p>There are <a href="%s">more things you can do</a> to help WhatDoTheyKnow.</p>') % [help_credits_path+"#helpus"]
end
@league_table_28_days = InfoRequestEvent.make_league_table(
@@ -35,9 +35,9 @@ class RequestGameController < ApplicationController
def show
url_title = params[:url_title]
if !authenticated?(
- :web => "To play the request categorisation game",
- :email => "Then you can play the request categorisation game.",
- :email_subject => "Play the request categorisation game"
+ :web => _("To play the request categorisation game"),
+ :email => _("Then you can play the request categorisation game."),
+ :email_subject => _("Play the request categorisation game")
)
# do nothing - as "authenticated?" has done the redirect to signin page for us
return
@@ -47,7 +47,7 @@ class RequestGameController < ApplicationController
def stop
session[:request_game] = nil
- flash[:notice] = 'Thank you for helping us keep the site tidy!'
+ flash[:notice] = _('Thank you for helping us keep the site tidy!')
redirect_to frontpage_url
end
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index e262db099..10b3418bd 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -93,7 +93,7 @@ class TrackController < ApplicationController
if @user
@existing_track = TrackThing.find_by_existing_track(@user, @track_thing)
if @existing_track
- flash[:notice] = "You are already being emailed updates about " + @track_thing.params[:list_description]
+ flash[:notice] = _("You are already being emailed updates about ") + @track_thing.params[:list_description]
return true
end
end
@@ -106,7 +106,7 @@ class TrackController < ApplicationController
@track_thing.tracking_user_id = @user.id
@track_thing.save!
- flash[:notice] = "You will now be emailed updates about " + @track_thing.params[:list_description]
+ flash[:notice] = _("You will now be emailed updates about ") + @track_thing.params[:list_description]
return true
end
@@ -138,9 +138,9 @@ class TrackController < ApplicationController
track_thing = TrackThing.find(params[:track_id].to_i)
if not authenticated_as_user?(track_thing.tracking_user,
- :web => "To cancel this alert",
- :email => "Then you can cancel the alert.",
- :email_subject => "Cancel a WhatDoTheyKnow alert"
+ :web => _("To cancel this alert"),
+ :email => _("Then you can cancel the alert."),
+ :email_subject => _("Cancel a {{site_name}} alert",:site_name=>site_name)
)
# do nothing - as "authenticated?" has done the redirect to signin page for us
return
@@ -149,7 +149,7 @@ class TrackController < ApplicationController
new_medium = params[:track_medium]
if new_medium == 'delete'
track_thing.destroy
- flash[:notice] = "You will no longer be emailed updates about " + track_thing.params[:list_description]
+ flash[:notice] = _("You will no longer be emailed updates about ") + track_thing.params[:list_description]
redirect_to params[:r]
# Reuse code like this if we let medium change again.
#elsif new_medium == 'email_daily'
@@ -168,9 +168,9 @@ class TrackController < ApplicationController
user_id = User.find(params[:user].to_i)
if not authenticated_as_user?(user_id,
- :web => "To cancel these alerts",
- :email => "Then you can cancel the alerts.",
- :email_subject => "Cancel some WhatDoTheyKnow alerts"
+ :web => _("To cancel these alerts"),
+ :email => _("Then you can cancel the alerts."),
+ :email_subject => _("Cancel some {{site_name}} alerts",:site_name=>site_name)
)
# do nothing - as "authenticated?" has done the redirect to signin page for us
return
@@ -178,7 +178,7 @@ class TrackController < ApplicationController
track_type = params[:track_type]
- flash[:notice] = "You will no longer be emailed updates for those alerts"
+ flash[:notice] = _("You will no longer be emailed updates for those alerts")
for track_thing in TrackThing.find(:all, :conditions => [ "track_type = ? and tracking_user_id = ?", track_type, user_id ])
track_thing.destroy
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 49e46b6fa..823366957 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -185,7 +185,7 @@ class UserController < ApplicationController
if params[:submitted_signchangepassword_send_confirm]
# They've entered the email, check it is OK and user exists
if not MySociety::Validate.is_valid_email(params[:signchangepassword][:email])
- flash[:error] = "That doesn't look like a valid email address. Please check you have typed it correctly."
+ flash[:error] = _("That doesn't look like a valid email address. Please check you have typed it correctly.")
render :action => 'signchangepassword_send_confirm'
return
end
@@ -199,8 +199,8 @@ class UserController < ApplicationController
post_redirect = PostRedirect.new(:uri => url , :post_params => {},
:reason_params => {
:web => "",
- :email => "Then you can change your password on WhatDoTheyKnow.com",
- :email_subject => "Change your password on WhatDoTheyKnow.com"
+ :email => _("Then you can change your password on {{site_name}}",:site_name=>site_name),
+ :email_subject => _("Change your password {{site_name}}",:site_name=>site_name)
},
:circumstance => "change_password" # special login that lets you change your password
)
@@ -227,7 +227,7 @@ class UserController < ApplicationController
render :action => 'signchangepassword'
else
@user.save!
- flash[:notice] = "Your password has been changed."
+ flash[:notice] = _("Your password has been changed.")
if params[:pretoken] and not params[:pretoken].empty?
post_redirect = PostRedirect.find_by_token(params[:pretoken])
do_post_redirect post_redirect
@@ -244,9 +244,9 @@ class UserController < ApplicationController
# Change your email
def signchangeemail
if not authenticated?(
- :web => "To change your email address used on WhatDoTheyKnow.com",
- :email => "Then you can change your email address used on WhatDoTheyKnow.com",
- :email_subject => "Change your email address used on WhatDoTheyKnow.com"
+ :web => _("To change your email address used on {{site_name}}",:site_name=>site_name),
+ :email => _("Then you can change your email address used on {{site_name}}",:site_name=>site_name),
+ :email_subject => _("Change your email address used on {{site_name}}",:site_name=>site_name)
)
# "authenticated?" has done the redirect to signin page for us
return
@@ -297,7 +297,7 @@ class UserController < ApplicationController
# circumstance is 'change_email', so can actually change the email
@user.email = @signchangeemail.new_email
@user.save!
- flash[:notice] = "You have now changed your email address used on WhatDoTheyKnow.com"
+ flash[:notice] = _("You have now changed your email address used on {{site_name}}",:site_name=>site_name)
redirect_to user_url(@user)
end
@@ -316,9 +316,9 @@ class UserController < ApplicationController
# partly to avoid spam, and partly to have some equanimity of openess
# between the two users)
if not authenticated?(
- :web => "To send a message to " + CGI.escapeHTML(@recipient_user.name),
- :email => "Then you can send a message to " + @recipient_user.name + ".",
- :email_subject => "Send a message to " + @recipient_user.name
+ :web => _("To send a message to ") + CGI.escapeHTML(@recipient_user.name),
+ :email => _("Then you can send a message to ") + @recipient_user.name + ".",
+ :email_subject => _("Send a message to ") + @recipient_user.name
)
# "authenticated?" has done the redirect to signin page for us
return
@@ -336,13 +336,13 @@ class UserController < ApplicationController
params[:contact][:subject],
params[:contact][:message]
)
- flash[:notice] = "Your message to " + CGI.escapeHTML(@recipient_user.name) + " has been sent!"
+ flash[:notice] = _("Your message to {{recipient_user_name}} has been sent!",:recipient_user_name=>CGI.escapeHTML(@recipient_user.name))
redirect_to user_url(@recipient_user)
return
end
else
@contact = ContactValidator.new(
- { :message => "" + @recipient_user.name + ",\n\n\n\nYours,\n\n" + @user.name }
+ { :message => "" + @recipient_user.name + _(",\n\n\n\nYours,\n\n{{user_name}}",:user_name=>@user.name) }
)
end
@@ -358,7 +358,7 @@ class UserController < ApplicationController
def set_profile_photo
# check they are logged in (the upload photo option is anyway only available when logged in)
if authenticated_user.nil?
- flash[:error] = "You need to be logged in to change your profile photo."
+ flash[:error] = _("You need to be logged in to change your profile photo.")
redirect_to frontpage_url
return
end
@@ -385,7 +385,7 @@ class UserController < ApplicationController
@profile_photo = ProfilePhoto.new(:data => @draft_profile_photo.data, :draft => false)
@user.set_profile_photo(@profile_photo)
@draft_profile_photo.destroy
- flash[:notice] = "Thank you for updating your profile photo"
+ flash[:notice] = _("Thank you for updating your profile photo")
redirect_to user_url(@user)
return
end
@@ -401,11 +401,11 @@ class UserController < ApplicationController
draft_profile_photo.destroy
if !@user.get_about_me_for_html_display.empty?
- flash[:notice] = "Thank you for updating your profile photo"
+ flash[:notice] = _("Thank you for updating your profile photo")
redirect_to user_url(@user)
else
- flash[:notice] = "<p>Thanks for updating your profile photo.</p>
- <p><strong>Next...</strong> You can put some text about you and your research on your profile.</p>"
+ flash[:notice] = _("<p>Thanks for updating your profile photo.</p>
+ <p><strong>Next...</strong> You can put some text about you and your research on your profile.</p>")
redirect_to set_profile_about_me_url()
end
else
@@ -420,7 +420,7 @@ class UserController < ApplicationController
# check they are logged in (the upload photo option is anyway only available when logged in)
if authenticated_user.nil?
- flash[:error] = "You need to be logged in to clear your profile photo."
+ flash[:error] = _("You need to be logged in to clear your profile photo.")
redirect_to frontpage_url
return
end
@@ -429,7 +429,7 @@ class UserController < ApplicationController
@user.profile_photo.destroy
end
- flash[:notice] = "You've now cleared your profile photo"
+ flash[:notice] = _("You've now cleared your profile photo")
redirect_to user_url(@user)
end
@@ -457,7 +457,7 @@ class UserController < ApplicationController
# Change about me text on your profile page
def set_profile_about_me
if authenticated_user.nil?
- flash[:error] = "You need to be logged in to change the text about you on your profile."
+ flash[:error] = _("You need to be logged in to change the text about you on your profile.")
redirect_to frontpage_url
return
end
@@ -479,11 +479,11 @@ class UserController < ApplicationController
@user.about_me = @about_me.about_me
@user.save!
if @user.profile_photo
- flash[:notice] = "You have now changed the text about you on your profile."
+ flash[:notice] = _("You have now changed the text about you on your profile.")
redirect_to user_url(@user)
else
- flash[:notice] = "<p>Thanks for changing the text about you on your profile.</p>
- <p><strong>Next...</strong> You can upload a profile photograph too.</p>"
+ flash[:notice] = _("<p>Thanks for changing the text about you on your profile.</p>
+ <p><strong>Next...</strong> You can upload a profile photograph too.</p>")
redirect_to set_profile_photo_url()
end
end
@@ -501,8 +501,8 @@ class UserController < ApplicationController
@post_redirect = PostRedirect.new(:uri => params[:r], :post_params => {},
:reason_params => {
:web => "",
- :email => "Then you can sign in to WhatDoTheyKnow.com",
- :email_subject => "Confirm your account on WhatDoTheyKnow.com"
+ :email => _("Then you can sign in to {{site_name}}",:site_name=>site_name),
+ :email_subject => _("Confirm your account on {{site_name}}",:site_name=>site_name)
})
@post_redirect.save!
params[:token] = @post_redirect.token