aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/application_mailer.rb3
-rw-r--r--app/models/incoming_message.rb8
-rw-r--r--app/models/track_mailer.rb2
-rw-r--r--app/models/track_thing.rb36
-rw-r--r--app/models/user_mailer.rb4
5 files changed, 29 insertions, 24 deletions
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 90ab84a8f..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.
@@ -862,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
@@ -1131,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'
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..ced63f76f 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -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