aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_general_controller.rb7
-rw-r--r--app/controllers/admin_public_body_controller.rb6
-rw-r--r--app/controllers/admin_request_controller.rb17
-rw-r--r--app/controllers/application_controller.rb25
-rw-r--r--app/controllers/general_controller.rb4
-rw-r--r--app/controllers/request_controller.rb18
-rw-r--r--app/controllers/request_game_controller.rb4
-rw-r--r--app/helpers/application_helper.rb5
-rw-r--r--app/helpers/config_helper.rb5
-rw-r--r--app/models/application_mailer.rb3
-rw-r--r--app/models/incoming_message.rb25
-rw-r--r--app/models/info_request.rb52
-rw-r--r--app/models/info_request_event.rb7
-rw-r--r--app/models/public_body.rb55
-rw-r--r--app/models/raw_email.rb2
-rw-r--r--app/models/request_mailer.rb5
-rw-r--r--app/models/track_mailer.rb2
-rw-r--r--app/models/track_thing.rb58
-rw-r--r--app/models/user_mailer.rb4
-rw-r--r--app/views/admin_public_body/import_csv.rhtml17
-rw-r--r--app/views/admin_request/show_raw_email.rhtml5
-rw-r--r--app/views/comment/new.rhtml2
-rw-r--r--app/views/contact_mailer/message.rhtml2
-rw-r--r--app/views/contact_mailer/user_message.rhtml4
-rw-r--r--app/views/general/search.rhtml40
-rw-r--r--app/views/layouts/admin.rhtml2
-rw-r--r--app/views/outgoing_mailer/initial_request.rhtml2
-rw-r--r--app/views/public_body/_body_listing_single.rhtml6
-rw-r--r--app/views/public_body/show.rhtml2
-rw-r--r--app/views/public_body/view_email.rhtml2
-rw-r--r--app/views/request/details.rhtml15
-rw-r--r--app/views/request/show.rhtml4
-rw-r--r--app/views/request_mailer/comment_on_alert.rhtml2
-rw-r--r--app/views/request_mailer/comment_on_alert_plural.rhtml2
-rw-r--r--app/views/request_mailer/new_response.rhtml2
-rw-r--r--app/views/request_mailer/new_response_reminder_alert.rhtml2
-rw-r--r--app/views/request_mailer/not_clarified_alert.rhtml2
-rw-r--r--app/views/request_mailer/old_unclassified_updated.rhtml2
-rw-r--r--app/views/request_mailer/overdue_alert.rhtml2
-rw-r--r--app/views/request_mailer/stopped_responses.rhtml2
-rw-r--r--app/views/request_mailer/very_overdue_alert.rhtml2
-rw-r--r--app/views/track_mailer/event_digest.rhtml2
-rw-r--r--app/views/user/_signin.rhtml2
-rw-r--r--app/views/user/_signup.rhtml2
-rw-r--r--app/views/user/set_crop_profile_photo.rhtml2
-rw-r--r--app/views/user/set_draft_profile_photo.rhtml2
-rw-r--r--app/views/user/set_profile_about_me.rhtml6
-rw-r--r--app/views/user/show.rhtml4
-rw-r--r--app/views/user/signchangeemail.rhtml2
-rw-r--r--app/views/user_mailer/already_registered.rhtml6
-rw-r--r--app/views/user_mailer/changeemail_already_used.rhtml7
-rw-r--r--app/views/user_mailer/changeemail_confirm.rhtml7
-rw-r--r--app/views/user_mailer/confirm_login.rhtml2
53 files changed, 292 insertions, 177 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 5073cdc5b..ae51e0923 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -8,6 +8,13 @@
class AdminGeneralController < AdminController
def index
+ # ensure we have a trailing slash
+ current_uri = request.env['REQUEST_URI']
+ if params[:suppress_redirect].nil? && !(current_uri =~ /\/$/)
+ redirect_to admin_general_index_url + "/"
+ return
+ end
+
# Overview counts of things
@public_body_count = PublicBody.count
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index f88b25572..021122734 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -154,10 +154,10 @@ class AdminPublicBodyController < AdminController
else
raise "internal error, unknown button label"
end
-
+
# Try with dry run first
csv_contents = params[:csv_file].read
- en = PublicBody.import_csv(csv_contents, params[:tag], true, admin_http_auth_user())
+ en = PublicBody.import_csv(csv_contents, params[:tag], true, admin_http_auth_user(), I18n.available_locales)
errors = en[0]
notes = en[1]
@@ -166,7 +166,7 @@ class AdminPublicBodyController < AdminController
notes.push("Dry run was successful, real run would do as above.")
else
# And if OK, with real run
- en = PublicBody.import_csv(csv_contents, params[:tag], false, admin_http_auth_user())
+ en = PublicBody.import_csv(csv_contents, params[:tag], false, admin_http_auth_user(), available_locales)
errors = en[0]
notes = en[1]
if errors.size != 0
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index d5bd4c4d6..e5de4f8b7 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -177,7 +177,7 @@ class AdminRequestController < AdminController
raw_email_data = incoming_message.raw_email.data
mail = TMail::Mail.parse(raw_email_data)
mail.base64_decode
- destination_request.receive(mail, raw_email_data)
+ destination_request.receive(mail, raw_email_data, true)
incoming_message_id = incoming_message.id
incoming_message.fully_destroy
@@ -275,7 +275,6 @@ class AdminRequestController < AdminController
def show_raw_email
@raw_email = RawEmail.find(params[:id])
-
# For the holding pen, try to guess where it should be ...
@holding_pen = false
if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request && !@raw_email.incoming_message.mail.from_addrs.nil? && @raw_email.incoming_message.mail.from_addrs.size > 0)
@@ -294,15 +293,11 @@ class AdminRequestController < AdminController
end
# 2. Match the email address in the message without matching the hash
- @info_requests = []
- addresses =
- (@raw_email.incoming_message.mail.to || []) +
- (@raw_email.incoming_message.mail.cc || []) +
- (@raw_email.incoming_message.mail.envelope_to || [])
- addresses.uniq!
- for address in addresses
- @info_requests += InfoRequest.guess_by_incoming_email(address)
- end
+ @info_requests = InfoRequest.guess_by_incoming_email(@raw_email.incoming_message)
+
+ # 3. Give a reason why it's in the holding pen
+ last_event = InfoRequestEvent.find_by_incoming_message_id(@raw_email.incoming_message.id)
+ @rejected_reason = last_event.params[:rejected_reason]
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 4e6ad5efb..8ef23f49d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -42,18 +42,18 @@ class ApplicationController < ActionController::Base
end
def set_gettext_locale
- requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE']
+ if MySociety::Config.get('USE_DEFAULT_BROWSER_LANGUAGE', true)
+ requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale
+ else
+ requested_locale = params[:locale] || session[:locale] || cookies[:locale] || I18n.default_locale
+ end
session[:locale] = FastGettext.set_locale(requested_locale)
end
# scrub sensitive parameters from the logs
filter_parameter_logging :password
- helper_method :site_name, :locale_from_params
- def site_name
- site_name = MySociety::Config.get('SITE_NAME', 'Alaveteli')
- return site_name
- end
+ helper_method :locale_from_params
# Help work out which request causes RAM spike.
# http://www.codeweblog.com/rails-to-monitor-the-process-of-memory-leaks-skills/
@@ -223,7 +223,11 @@ class ApplicationController < ActionController::Base
if session[:user_id].nil?
return nil
else
- return User.find(session[:user_id])
+ begin
+ return User.find(session[:user_id])
+ rescue ActiveRecord::RecordNotFound
+ return nil
+ end
end
end
@@ -274,7 +278,9 @@ class ApplicationController < ActionController::Base
def check_read_only
read_only = MySociety::Config.get('READ_ONLY', '')
if !read_only.empty?
- flash[:notice] = "<p>WhatDoTheyKnow is currently in maintenance. You can only view existing requests. You cannot make new ones, add followups or annotations, or otherwise change the database.</p> <p>" + read_only + "</p>"
+ flash[:notice] = _("<p>{{site_name}} is currently in maintenance. You can only view existing requests. You cannot make new ones, add followups or annotations, or otherwise change the database.</p> <p>{{read_only}}</p>",
+ :site_name => site_name,
+ :read_only => read_only)
redirect_to frontpage_url
end
@@ -349,6 +355,9 @@ class ApplicationController < ActionController::Base
# views (for links) and mailers (for use in emails), so include them into
# all of all.
include LinkToHelper
+
+ # Site-wide access to configuration settings
+ include ConfigHelper
end
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index ffc97237a..4fa603aab 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -63,7 +63,7 @@ class GeneralController < ApplicationController
end
end
- # Display WhatDoTheyKnow category from mySociety blog
+ # Display blog entries
def blog
medium_cache
@feed_autodetect = []
@@ -73,7 +73,7 @@ class GeneralController < ApplicationController
@data = XmlSimple.xml_in(content)
@channel = @data['channel'][0]
@blog_items = @channel['item']
- @feed_autodetect = [ { :url => feed_url, :title => "WhatDoTheyKnow blog"} ]
+ @feed_autodetect = [{:url => feed_url, :title => "#{site_name} blog"}]
else
@blog_items = []
end
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 88fb9be6c..fac57c7e0 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -402,24 +402,26 @@ class RequestController < ApplicationController
elsif @info_request.calculate_status == 'not_held'
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=\"%s\">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=\"{{find_authority_url}}\">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=\"%s\">how to complain</a>.
+ <a href=\"{{complain_url}}\">how to complain</a>.
</li>
- <li>We have <a href=\"%s\">suggestions</a>
+ <li>We have <a href=\"{{other_means_url}}\">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"]
+ </ul>",
+ :find_authority_url => "/new",
+ :complain_url => CGI.escapeHTML(unhappy_url(@info_request)),
+ :other_means_url => 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.")
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=\"%s\">make a donation</a> to the charity which runs it.</p>") % ["http://www.mysociety.org/donate/"]
+ 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 {{site_name}} useful, <a href=\"{{donation_url}}\">make a donation</a> to the charity which runs it.</p>", :site_name=>site_name, :donation_url => "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=\"%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/"]
+ flash[:notice] = _("<p>We're glad you got some of the information that you wanted. If you found {{site_name}} useful, <a href=\"{{donation_url}}\">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>", :site_name=>site_name, :donation_url=>"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.")
@@ -427,7 +429,7 @@ class RequestController < ApplicationController
elsif @info_request.calculate_status == 'gone_postal'
redirect_to respond_to_last_url(@info_request) + "?gone_postal=1"
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=\"%s\">details</a>).</p>") % [unhappy_url(@info_request) + "#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=\"{{review_url}}\">details</a>).</p>", :review_url => 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>")
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
index b9440a906..8a84575bb 100644
--- a/app/controllers/request_game_controller.rb
+++ b/app/controllers/request_game_controller.rb
@@ -20,7 +20,9 @@ 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="%s">more things you can do</a> to help WhatDoTheyKnow.</p>') % [help_credits_path+"#helpus"]
+ flash[:notice] = _('<p>All done! Thank you very much for your help.</p><p>There are <a href="{{helpus_url}}">more things you can do</a> to help {{site_name}}.</p>',
+ :helpus_url => help_credits_path+"#helpus",
+ :site_name => site_name)
end
@league_table_28_days = InfoRequestEvent.make_league_table(
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 9bdcb98cd..ec56566a9 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -14,6 +14,9 @@ module ApplicationHelper
# all of all.
include LinkToHelper
+ # Site-wide access to configuration settings
+ include ConfigHelper
+
# Copied from error_messages_for in active_record_helper.rb
def foi_error_messages_for(*params)
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
@@ -45,7 +48,7 @@ module ApplicationHelper
''
end
end
-
+
# Highlight words, also escapes HTML (other than spans that we add)
def highlight_words(t, words, html = true)
if html
diff --git a/app/helpers/config_helper.rb b/app/helpers/config_helper.rb
new file mode 100644
index 000000000..80f2deed2
--- /dev/null
+++ b/app/helpers/config_helper.rb
@@ -0,0 +1,5 @@
+module ConfigHelper
+ def site_name
+ MySociety::Config.get('SITE_NAME', 'Alaveteli')
+ end
+end \ No newline at end of file
diff --git a/app/models/application_mailer.rb b/app/models/application_mailer.rb
index 508ff2016..9628d7339 100644
--- a/app/models/application_mailer.rb
+++ b/app/models/application_mailer.rb
@@ -28,5 +28,8 @@ class ApplicationMailer < ActionMailer::Base
# views (for links) and mailers (for use in emails), so include them into
# all of all.
include LinkToHelper
+
+ # Site-wide access to configuration settings
+ include ConfigHelper
end
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 581c73f8b..ae7d1201e 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -431,7 +431,7 @@ class IncomingMessage < ActiveRecord::Base
text.gsub!(self.info_request.public_body.request_email, "[" + self.info_request.public_body.short_or_long_name + " request email]")
end
text.gsub!(self.info_request.incoming_email, "[FOI #" + self.info_request.id.to_s + " email]")
- text.gsub!(MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost'), "[WhatDoTheyKnow contact email]")
+ text.gsub!(MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost'), "[#{MySociety::Config.get('SITE_NAME', 'Alaveteli')} contact email]")
end
# Replaces all email addresses in (possibly binary data) with equal length alternative ones.
@@ -461,11 +461,23 @@ class IncomingMessage < ActiveRecord::Base
if censored_uncompressed_text != uncompressed_text
# then use the altered file (recompressed)
recompressed_text = nil
- IO.popen("/usr/bin/pdftk - output - compress", "r+") do |child|
+ if MySociety::Config.get('USE_GHOSTSCRIPT_COMPRESSION') == true
+ command = "gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=- -"
+ else
+ command = "/usr/bin/pdftk - output - compress"
+ end
+ IO.popen(command, "r+") do |child|
child.write(censored_uncompressed_text)
child.close_write()
recompressed_text = child.read()
end
+ if recompressed_text.nil? || recompressed_text.empty?
+ # buggy versions of pdftk sometimes fail on
+ # compression, I don't see it's a disaster in
+ # these cases to save an uncompressed version?
+ recompressed_text = censored_uncompressed_text
+ logger.warn "Unable to compress PDF; problem with your pdftk version?"
+ end
if !recompressed_text.nil? && !recompressed_text.empty?
text[0..-1] = recompressed_text # [0..-1] makes it change the 'text' string in place
end
@@ -850,7 +862,9 @@ class IncomingMessage < ActiveRecord::Base
text = Iconv.conv('utf-8', 'windows-1252', text)
rescue Iconv::IllegalSequence
# Text looks like unlabelled nonsense, strip out anything that isn't UTF-8
- text = Iconv.conv('utf-8//IGNORE', 'utf-8', text) + "\n\n[ WhatDoTheyKnow note: The above text was badly encoded, and has had strange characters removed. ]"
+ text = Iconv.conv('utf-8//IGNORE', 'utf-8', text) +
+ _("\n\n[ {{site_name}} note: The above text was badly encoded, and has had strange characters removed. ]",
+ :site_name => MySociety::Config.get('SITE_NAME', 'Alaveteli'))
end
end
end
@@ -1119,7 +1133,7 @@ class IncomingMessage < ActiveRecord::Base
external_command("/usr/bin/catdoc", tempfile.path, :append_to => text)
elsif content_type == 'text/html'
# lynx wordwraps links in its output, which then don't get formatted properly
- # by WhatDoTheyKnow. We use elinks instead, which doesn't do that.
+ # by Alaveteli. We use elinks instead, which doesn't do that.
external_command("/usr/bin/elinks", "-dump-charset", "utf-8", "-force-html", "-dump",
tempfile.path, :append_to => text)
elsif content_type == 'application/vnd.ms-excel'
@@ -1237,9 +1251,8 @@ class IncomingMessage < ActiveRecord::Base
info_request_event.track_things_sent_emails.each { |a| a.destroy }
info_request_event.user_info_request_sent_alerts.each { |a| a.destroy }
info_request_event.destroy
- raw_email = self.raw_email
+ self.raw_email.destroy_file_representation!
self.destroy
- self.raw_email.destroy
end
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 209954b16..419546c99 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -17,7 +17,6 @@
# allow_new_responses_from :string(255) default("anybody"), not null
# handle_rejected_responses :string(255) default("bounce"), not null
#
-
# models/info_request.rb:
# A Freedom of Information request.
#
@@ -309,13 +308,20 @@ public
# Return list of info requests which *might* be right given email address
# e.g. For the id-hash email addresses, don't match the hash.
- def InfoRequest.guess_by_incoming_email(incoming_email)
- id, hash = InfoRequest._extract_id_hash_from_email(incoming_email)
- begin
- return [InfoRequest.find(id)]
- rescue ActiveRecord::RecordNotFound
- return []
+ def InfoRequest.guess_by_incoming_email(incoming_message)
+ guesses = []
+ # 1. Try to guess based on the email address(es)
+ addresses =
+ (incoming_message.mail.to || []) +
+ (incoming_message.mail.cc || []) +
+ (incoming_message.mail.envelope_to || [])
+ addresses.uniq!
+ for address in addresses
+ id, hash = InfoRequest._extract_id_hash_from_email(address)
+ guesses.push(InfoRequest.find_by_id(id))
+ guesses.push(InfoRequest.find_by_idhash(hash))
end
+ return guesses.select{|x| !x.nil?}.uniq
end
# Internal function used by find_by_magic_email and guess_by_incoming_email
@@ -326,7 +332,7 @@ public
# The optional bounce- dates from when we used to have separate emails for the envelope from.
# (that was abandoned because councils would send hand written responses to them, not just
# bounce messages)
- incoming_email =~ /request-(?:bounce-)?(\d+)-([a-z0-9]+)/
+ incoming_email =~ /request-(?:bounce-)?([a-z0-9]+)-([a-z0-9]+)/
id = $1.to_i
hash = $2
@@ -379,21 +385,24 @@ public
end
# A new incoming email to this request
- def receive(email, raw_email_data, override_stop_new_responses = false)
+ def receive(email, raw_email_data, override_stop_new_responses = false, rejected_reason = "")
if !override_stop_new_responses
allow = nil
-
+ reason = nil
# See if new responses are prevented for spam reasons
if self.allow_new_responses_from == 'nobody'
allow = false
+ reason = _('This request has been set by an administrator to "allow new responses from nobody"')
elsif self.allow_new_responses_from == 'anybody'
allow = true
elsif self.allow_new_responses_from == 'authority_only'
if email.from_addrs.nil? || email.from_addrs.size == 0
allow = false
+ reason = _('Only the authority can reply to this request, but there is no "From" address to check against')
else
sender_email = email.from_addrs[0].spec
sender_domain = PublicBody.extract_domain_from_email(sender_email)
+ reason = _("Only the authority can reply to this request, and I don't recognise the address this reply was sent from")
allow = false
# Allow any domain that has already sent reply
for row in self.who_can_followup_to
@@ -411,7 +420,7 @@ public
if self.handle_rejected_responses == 'bounce'
RequestMailer.deliver_stopped_responses(self, email, raw_email_data)
elsif self.handle_rejected_responses == 'holding_pen'
- InfoRequest.holding_pen_request.receive(email, raw_email_data)
+ InfoRequest.holding_pen_request.receive(email, raw_email_data, false, reason)
elsif self.handle_rejected_responses == 'blackhole'
# do nothing - just lose the message (Note: a copy will be
# in the backup mailbox if the server is configured to send
@@ -435,7 +444,11 @@ public
raw_email.save!
self.awaiting_description = true
- self.log_event("response", { :incoming_message_id => incoming_message.id })
+ params = { :incoming_message_id => incoming_message.id }
+ if !rejected_reason.empty?
+ params[:rejected_reason] = rejected_reason
+ end
+ self.log_event("response", params)
self.save!
end
@@ -671,6 +684,7 @@ public
end
end
return nil
+
end
def get_last_response_event
for e in self.info_request_events.reverse
@@ -831,15 +845,25 @@ public
def InfoRequest.magic_email_for_id(prefix_part, id)
magic_email = MySociety::Config.get("INCOMING_EMAIL_PREFIX", "")
magic_email += prefix_part + id.to_s
- magic_email += "-" + Digest::SHA1.hexdigest(id.to_s + MySociety::Config.get("INCOMING_EMAIL_SECRET", 'dummysecret'))[0,8]
+ magic_email += "-" + InfoRequest.hash_from_id(id)
magic_email += "@" + MySociety::Config.get("INCOMING_EMAIL_DOMAIN", "localhost")
return magic_email
end
+ before_validation :compute_idhash
+
+ def compute_idhash
+ self.idhash = InfoRequest.hash_from_id(self.id)
+ end
+
+ def InfoRequest.hash_from_id(id)
+ return Digest::SHA1.hexdigest(id.to_s + MySociety::Config.get("INCOMING_EMAIL_SECRET", 'dummysecret'))[0,8]
+ end
+
# Called by find_by_incoming_email - and used to be called by separate
# function for envelope from address, until we abandoned it.
def InfoRequest.find_by_magic_email(id, hash)
- expected_hash = Digest::SHA1.hexdigest(id.to_s + MySociety::Config.get("INCOMING_EMAIL_SECRET", 'dummysecret'))[0,8]
+ expected_hash = InfoRequest.hash_from_id(id)
#print "expected: " + expected_hash + "\nhash: " + hash + "\n"
if hash != expected_hash
return nil
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 02b9a34ac..d79647c98 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -121,7 +121,12 @@ class InfoRequestEvent < ActiveRecord::Base
self.info_request.user.url_name
end
def requested_from
- self.info_request.public_body.url_name
+ # acts_as_xapian will detect translated fields via Globalize and add all the
+ # available locales to the index. But 'requested_from' is not translated directly,
+ # although it relies on a translated field in PublicBody. Hence, we need to
+ # manually add all the localized values to the index (Xapian can handle a list
+ # of values in a term, btw)
+ self.info_request.public_body.translations.map {|t| t.url_name}
end
def commented_by
if self.event_type == 'comment'
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 0e32a5164..ef1d60e26 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -310,29 +310,39 @@ class PublicBody < ActiveRecord::Base
# Import from CSV. Just tests things and returns messages if dry_run is true.
# Returns an array of [array of errors, array of notes]. If there are errors,
# always rolls back (as with dry_run).
- def self.import_csv(csv, tag, dry_run, editor)
+ def self.import_csv(csv, tag, dry_run, editor, additional_locales = [])
errors = []
notes = []
begin
ActiveRecord::Base.transaction do
- existing_bodies = PublicBody.find_by_tag(tag)
-
+ # Use the default locale when retrieving existing bodies; otherwise
+ # matching names won't work afterwards, and we'll create new bodies instead
+ # of updating them
bodies_by_name = {}
set_of_existing = Set.new()
- for existing_body in existing_bodies
- bodies_by_name[existing_body.name] = existing_body
- set_of_existing.add(existing_body.name)
+ PublicBody.with_locale(I18n.default_locale) do
+ for existing_body in PublicBody.find_by_tag(tag)
+ bodies_by_name[existing_body.name] = existing_body
+ set_of_existing.add(existing_body.name)
+ end
end
-
+
set_of_importing = Set.new()
+ field_names = { 'name'=>1, 'email'=>2 } # Default values in case no field list is given
line = 0
-
CSV::Reader.parse(csv) do |row|
line = line + 1
- name = row[1]
- email = row[2]
+ # Parse the first line as a field list if it starts with '#'
+ if line==1 and row.to_s =~ /^#(.*)$/
+ row[0] = row[0][1..-1] # Remove the # sign on first field
+ row.each_with_index {|field, i| field_names[field] = i}
+ next
+ end
+
+ name = row[field_names['name']]
+ email = row[field_names['email']]
next if name.nil?
if email.nil?
email = '' # unknown/bad contact is empty string
@@ -353,15 +363,38 @@ class PublicBody < ActiveRecord::Base
notes.push "line " + line.to_s + ": updating email for '" + name + "' from " + public_body.request_email + " to " + email
public_body.request_email = email
public_body.last_edit_editor = editor
- public_body.last_edit_comment = 'Updated from spreadsheet'
+ public_body.last_edit_comment = 'Updated from spreadsheet'
public_body.save!
end
+
+ additional_locales.each do |locale|
+ localized_name = field_names["name.#{locale}"] && row[field_names["name.#{locale}"]]
+ PublicBody.with_locale(locale) do
+ if !localized_name.nil? and public_body.name != localized_name
+ notes.push "line " + line.to_s + ": updating name for '#{name}' from '#{public_body.name}' to '#{localized_name}' (locale: #{locale})."
+ public_body.name = localized_name
+ public_body.save!
+ end
+ end
+ end
else
# New public body
notes.push "line " + line.to_s + ": new authority '" + name + "' with email " + email
public_body = PublicBody.new(:name => name, :request_email => email, :short_name => "", :home_page => "", :publication_scheme => "", :notes => "", :last_edit_editor => editor, :last_edit_comment => 'Created from spreadsheet')
public_body.tag_string = tag
public_body.save!
+
+ additional_locales.each do |locale|
+ localized_name = field_names["name.#{locale}"] && row[field_names["name.#{locale}"]]
+ if !localized_name.nil?
+ PublicBody.with_locale(locale) do
+ notes.push "line " + line.to_s + ": (aka '#{localized_name}' in locale #{locale})"
+ public_body.name = localized_name
+ public_body.publication_scheme = ""
+ public_body.save!
+ end
+ end
+ end
end
set_of_importing.add(name)
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index eb36053c1..c6066cbf4 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -20,8 +20,6 @@ class RawEmail < ActiveRecord::Base
has_one :incoming_message
- before_destroy :destroy_file_representation!
-
# We keep the old data_text field (which is of type text) for backwards
# compatibility. We use the new data_binary field because only it works
# properly in recent versions of PostgreSQL (get seg faults escaping
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index e73b153b9..fc317d20d 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -205,10 +205,11 @@ class RequestMailer < ApplicationMailer
def receive(email, raw_email)
# Find which info requests the email is for
reply_info_requests = self.requests_matching_email(email)
-
# Nothing found, so save in holding pen
if reply_info_requests.size == 0
- InfoRequest.holding_pen_request.receive(email, raw_email)
+ reason = _("Could not identify the request from the email address")
+ request = InfoRequest.holding_pen_request
+ request.receive(email, raw_email, false, reason)
return
end
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb
index 6901a834d..4b7c603a7 100644
--- a/app/models/track_mailer.rb
+++ b/app/models/track_mailer.rb
@@ -22,7 +22,7 @@ class TrackMailer < ApplicationMailer
# etc. don't decide we are spammers.)
@recipients = user.name_and_email
- @subject = "Your WhatDoTheyKnow.com email alert"
+ @subject = _("Your {{site_name}} email alert", :site_name => site_name)
@body = { :user => user, :email_about_things => email_about_things, :unsubscribe_url => unsubscribe_url }
end
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index aee1ed1da..16a0dab87 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -120,8 +120,8 @@ class TrackThing < ActiveRecord::Base
@params = {
# Website
:list_description => "'<a href=\"/request/" + CGI.escapeHTML(self.info_request.url_title) + "\">" + CGI.escapeHTML(self.info_request.title) + "</a>', a request", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
- :verb_on_page => "Track this request by email",
- :verb_on_page_already => "You are already tracking this request by email",
+ :verb_on_page => _("Track this request by email"),
+ :verb_on_page_already => _("You are already tracking this request by email"),
# Email
:title_in_email => "New updates for the request '" + self.info_request.title + "'",
:title_in_rss => "New updates for the request '" + self.info_request.title + "'",
@@ -135,23 +135,23 @@ class TrackThing < ActiveRecord::Base
elsif self.track_type == 'all_new_requests'
@params = {
# Website
- :list_description => "any <a href=\"/list\">new requests</a>",
- :verb_on_page => "Email me when there are new requests",
- :verb_on_page_already => "You are being emailed when there are new requests",
+ :list_description => _("any <a href=\"/list\">new requests</a>"),
+ :verb_on_page => _("Email me when there are new requests"),
+ :verb_on_page_already => _("You are being emailed when there are new requests"),
# Email
- :title_in_email => "New Freedom of Information requests",
- :title_in_rss => "New Freedom of Information requests",
+ :title_in_email => _("New Freedom of Information requests"),
+ :title_in_rss => _("New Freedom of Information requests"),
# Authentication
- :web => "To be emailed about any new requests",
- :email => "Then you will be emailed whenever anyone makes a new FOI request.",
- :email_subject => "Confirm you want to be emailed about new requests",
+ :web => _("To be emailed about any new requests"),
+ :email => _("Then you will be emailed whenever anyone makes a new FOI request."),
+ :email_subject => _("Confirm you want to be emailed about new requests"),
# RSS sorting
:feed_sortby => 'newest'
}
elsif self.track_type == 'all_successful_requests'
@params = {
# Website
- :list_description => "any <a href=\"/list/successful\">successful requests</a>",
+ :list_description => _("any <a href=\"/list/successful\">successful requests</a>"),
:verb_on_page => _("Email me new successful responses "),
:verb_on_page_already => _("You are being emailed about any new successful responses"),
# Email
@@ -172,14 +172,14 @@ class TrackThing < ActiveRecord::Base
# Website
:list_description => "'<a href=\"/body/" + CGI.escapeHTML(self.public_body.url_name) + "\">" + CGI.escapeHTML(self.public_body.name) + "</a>', a public authority", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
:verb_on_page => _("Track requests to {{public_body_name}} by email",:public_body_name=>CGI.escapeHTML(self.public_body.name)),
- :verb_on_page_already => "You are already tracking requests to " + CGI.escapeHTML(self.public_body.name) + " by email",
+ :verb_on_page_already => _("You are already tracking requests to {{public_body_name}} by email", :public_body_name=>CGI.escapeHTML(self.public_body.name)),
# Email
:title_in_email => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'",
:title_in_rss => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'",
# Authentication
- :web => "To be emailed about requests made using WhatDoTheyKnow to the public authority '" + CGI.escapeHTML(self.public_body.name) + "'",
- :email => "Then you will be emailed whenever someone requests something or gets a response from '" + CGI.escapeHTML(self.public_body.name) + "'.",
- :email_subject => "Confirm you want to be emailed about requests to '" + self.public_body.name + "'",
+ :web => _("To be emailed about requests made using {{site_name}} to the public authority '{{public_body_name}}'", :site_name=>MySociety::Config.get('SITE_NAME', 'Alaveteli'), :public_body_name=>CGI.escapeHTML(self.public_body.name)),
+ :email => _("Then you will be emailed whenever someone requests something or gets a response from '{{public_body_name}}'.", :public_body_name=>CGI.escapeHTML(self.public_body.name)),
+ :email_subject => _("Confirm you want to be emailed about requests to '{{public_body_name}}'", :public_body_name=>self.public_body.name),
# RSS sorting
:feed_sortby => 'newest'
}
@@ -187,15 +187,15 @@ class TrackThing < ActiveRecord::Base
@params = {
# Website
:list_description => "'<a href=\"/user/" + CGI.escapeHTML(self.tracked_user.url_name) + "\">" + CGI.escapeHTML(self.tracked_user.name) + "</a>', a person", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
- :verb_on_page => "Track this person by email",
- :verb_on_page_already => "You are already tracking this person by email",
+ :verb_on_page => _("Track this person by email"),
+ :verb_on_page_already => _("You are already tracking this person by email"),
# Email
- :title_in_email => "FOI requests by '" + self.tracked_user.name + "'",
- :title_in_rss => "FOI requests by '" + self.tracked_user.name + "'",
+ :title_in_email => _("FOI requests by '{{user_name}}'", :user_name=>self.tracked_user.name),
+ :title_in_rss => _("FOI requests by '{{user_name}}'", :user_name=>self.tracked_user.name),
# Authentication
- :web => "To be emailed about requests by '" + CGI.escapeHTML(self.tracked_user.name) + "'",
- :email => "Then you will be emailed whenever '" + CGI.escapeHTML(self.tracked_user.name) + "' requests something or gets a response.",
- :email_subject => "Confirm you want to be emailed about requests by '" + self.tracked_user.name + "'",
+ :web => _("To be emailed about requests by '{{user_name}}'", :user_name=>CGI.escapeHTML(self.tracked_user.name)),
+ :email => _("Then you will be emailed whenever '{{user_name}}' requests something or gets a response.", :user_name=>CGI.escapeHTML(self.tracked_user.name)),
+ :email_subject => _("Confirm you want to be emailed about requests by '{{user_name}}'", :user_name=>self.tracked_user.name),
# RSS sorting
:feed_sortby => 'newest'
}
@@ -203,15 +203,15 @@ class TrackThing < ActiveRecord::Base
@params = {
# Website
:list_description => "'<a href=\"/search/" + CGI.escapeHTML(self.track_query) + "/newest\">" + CGI.escapeHTML(self.track_query) + "</a>' in new requests/responses", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
- :verb_on_page => "Track things matching '" + CGI.escapeHTML(self.track_query) + "' by email",
- :verb_on_page_already => "You are already tracking things matching '" + CGI.escapeHTML(self.track_query) + "' by email",
+ :verb_on_page => _("Track things matching '{{query}}' by email", :query=>CGI.escapeHTML(self.track_query)),
+ :verb_on_page_already => _("You are already tracking things matching '{{query}}' by email", :query=>CGI.escapeHTML(self.track_query)),
# Email
- :title_in_email => "Requests or responses matching '" + self.track_query + "'",
- :title_in_rss => "Requests or responses matching '" + self.track_query + "'",
+ :title_in_email => _("Requests or responses matching '{{query}}'", :query=>self.track_query),
+ :title_in_rss => _("Requests or responses matching '{{query}}'", :query=>self.track_query),
# Authentication
- :web => "To follow requests and responses matching '" + CGI.escapeHTML(self.track_query) + "'",
- :email => "Then you will be emailed whenever a new request or response matches '" + CGI.escapeHTML(self.track_query) + "'.",
- :email_subject => "Confirm you want to be emailed about new requests or responses matching '" + self.track_query + "'",
+ :web => _("To follow requests and responses matching '{{query}}'", :query=>CGI.escapeHTML(self.track_query)),
+ :email => _("Then you will be emailed whenever a new request or response matches '{{query}}'.", :query=>CGI.escapeHTML(self.track_query)),
+ :email_subject => _("Confirm you want to be emailed about new requests or responses matching '{{query}}'", :query=>self.track_query),
# RSS sorting - XXX hmmm, we don't really know which to use
# here for sorting. Might be a query term (e.g. 'cctv'), in
# which case newest is good, or might be something like
diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb
index f164f684e..0972e167d 100644
--- a/app/models/user_mailer.rb
+++ b/app/models/user_mailer.rb
@@ -31,7 +31,7 @@ class UserMailer < ApplicationMailer
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account
@recipients = new_email
- @subject = _("Confirm your new email address on WhatDoTheyKnow.com")
+ @subject = _("Confirm your new email address on {{site_name}}", :site_name=>site_name)
@body[:name] = user.name
@body[:url] = url
@body[:old_email] = user.email
@@ -42,7 +42,7 @@ class UserMailer < ApplicationMailer
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account
@recipients = new_email
- @subject = _("Unable to change email address on WhatDoTheyKnow.com")
+ @subject = _("Unable to change email address on {{site_name}}", :site_name=>site_name)
@body[:old_email] = old_email
@body[:new_email] = new_email
end
diff --git a/app/views/admin_public_body/import_csv.rhtml b/app/views/admin_public_body/import_csv.rhtml
index 75981a501..50a4b951a 100644
--- a/app/views/admin_public_body/import_csv.rhtml
+++ b/app/views/admin_public_body/import_csv.rhtml
@@ -17,10 +17,21 @@
</p>
<p>
- <label for="csv_file">CSV file (no header rows; unused first column; name second column; email third column):</label>
- <br/>
- <%= file_field_tag :csv_file, :size => 60 %>
+ <label for="csv_file">CSV file:</label>
+ <%= file_field_tag :csv_file, :size => 40 %>
</p>
+
+ <p><strong>CSV file format:</strong> A first row with the list of fields,
+ starting with '#', is optional but highly recommended. The fields 'name'
+ and 'email' are required; additionaly, translated values are supported by
+ adding the locale name to the field name, e.g. 'name.es', 'name.de'... Example:
+ </p>
+
+ <blockquote>
+ #id,name,email,name.es<br/>
+ 1,An Authority,a@example.com,Un organismo<br/>
+ 2,Another One,another@example.com,Otro organismo<br/>
+ </blockquote>
<p><strong>Note:</strong> Choose <strong>dry run</strong> to test, without
actually altering the database. Choose <strong>upload</strong> to actually
diff --git a/app/views/admin_request/show_raw_email.rhtml b/app/views/admin_request/show_raw_email.rhtml
index 10b97f4fd..fa1470e77 100644
--- a/app/views/admin_request/show_raw_email.rhtml
+++ b/app/views/admin_request/show_raw_email.rhtml
@@ -3,8 +3,9 @@
<h1>Incoming message <%=@raw_email.incoming_message.id.to_s %></h1>
<p>
- FOI request: <%= link_to request_both_links(@raw_email.incoming_message.info_request) %>
+ FOI request: <%= request_both_links(@raw_email.incoming_message.info_request) %>
<% if @holding_pen %>
+ <br>This is in the holding pen because: <strong><%= @rejected_reason %></strong>
<% if @public_bodies.size > 0 %>
<br>Guessed authority:
<% for public_body in @public_bodies %>
@@ -30,7 +31,7 @@
<h2>Raw email</h2>
-<%= link_to "Download", "../download_raw_email/" + @raw_email.id.to_s %>
+<p><%= link_to "Download", "../download_raw_email/" + @raw_email.id.to_s %></p>
<pre><%=h(@raw_email.data).gsub(/\n/, '<br>') %></pre>
diff --git a/app/views/comment/new.rhtml b/app/views/comment/new.rhtml
index 25380d23f..1a4f2c0dc 100644
--- a/app/views/comment/new.rhtml
+++ b/app/views/comment/new.rhtml
@@ -59,7 +59,7 @@
<li> <%= _('You know what caused the error, and can <strong>suggest a solution</strong>, such as a working email address.')%> </li>
<% end %>
<% if [ 'requires_admin' ].include?(@info_request.described_state) %>
- <li> <%= _('Your thoughts on what the WhatDoTheyKnow <strong>administrators</strong> should do about the request.') %> </li>
+ <li> <%= _('Your thoughts on what the {{site_name}} <strong>administrators</strong> should do about the request.', :site_name=>site_name) %> </li>
<% end %>
diff --git a/app/views/contact_mailer/message.rhtml b/app/views/contact_mailer/message.rhtml
index a28d9603b..9c0a74c02 100644
--- a/app/views/contact_mailer/message.rhtml
+++ b/app/views/contact_mailer/message.rhtml
@@ -1,7 +1,7 @@
<%= @message.strip %>
---------------------------------------------------------------------
-<%= _('Message sent using WhatDoTheyKnow contact form, ')%>
+<%= _('Message sent using {{site_name}} contact form, ', :site_name=>site_name)%>
<%=(@logged_in_user ? ("logged in as user " + main_url(user_url(@logged_in_user))) : "not logged in")%><% if !@last_request.nil? %>
<%= _('Last request viewed: ')%><%= main_url(request_url(@last_request)) %>
diff --git a/app/views/contact_mailer/user_message.rhtml b/app/views/contact_mailer/user_message.rhtml
index 7a685c452..fe1f47518 100644
--- a/app/views/contact_mailer/user_message.rhtml
+++ b/app/views/contact_mailer/user_message.rhtml
@@ -1,5 +1,5 @@
---------------------------------------------------------------------
-<%=@from_user.name%> has used WhatDoTheyKnow to send you the message below.
+<%= _('{{user_name}} has used {{site_name}} to send you the message below.', :user_name=>@from_user.name, :site_name=>site_name) %>
<%= _('Your details have not been given to anyone, unless you choose to reply to this
message, which will then go directly to the person who wrote the message.')%>
---------------------------------------------------------------------
@@ -7,6 +7,6 @@ message, which will then go directly to the person who wrote the message.')%>
<%= @message.strip %>
---------------------------------------------------------------------
-<%= _('View Freedom of Information requests made by')%> <%=@from_user.name %>:
+<%= _('View Freedom of Information requests made by {{user_name}}:', :user_name=>@from_user.name)%>
<%= @from_user_url %>
---------------------------------------------------------------------
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml
index a4680c0f6..ec12b2bf3 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.rhtml
@@ -123,8 +123,8 @@
<li><%= _("Enter words that you want to find separated by spaces, e.g. <strong>climbing lane</strong>") %></li>
<li><%= _('Use OR (in capital letters) where you don\'t mind which word, e.g. <strong><code>commons OR lords</code></strong>') %>
<li><%= _('Use quotes when you want to find an exact phrase, e.g. <strong><code>"Liverpool City Council"</code></strong>') %></li>
- <li><%= _('<strong><code>status:</code></strong> to select based on the status or historical status of the request, see the <a href="%s">table of statuses</a> below.') % "#statuses" %></li>
- <li><%= _('<strong><code>variety:</code></strong> to select type of thing to search for, see the <a href="%s">table of varieties</a> below.') % "#varieties" %></li>
+ <li><%= _('<strong><code>status:</code></strong> to select based on the status or historical status of the request, see the <a href="{{statuses_url}}">table of statuses</a> below.', :statuses_url => "#statuses") %></li>
+ <li><%= _('<strong><code>variety:</code></strong> to select type of thing to search for, see the <a href="{{varieties_url}}">table of varieties</a> below.', :varieties_url => "#varieties") %></li>
<li><%= _('<strong><code>requested_from:home_office</code></strong> to search requests from the Home Office, typing the name as in the URL.')%></li>
<li><%= _('<strong><code>requested_by:julian_todd</code></strong> to search requests made by Julian Todd, typing the name as in the URL.') %></li>
<li><%= _('<strong><code>commented_by:tony_bowden</code></strong> to search annotations made by Tony Bowden, typing the name as in the URL.')%></li>
@@ -134,33 +134,33 @@
<li><%= _('<strong><code>tag:charity</code></strong> to find all public bodies or requests with a given tag. You can include multiple tags,
and tag values, e.g. <code>tag:openlylocal AND tag:financial_transaction:335633</code>. Note that by default any of the tags
can be present, you have to put <code>AND</code> explicitly if you only want results them all present.')%></li>
- <li><%= _('Read about <a href="%s">advanced search operators</a>, such as proximity and wildcards.') % "http://www.xapian.org/docs/queryparser.html" %></li>
+ <li><%= _('Read about <a href="{{advanced_search_url}}">advanced search operators</a>, such as proximity and wildcards.', :advanced_search_url => "http://www.xapian.org/docs/queryparser.html") %></li>
</ul>
<h2 id="statuses"><%= _('Table of statuses') %></h2>
<table class="status_table">
- <tr><td><strong><%=search_link('status:waiting_response')%></strong></td><td> Waiting for the public authority to reply </td></tr>
- <tr><td><strong><%=search_link('status:not_held')%></strong></td><td> The public authority does not have the information requested </td></tr>
- <tr><td><strong><%=search_link('status:rejected')%></strong></td><td> The request was refused by the public authority </td></tr>
- <tr><td><strong><%=search_link('status:partially_successful')%></strong></td><td> Some of the information requested has been received </td></tr>
- <tr><td><strong><%=search_link('status:successful')%></strong></td><td> All of the information requested has been received </td></tr>
- <tr><td><strong><%=search_link('status:waiting_clarification')%></strong></td><td> The public authority would like part of the request explained </td></tr>
- <tr><td><strong><%=search_link('status:gone_postal')%></strong></td><td> The public authority would like to / has responded by post </td></tr>
- <tr><td><strong><%=search_link('status:internal_review')%></strong></td><td> Waiting for the public authority to complete an internal review of their handling of the request</td></tr>
- <tr><td><strong><%=search_link('status:error_message')%></strong></td><td> Received an error message, such as delivery failure.</td></tr>
- <tr><td><strong><%=search_link('status:requires_admin')%></strong></td><td> A strange reponse, required attention by the WhatDoTheyKnow team </td></tr>
- <tr><td><strong><%=search_link('status:user_withdrawn')%></strong></td><td> The requester has abandoned this request for some reason </td></tr>
+ <tr><td><strong><%=search_link('status:waiting_response')%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr>
+ <tr><td><strong><%=search_link('status:not_held')%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr>
+ <tr><td><strong><%=search_link('status:rejected')%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr>
+ <tr><td><strong><%=search_link('status:partially_successful')%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr>
+ <tr><td><strong><%=search_link('status:successful')%></strong></td><td><%= _('All of the information requested has been received') %></td></tr>
+ <tr><td><strong><%=search_link('status:waiting_clarification')%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr>
+ <tr><td><strong><%=search_link('status:gone_postal')%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr>
+ <tr><td><strong><%=search_link('status:internal_review')%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr>
+ <tr><td><strong><%=search_link('status:error_message')%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr>
+ <tr><td><strong><%=search_link('status:requires_admin')%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr>
+ <tr><td><strong><%=search_link('status:user_withdrawn')%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr>
</table>
<h2 id="varieties">Table of varieties</h2>
<table class="status_table">
- <tr><td><strong><%=search_link('variety:sent')%></strong></td><td> Original request sent</td></tr>
- <tr><td><strong><%=search_link('variety:followup_sent')%></strong></td><td> Follow up message sent by requester</td></tr>
- <tr><td><strong><%=search_link('variety:response')%></strong></td><td> Response from a public authority </td></tr>
- <tr><td><strong><%=search_link('variety:comment')%></strong></td><td> Annotation added to request</td></tr>
- <tr><td><strong><%=search_link('variety:authority')%></strong></td><td> A public authority </td></tr>
- <tr><td><strong><%=search_link('variety:user')%></strong></td><td> A WhatDoTheyKnow user </td></tr>
+ <tr><td><strong><%=search_link('variety:sent')%></strong></td><td><%= _('Original request sent') %></td></tr>
+ <tr><td><strong><%=search_link('variety:followup_sent')%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr>
+ <tr><td><strong><%=search_link('variety:response')%></strong></td><td><%= _('Response from a public authority') %></td></tr>
+ <tr><td><strong><%=search_link('variety:comment')%></strong></td><td><%= _('Annotation added to request') %></td></tr>
+ <tr><td><strong><%=search_link('variety:authority')%></strong></td><td><%= _('A public authority') %></td></tr>
+ <tr><td><strong><%=search_link('variety:user')%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr>
</table>
<% end %>
diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml
index 5fe75fc97..f0e9a7019 100644
--- a/app/views/layouts/admin.rhtml
+++ b/app/views/layouts/admin.rhtml
@@ -2,7 +2,7 @@
<html lang="en-gb">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" >
- <title>WhatDoTheyKnow admin<%= @title ? ":" : "" %> <%=@title%></title>
+ <title><%= site_name %> admin<%= @title ? ":" : "" %> <%=@title%></title>
<%= stylesheet_link_tag 'admin', :title => "Main", :rel => "stylesheet" %>
</head>
<body>
diff --git a/app/views/outgoing_mailer/initial_request.rhtml b/app/views/outgoing_mailer/initial_request.rhtml
index 13b356c6e..83e5b794b 100644
--- a/app/views/outgoing_mailer/initial_request.rhtml
+++ b/app/views/outgoing_mailer/initial_request.rhtml
@@ -5,7 +5,7 @@
<%= _('Please use this email address for all replies to this request:')%>
<%= @info_request.incoming_email %>
-<%= _('Is {{email_address}} the wrong address for {{type_of_request}} requests tp {{public_body_name}}? If so, please contact us using this form:', :email_address => @info_request.public_body.request_email, :type_of_request => @info_request.law_used_full, :public_body_name => @info_request.public_body.name)%>
+<%= _('Is {{email_address}} the wrong address for {{type_of_request}} requests to {{public_body_name}}? If so, please contact us using this form:', :email_address => @info_request.public_body.request_email, :type_of_request => @info_request.law_used_full, :public_body_name => @info_request.public_body.name)%>
<%= render :partial => 'followup_footer' %>
diff --git a/app/views/public_body/_body_listing_single.rhtml b/app/views/public_body/_body_listing_single.rhtml
index 97cfd2e71..7637a1077 100644
--- a/app/views/public_body/_body_listing_single.rhtml
+++ b/app/views/public_body/_body_listing_single.rhtml
@@ -9,7 +9,7 @@
<span class="desc">
<% if !public_body.short_name.empty? || !public_body.notes_without_html.empty? %>
<% if !public_body.short_name.empty? %>
- Also called <%=highlight_words(public_body.short_name, @highlight_words) %>.
+ <%= _("Also called {{other_name}}.", :other_name => highlight_words(public_body.short_name, @highlight_words)) %>
<% end %>
<% if !public_body.notes_without_html.empty? %>
<%= highlight_and_excerpt(public_body.notes_without_html, @highlight_words, 150) %>
@@ -18,12 +18,12 @@
<% end %>
</span>
<span class="bottomline">
- <%= pluralize(public_body.info_requests.size, "request") %> made.
+ <%= n_('%d request made.', '%d requests made.', public_body.info_requests.size) % public_body.info_requests.size %>
<% if !@include_request_link_in_authority_listing.nil? %>
<%= link_to _("Make your own request"), public_body_url(public_body) %>.
<% end %>
<br>
- Added on <%= simple_date(public_body.created_at) %>.
+ <%= _("Added on {{date}}", :date => simple_date(public_body.created_at)) %>.
</span>
</div>
diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml
index 78a326d72..406c1479e 100644
--- a/app/views/public_body/show.rhtml
+++ b/app/views/public_body/show.rhtml
@@ -78,7 +78,7 @@
<% if @public_body.eir_only? %>
<%= pluralize(@public_body.info_requests.size, "Environmental Information Regulations request made using this site") %>
<% else %>
- <%= n_('%d Freedom of Information request', '%d Freedom of Information requests', @public_body.info_requests.size) % @public_body.info_requests.size %> made using this site
+ <%= n_('%d Freedom of Information request made using this site', '%d Freedom of Information requests made using this site', @public_body.info_requests.size) % @public_body.info_requests.size %>
<% end %>
<%= @page_desc %>
</h2>
diff --git a/app/views/public_body/view_email.rhtml b/app/views/public_body/view_email.rhtml
index d6c8d85fe..50601069f 100644
--- a/app/views/public_body/view_email.rhtml
+++ b/app/views/public_body/view_email.rhtml
@@ -4,7 +4,7 @@
<p>
<% if @public_body.is_requestable? %>
-<%= _('WhatDoTheyKnow sends new requests to <strong>{{request_email}}</strong> for this authority.',:request_email=> h(@public_body.request_email))%>
+<%= _('{{site_name}} sends new requests to <strong>{{request_email}}</strong> for this authority.', :site_name=>site_name, :request_email=> h(@public_body.request_email))%>
<% else %>
<% if @public_body.not_requestable_reason == 'not_apply' %>
<p><%= _('Freedom of Information law no longer applies to this authority.Follow up messages to existing requests are sent to ')%><strong><%=h @public_body.request_email%></strong>.
diff --git a/app/views/request/details.rhtml b/app/views/request/details.rhtml
index 94d87306d..d4c63902f 100644
--- a/app/views/request/details.rhtml
+++ b/app/views/request/details.rhtml
@@ -4,17 +4,17 @@
<h2><%= _('Event history') %></h2>
<p><%= _('This table shows the technical details of the internal events that happened
-to this request on WhatDoTheyKnow. This could be used to generate information about
+to this request on {{site_name}}. This could be used to generate information about
the speed with which authorities respond to requests, the number of requests
-which require a postal response and much more.') %>
+which require a postal response and much more.', :site_name=>site_name) %>
</p>
<p><%= _('<strong>Caveat emptor!</strong> To use this data in an honourable way, you will need
-a good internal knowledge of user behaviour on WhatDoTheyKnow. How,
+a good internal knowledge of user behaviour on {{site_name}}. How,
why and by whom requests are categorised is not straightforward, and there will
be user error and ambiguity. You will also need to understand FOI law, and the
way authorities use it. Plus you\'ll need to be an elite statistician. Please
-<a href="%s">contact us</a> with questions.') % [help_contact_path] %>
+<a href="{{contact_path}}">contact us</a> with questions.', :site_name=>site_name, :contact_path=>help_contact_path) %>
</p>
<% columns = ['id', 'event_type', 'created_at', 'described_state', 'calculated_state', 'last_described_at' ] %>
@@ -49,11 +49,12 @@ way authorities use it. Plus you\'ll need to be an elite statistician. Please
<p>
<%= _('Here <strong>described</strong> means when a user selected a status for the request, and
the most recent event had its status updated to that value. <strong>calculated</strong> is then inferred by
-WhatDoTheyKnow for intermediate events, which weren\'t given an explicit
-description by a user. See the <a href="%s">search tips</a> for description of the states.') % [search_redirect_path] %>
+{{site_name}} for intermediate events, which weren\'t given an explicit
+description by a user. See the <a href="{{search_path}}">search tips</a> for description of the states.',
+:site_name=>site_name, :search_path=>search_redirect_path) %>
</p>
<p>
<%= _('You can get this page in computer-readable format as part of the main JSON
-page for the request. See the <a href="%s">API documentation</a>.') % [help_api_path] %>
+page for the request. See the <a href="{{api_path}}">API documentation</a>.', :api_path=>help_api_path) %>
</p>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 1993ee6b2..2897a3564 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -110,9 +110,9 @@
<% elsif @status == 'internal_review' %>
<%= _('Waiting for an <strong>internal review</strong> by {{public_body_link}} of their handling of this request.',:public_body_link=>public_body_link(@info_request.public_body)) %>
<% elsif @status == 'error_message' %>
- <%= _('There was a <strong>delivery error</strong> or similar, which needs fixing by the WhatDoTheyKnow team.') %>
+ <%= _('There was a <strong>delivery error</strong> or similar, which needs fixing by the {{site_name}} team.', :site_name=>site_name) %>
<% elsif @status == 'requires_admin' %>
- <%= _('This request has had an unusual response, and <strong>requires attention</strong> from the WhatDoTheyKnow team.') %>
+ <%= _('This request has had an unusual response, and <strong>requires attention</strong> from the {{site_name}} team.', :site_name=>site_name) %>
<% elsif @status == 'user_withdrawn' %>
<%= _('This request has been <strong>withdrawn</strong> by the person who made it.
There may be an explanation in the correspondence below.') %>
diff --git a/app/views/request_mailer/comment_on_alert.rhtml b/app/views/request_mailer/comment_on_alert.rhtml
index 46cee3b1a..691e6f9bb 100644
--- a/app/views/request_mailer/comment_on_alert.rhtml
+++ b/app/views/request_mailer/comment_on_alert.rhtml
@@ -3,4 +3,4 @@ request. Follow this link to see what they wrote.',:user_name=>@comment.user.nam
<%=@url%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/comment_on_alert_plural.rhtml b/app/views/request_mailer/comment_on_alert_plural.rhtml
index 3871a9598..a495b8e08 100644
--- a/app/views/request_mailer/comment_on_alert_plural.rhtml
+++ b/app/views/request_mailer/comment_on_alert_plural.rhtml
@@ -2,6 +2,6 @@
<%=@url%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/new_response.rhtml b/app/views/request_mailer/new_response.rhtml
index c3e979cd6..083f873b4 100644
--- a/app/views/request_mailer/new_response.rhtml
+++ b/app/views/request_mailer/new_response.rhtml
@@ -12,6 +12,6 @@ contains any useful information.' )%>
<%= _('Although all responses are automatically published, we depend on
you, the original requester, to evaluate them.')%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/new_response_reminder_alert.rhtml b/app/views/request_mailer/new_response_reminder_alert.rhtml
index cde7851db..5f07e8559 100644
--- a/app/views/request_mailer/new_response_reminder_alert.rhtml
+++ b/app/views/request_mailer/new_response_reminder_alert.rhtml
@@ -5,6 +5,6 @@
<%= _('Your request was called {{info_request}}. Letting everyone know whether you got the information will help us keep tabs on',:info_request=>@info_request.title)%>
<%= @info_request.public_body.name %>.
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/not_clarified_alert.rhtml b/app/views/request_mailer/not_clarified_alert.rhtml
index 2e6cf6a05..82d15ba76 100644
--- a/app/views/request_mailer/not_clarified_alert.rhtml
+++ b/app/views/request_mailer/not_clarified_alert.rhtml
@@ -6,4 +6,4 @@
<%= _('You will only get an answer to your request if you follow up
with the clarification.')%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/old_unclassified_updated.rhtml b/app/views/request_mailer/old_unclassified_updated.rhtml
index afaa0cf1c..5b8534832 100644
--- a/app/views/request_mailer/old_unclassified_updated.rhtml
+++ b/app/views/request_mailer/old_unclassified_updated.rhtml
@@ -5,5 +5,5 @@
<%= @url %>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/overdue_alert.rhtml b/app/views/request_mailer/overdue_alert.rhtml
index 70b6ffcf1..b8a9ba525 100644
--- a/app/views/request_mailer/overdue_alert.rhtml
+++ b/app/views/request_mailer/overdue_alert.rhtml
@@ -6,6 +6,6 @@
<%=@url%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/stopped_responses.rhtml b/app/views/request_mailer/stopped_responses.rhtml
index eb53cee1c..9cd156860 100644
--- a/app/views/request_mailer/stopped_responses.rhtml
+++ b/app/views/request_mailer/stopped_responses.rhtml
@@ -13,7 +13,7 @@ email {{contact_email}} for help.',:user=>@info_request.user.name,:contact_email
<%= _('Your original message is attached.')%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/request_mailer/very_overdue_alert.rhtml b/app/views/request_mailer/very_overdue_alert.rhtml
index e61b3a206..6abd198a0 100644
--- a/app/views/request_mailer/very_overdue_alert.rhtml
+++ b/app/views/request_mailer/very_overdue_alert.rhtml
@@ -8,4 +8,4 @@ review, asking them to find out why response to the request has been so slow.',:
<%=@url%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml
index df27a5cbd..46f230da1 100644
--- a/app/views/track_mailer/event_digest.rhtml
+++ b/app/views/track_mailer/event_digest.rhtml
@@ -63,4 +63,4 @@
Please click on the link below to cancel or alter these emails.
<%=@unsubscribe_url%>
--- the WhatDoTheyKnow team
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/user/_signin.rhtml b/app/views/user/_signin.rhtml
index 49f604ca5..1c19ac05c 100644
--- a/app/views/user/_signin.rhtml
+++ b/app/views/user/_signin.rhtml
@@ -4,7 +4,7 @@
<%= foi_error_messages_for :user_signin %>
<% if not sign_in_as_existing_user %>
- <h2><%= _('If you\'ve used WhatDoTheyKnow before')%></h2>
+ <h2><%= _('If you\'ve used {{site_name}} before', :site_name=>site_name)%></h2>
<% end %>
<p>
diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.rhtml
index c3c286151..02abede5d 100644
--- a/app/views/user/_signup.rhtml
+++ b/app/views/user/_signup.rhtml
@@ -3,7 +3,7 @@
<% form_tag({:action => "signup"}, {:id => "signup_form"}) do %>
<%= foi_error_messages_for :user_signup %>
- <h2><%= _('If you\'re new to WhatDoTheyKnow')%></h2>
+ <h2><%= _('If you\'re new to {{site_name}}', :site_name=>site_name)%></h2>
<p>
<label class="form_label" for="user_signup_email"><%= _('Your e-mail:')%></label>
diff --git a/app/views/user/set_crop_profile_photo.rhtml b/app/views/user/set_crop_profile_photo.rhtml
index 33b78e193..db18d10a1 100644
--- a/app/views/user/set_crop_profile_photo.rhtml
+++ b/app/views/user/set_crop_profile_photo.rhtml
@@ -33,7 +33,7 @@
<%= hidden_field_tag 'draft_profile_photo_id', @draft_profile_photo.id %>
<p><%= _('<strong>Privacy note:</strong> Your photo will be shown in public on the Internet,
- wherever you do something on WhatDoTheyKnow.')%>
+ wherever you do something on {{site_name}}.', :site_name=>site_name)%>
<p>
<%= hidden_field_tag 'submitted_crop_profile_photo', 1 %>
diff --git a/app/views/user/set_draft_profile_photo.rhtml b/app/views/user/set_draft_profile_photo.rhtml
index b6a39df5e..70d27074b 100644
--- a/app/views/user/set_draft_profile_photo.rhtml
+++ b/app/views/user/set_draft_profile_photo.rhtml
@@ -16,7 +16,7 @@
<ul>
<li><%= _('Your photo will be shown in public <strong>on the Internet</strong>,
- wherever you do something on WhatDoTheyKnow.')%>
+ wherever you do something on {{site_name}}.', :site_name=>site_name)%>
</li>
<li><%= _('Please don\'t upload offensive pictures. We will take down images
diff --git a/app/views/user/set_profile_about_me.rhtml b/app/views/user/set_profile_about_me.rhtml
index aa53d6720..af6433e89 100644
--- a/app/views/user/set_profile_about_me.rhtml
+++ b/app/views/user/set_profile_about_me.rhtml
@@ -1,4 +1,4 @@
-<% @title = _('Change the text about you on your profile at WhatDoTheyKnow.com') %>
+<% @title = _('Change the text about you on your profile at {{site_name}}', :site_name=>site_name) %>
<% raise _('internal error') if not @user %>
@@ -11,8 +11,8 @@
<%= _(' What are you investigating using Freedom of Information? ')%>
</p>
<p>
- <%= _(' This will appear on your WhatDoTheyKnow profile, to make it
- easier for others to get involved with what you\'re doing.')%>
+ <%= _(' This will appear on your {{site_name}} profile, to make it
+ easier for others to get involved with what you\'re doing.', :site_name=>site_name)%>
</p>
</div>
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index 09bf3de5f..5e2c29d84 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -59,7 +59,7 @@
<h1> <%= h(@display_user.name) + (@is_you ? _(" (you)") : "") %></h1>
<p class="subtitle">
- <%= _('Joined WhatDoTheyKnow in') %> <%= year_from_date(@display_user.created_at) %>
+ <%= _('Joined {{site_name}} in', :site_name=>site_name) %> <%= year_from_date(@display_user.created_at) %>
<% if !@user.nil? && @user.admin_page_links? %>
(<%= link_to "admin", user_admin_url(@display_user) %>)
<% end %>
@@ -76,7 +76,7 @@
<div id="user_public_banned">
<p>
<strong>
- <%= _('This user has been banned from WhatDoTheyKnow.com ')%>
+ <%= _('This user has been banned from {{site_name}} ', :site_name=>site_name)%>
</strong>
</p>
<p>
diff --git a/app/views/user/signchangeemail.rhtml b/app/views/user/signchangeemail.rhtml
index c0c559380..0f8b76bc5 100644
--- a/app/views/user/signchangeemail.rhtml
+++ b/app/views/user/signchangeemail.rhtml
@@ -34,7 +34,7 @@
<div class="form_button">
<%= hidden_field_tag 'submitted_signchangeemail_do', 1 %>
- <%= submit_tag "Change email on WhatDoTheyKnow.com" %>
+ <%= submit_tag _("Change email on {{site_name}}", :site_name=>site_name) %>
</div>
<% end %>
diff --git a/app/views/user_mailer/already_registered.rhtml b/app/views/user_mailer/already_registered.rhtml
index 3bdb3d04b..59ffcbf94 100644
--- a/app/views/user_mailer/already_registered.rhtml
+++ b/app/views/user_mailer/already_registered.rhtml
@@ -1,11 +1,11 @@
<%= @name %>,
-<%= _('You just tried to sign up to WhatDoTheyKnow.com, when you
+<%= _('You just tried to sign up to {{site_name}}, when you
already have an account. Your name and password have been
left as they previously were.
-Please click on the link below.')%> <%=@reasons[:email]%>
+Please click on the link below.', :site_name=>site_name)%> <%=@reasons[:email]%>
<%=@url%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/user_mailer/changeemail_already_used.rhtml b/app/views/user_mailer/changeemail_already_used.rhtml
index 011c6ee81..1d74dda35 100644
--- a/app/views/user_mailer/changeemail_already_used.rhtml
+++ b/app/views/user_mailer/changeemail_already_used.rhtml
@@ -1,9 +1,10 @@
<%= _('Someone, perhaps you, just tried to change their email address on
-WhatDoTheyKnow.com from ')%><%=@old_email%> <%= _('to')%> <%=@new_email%>.
+{{site_name}} from {{old_email}} to {{new_email}}.', :site_name=>site_name,
+:old_email=>@old_email, :new_email=>@new_email) %>
<%= _('This was not possible because there is already an account using
-the email address ')%><%=@new_email%>.
+the email address {{email}}.', :email=>@new_email)%>.
<%= _('The accounts have been left as they previously were.')%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/user_mailer/changeemail_confirm.rhtml b/app/views/user_mailer/changeemail_confirm.rhtml
index b7eff308d..ffb9737f7 100644
--- a/app/views/user_mailer/changeemail_confirm.rhtml
+++ b/app/views/user_mailer/changeemail_confirm.rhtml
@@ -1,12 +1,13 @@
<%= @name %>,
<%= _('Please click on the link below to confirm that you want to
-change the email address that you use for WhatDoTheyKnow
-from ')%><%=@old_email%> <%= _('to ')%><%=@new_email%>
+change the email address that you use for {{site_name}}
+from {{old_email}} to {{new_email}}',
+:site_name=>site_name, :old_email=>@old_email, :new_email=>@new_email) %>
<%=@url%>
<%= _('We will not reveal your email addresses to anybody unless you
or the law tell us to.')%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>
diff --git a/app/views/user_mailer/confirm_login.rhtml b/app/views/user_mailer/confirm_login.rhtml
index b68e9abb1..6f4feff00 100644
--- a/app/views/user_mailer/confirm_login.rhtml
+++ b/app/views/user_mailer/confirm_login.rhtml
@@ -8,4 +8,4 @@
<%= _('We will not reveal your email address to anybody unless you
or the law tell us to.')%>
--- <%= _('the WhatDoTheyKnow team') %>
+-- <%= _('the {{site_name}} team', :site_name=>site_name) %>