diff options
-rwxr-xr-x | app/helpers/link_to_helper.rb | 8 | ||||
-rw-r--r-- | app/models/about_me_validator.rb | 2 | ||||
-rw-r--r-- | app/models/application_mailer.rb | 2 | ||||
-rw-r--r-- | app/models/change_email_validator.rb | 8 | ||||
-rw-r--r-- | app/models/comment.rb | 4 | ||||
-rw-r--r-- | app/models/contact_validator.rb | 2 | ||||
-rw-r--r-- | app/models/info_request.rb | 34 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 36 | ||||
-rw-r--r-- | app/models/outgoing_message.rb | 8 | ||||
-rw-r--r-- | app/models/track_thing.rb | 16 | ||||
-rw-r--r-- | app/models/user.rb | 16 | ||||
-rw-r--r-- | app/models/user_mailer.rb | 4 | ||||
-rw-r--r-- | config/routes.rb | 3 |
13 files changed, 75 insertions, 68 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index a9300a555..fa8bb0de8 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -203,6 +203,12 @@ module LinkToHelper params['locale'] = locale return url_for(params) end - + + def locale_name(locale) + return "English" if locale == "en" + return "Srpski" if locale == "sr" + return "Shqip" if locale == "sq" + return locale + end end diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb index f7b88f7dd..ec2b03201 100644 --- a/app/models/about_me_validator.rb +++ b/app/models/about_me_validator.rb @@ -21,7 +21,7 @@ class AboutMeValidator < ActiveRecord::BaseWithoutTable def validate if !self.about_me.blank? && self.about_me.size > 500 - errors.add(:about_me, N_("Please keep it shorter than 500 characters")) + errors.add(_("Please keep it shorter than 500 characters")) end end diff --git a/app/models/application_mailer.rb b/app/models/application_mailer.rb index 8ee467b60..623b97c5b 100644 --- a/app/models/application_mailer.rb +++ b/app/models/application_mailer.rb @@ -15,7 +15,7 @@ class ApplicationMailer < ActionMailer::Base self.raise_delivery_errors = true def contact_from_name_and_email - "WhatDoTheyKnow <"+MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost')+">" + "InformataZyrtare <"+MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost')+">" end def blackhole_email diff --git a/app/models/change_email_validator.rb b/app/models/change_email_validator.rb index 15d2cb624..515747b22 100644 --- a/app/models/change_email_validator.rb +++ b/app/models/change_email_validator.rb @@ -31,21 +31,21 @@ class ChangeEmailValidator < ActiveRecord::BaseWithoutTable def validate if !self.old_email.blank? && !MySociety::Validate.is_valid_email(self.old_email) - errors.add(:old_email, "Old email doesn't look like a valid address") + errors.add(:old_email, _("Old email doesn't look like a valid address")) end if !errors[:old_email] if self.old_email.downcase != self.logged_in_user.email.downcase - errors.add(:old_email, "Old email address isn't the same as the address of the account you are logged in with") + errors.add(:old_email, _("Old email address isn't the same as the address of the account you are logged in with")) elsif !self.logged_in_user.has_this_password?(self.password) if !errors[:password] - errors.add(:password, "Password is not correct") + errors.add(:password, _("Password is not correct")) end end end if !self.new_email.blank? && !MySociety::Validate.is_valid_email(self.new_email) - errors.add(:new_email, "New email doesn't look like a valid address") + errors.add(:new_email, _("New email doesn't look like a valid address")) end end diff --git a/app/models/comment.rb b/app/models/comment.rb index 3d69b1108..b7ece9ba9 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -56,10 +56,10 @@ class Comment < ActiveRecord::Base # Check have edited comment def validate if self.body.empty? || self.body =~ /^\s+$/ - errors.add(:body, N_("Please enter your annotation")) + errors.add(:body, _("Please enter your annotation")) end if !MySociety::Validate.uses_mixed_capitals(self.body) - errors.add(:body, N_('Please write your annotation using a mixture of capital and lower case letters. This makes it easier for others to read.')) + errors.add(:body, _('Please write your annotation using a mixture of capital and lower case letters. This makes it easier for others to read.')) end end diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb index 9d8c54095..0bc562835 100644 --- a/app/models/contact_validator.rb +++ b/app/models/contact_validator.rb @@ -31,7 +31,7 @@ class ContactValidator < ActiveRecord::BaseWithoutTable validates_presence_of :message, :message => N_("Please enter the message you want to send") def validate - errors.add(:email, "Email doesn't look like a valid address") unless MySociety::Validate.is_valid_email(self.email) + errors.add(:email, _("Email doesn't look like a valid address")) unless MySociety::Validate.is_valid_email(self.email) end end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 5ce2be2df..4e669e5cd 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -750,39 +750,39 @@ public def display_status status = self.calculate_status if status == 'waiting_classification' - "Awaiting classification." + _("Awaiting classification.") elsif status == 'waiting_response' - "Awaiting response." + _("Awaiting response.") elsif status == 'waiting_response_overdue' - "Delayed." + _("Delayed.") elsif status == 'waiting_response_very_overdue' - "Long overdue." + _("Long overdue.") elsif status == 'not_held' - "Information not held." + _("Information not held.") elsif status == 'rejected' - "Refused." + _("Refused.") elsif status == 'partially_successful' - "Partially successful." + _("Partially successful.") elsif status == 'successful' - "Successful." + _("Successful.") elsif status == 'waiting_clarification' - "Waiting clarification." + _("Waiting clarification.") elsif status == 'gone_postal' - "Handled by post." + _("Handled by post.") elsif status == 'deadline_extended' - "Deadline extended." + _("Deadline extended.") elsif status == 'wrong_response' - "Wrong Response." + _("Wrong Response.") elsif status == 'internal_review' - "Awaiting internal review." + _("Awaiting internal review.") elsif status == 'error_message' - "Delivery error" + _("Delivery error") elsif status == 'requires_admin' - "Unusual response." + _("Unusual response.") elsif status == 'user_withdrawn' - "Withdrawn by the requester." + _("Withdrawn by the requester.") else - raise "unknown status " + status + raise _("unknown status ") + status end end diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 64f602fbe..02b9a34ac 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -285,31 +285,31 @@ class InfoRequestEvent < ActiveRecord::Base status = self.calculated_state if !status.nil? if status == 'waiting_response' - return "Acknowledgement" + return _("Acknowledgement") elsif status == 'waiting_clarification' - return "Clarification required" + return _("Clarification required") elsif status == 'gone_postal' - return "Handled by post" + return _("Handled by post") elsif status == 'deadline_extended' - return "Deadline Extended" + return _("Deadline Extended") elsif status == 'wrong_response' - return "Wrong Response" + return _("Wrong Response") elsif status == 'not_held' - return "Information not held" + return _("Information not held") elsif status == 'rejected' - return "Refused" + return _("Refused") elsif status == 'partially_successful' - return "Some information sent" + return _("Some information sent") elsif status == 'successful' - return "All information sent" + return _("All information sent") elsif status == 'internal_review' - return "Internal review acknowledgement" + return _("Internal review acknowledgement") elsif status == 'user_withdrawn' - return "Withdrawn by requester" + return _("Withdrawn by requester") elsif status == 'error_message' - return "Delivery error" + return _("Delivery error") elsif status == 'requires_admin' - return "Unusual response" + return _("Unusual response") end raise "unknown status " + status end @@ -320,17 +320,17 @@ class InfoRequestEvent < ActiveRecord::Base status = self.calculated_state if !status.nil? if status == 'internal_review' - return "Internal review request" + return _("Internal review request") end if status == 'waiting_response' - return "Clarification" + return _("Clarification") end - raise "unknown status " + status + raise _("unknown status ") + status end - return "Follow up" + return _("Follow up") end - raise "display_status only works for incoming and outgoing messages right now" + raise _("display_status only works for incoming and outgoing messages right now") end def is_sent_sort? diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 220f4f0a7..f9baad9b0 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -54,7 +54,7 @@ class OutgoingMessage < ActiveRecord::Base # How the default letter starts and ends def get_salutation - ret = "Dear " + ret = _("Dear ") if self.message_type == 'followup' && !self.incoming_message_followup.nil? && !self.incoming_message_followup.safe_mail_from.nil? && self.incoming_message_followup.valid_to_reply_to? ret = ret + OutgoingMailer.name_for_followup(self.info_request, self.incoming_message_followup) else @@ -64,13 +64,13 @@ class OutgoingMessage < ActiveRecord::Base end def get_signoff if self.message_type == 'followup' && !self.incoming_message_followup.nil? && !self.incoming_message_followup.safe_mail_from.nil? && self.incoming_message_followup.valid_to_reply_to? - return "Yours sincerely," + return _("Yours sincerely,") else - return "Yours faithfully," + return _("Yours faithfully,") end end def get_internal_review_insert_here_note - return "GIVE DETAILS ABOUT YOUR COMPLAINT HERE" + return _("GIVE DETAILS ABOUT YOUR COMPLAINT HERE") end def get_default_letter if self.default_letter diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index 9d6f40ed7..aee1ed1da 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -152,15 +152,15 @@ class TrackThing < ActiveRecord::Base @params = { # Website :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", + :verb_on_page => _("Email me new successful responses "), + :verb_on_page_already => _("You are being emailed about any new successful responses"), # Email - :title_in_email => "Successful Freedom of Information requests", - :title_in_rss => "Successful Freedom of Information requests", + :title_in_email => _("Successful Freedom of Information requests"), + :title_in_rss => _("Successful Freedom of Information requests"), # Authentication - :web => "To be emailed about any successful requests", - :email => "Then you will be emailed whenever an FOI request succeeds.", - :email_subject => "Confirm you want to be emailed when an FOI request succeeds", + :web => _("To be emailed about any successful requests"), + :email => _("Then you will be emailed whenever an FOI request succeeds."), + :email_subject => _("Confirm you want to be emailed when an FOI request succeeds"), # RSS sorting - used described date, as newest would give a # date for responses possibly days before description, so # wouldn't appear at top of list when description (known @@ -171,7 +171,7 @@ class TrackThing < ActiveRecord::Base @params = { # 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 " + CGI.escapeHTML(self.public_body.name) + " by email", + :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", # Email :title_in_email => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", diff --git a/app/models/user.rb b/app/models/user.rb index 2fd6d9dbe..e199eb352 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -31,11 +31,11 @@ require 'digest/sha1' class User < ActiveRecord::Base strip_attributes! - validates_presence_of :email, :message => N_("Please enter your email address") + validates_presence_of :email, :message => _("Please enter your email address") - validates_presence_of :name, :message => N_("Please enter your name") + validates_presence_of :name, :message => _("Please enter your name") - validates_presence_of :hashed_password, :message => N_("Please enter a password") + validates_presence_of :hashed_password, :message => _("Please enter a password") has_many :info_requests, :order => 'created_at desc' has_many :user_info_request_sent_alerts @@ -46,7 +46,7 @@ class User < ActiveRecord::Base has_many :censor_rules, :order => 'created_at desc' attr_accessor :password_confirmation, :no_xapian_reindex - validates_confirmation_of :password, :message => N_("Please enter the same password twice") + validates_confirmation_of :password, :message => _("Please enter the same password twice") validates_inclusion_of :admin_level, :in => [ 'none', @@ -103,10 +103,10 @@ class User < ActiveRecord::Base def validate if self.email != "" && !MySociety::Validate.is_valid_email(self.email) - errors.add(:email, N_("Please enter a valid email address")) + errors.add(_("Please enter a valid email address")) end if MySociety::Validate.is_valid_email(self.name) - errors.add(:name, N_("Please enter your name, not your email address, in the name field.")) + errors.add(:name, _("Please enter your name, not your email address, in the name field.")) end end @@ -129,9 +129,9 @@ class User < ActiveRecord::Base params[:email].strip! if specific_user_login - auth_fail_message = "Either the email or password was not recognised, please try again." + auth_fail_message = _("Either the email or password was not recognised, please try again.") else - auth_fail_message = "Either the email or password was not recognised, please try again. Or create a new account using the form on the right." + auth_fail_message = _("Either the email or password was not recognised, please try again. Or create a new account using the form on the right.") end user = self.find_user_by_email(params[:email]) diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb index 70ca42675..f164f684e 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 WhatDoTheyKnow.com") @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 WhatDoTheyKnow.com") @body[:old_email] = old_email @body[:new_email] = new_email end diff --git a/config/routes.rb b/config/routes.rb index 698c2b8c1..9320d5b60 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,7 +17,7 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'general' do |general| general.frontpage '/', :action => 'frontpage' general.blog '/blog', :action => 'blog' - general.custom_css '/custom.css', :action => 'custom_css' + general.custom_css '/stylesheets/custom.css', :action => 'custom_css' general.search_redirect '/search', :action => 'search_redirect' # XXX combined is the search query, and then if sorted a "/newest" at the end. # Couldn't find a way to do this in routes which also picked up multiple other slashes @@ -115,6 +115,7 @@ ActionController::Routing::Routes.draw do |map| help.help_requesting '/help/requesting', :action => 'requesting' help.help_privacy '/help/privacy', :action => 'privacy' help.help_api '/help/api', :action => 'api' + help.help_credits '/help/credits', :action => 'credits' help.help_general '/help/:action', :action => :action end |