From 7106744372abce3c00dd326d4bc5d5ce5cac9d78 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 16 Jan 2013 19:07:54 +1100 Subject: Set locale in controller test by passing parameter in get Also using I18n.locale to pass the current locale around. --- app/controllers/public_body_controller.rb | 2 +- app/models/public_body.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index aa6980b69..9e4f7c023 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -16,7 +16,7 @@ class PublicBodyController < ApplicationController return end @locale = self.locale_from_params() - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do @public_body = PublicBody.find_by_url_name_with_historic(params[:url_name]) raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil? if @public_body.url_name.nil? diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 168b9f4c7..7ba36c725 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -106,7 +106,7 @@ class PublicBody < ActiveRecord::Base # like find_by_url_name but also search historic url_name if none found def self.find_by_url_name_with_historic(name) - locale = self.locale || I18n.locale + locale = I18n.locale PublicBody.with_locale(locale) do found = PublicBody.find(:all, :conditions => ["public_body_translations.url_name=?", name], -- cgit v1.2.3 From 4dec7290c10537ebcccba491ba5dddcefd81e43a Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 16 Jan 2013 19:16:02 +1100 Subject: Small refactoring in PublicBody.self.find_by_url_name_with_historic just use the current locale --- app/models/public_body.rb | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'app') diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 7ba36c725..6fe5cc3e5 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -106,28 +106,25 @@ class PublicBody < ActiveRecord::Base # like find_by_url_name but also search historic url_name if none found def self.find_by_url_name_with_historic(name) - locale = I18n.locale - PublicBody.with_locale(locale) do - found = PublicBody.find(:all, - :conditions => ["public_body_translations.url_name=?", name], - :joins => :translations, - :readonly => false) - # If many bodies are found (usually because the url_name is the same across - # locales) return any of them - return found.first if found.size >= 1 - - # If none found, then search the history of short names - old = PublicBody::Version.find_all_by_url_name(name) - # Find unique public bodies in it - old = old.map { |x| x.public_body_id } - old = old.uniq - # Maybe return the first one, so we show something relevant, - # rather than throwing an error? - raise "Two bodies with the same historical URL name: #{name}" if old.size > 1 - return unless old.size == 1 - # does acts_as_versioned provide a method that returns the current version? - return PublicBody.find(old.first) - end + found = PublicBody.find(:all, + :conditions => ["public_body_translations.url_name=?", name], + :joins => :translations, + :readonly => false) + # If many bodies are found (usually because the url_name is the same across + # locales) return any of them + return found.first if found.size >= 1 + + # If none found, then search the history of short names + old = PublicBody::Version.find_all_by_url_name(name) + # Find unique public bodies in it + old = old.map { |x| x.public_body_id } + old = old.uniq + # Maybe return the first one, so we show something relevant, + # rather than throwing an error? + raise "Two bodies with the same historical URL name: #{name}" if old.size > 1 + return unless old.size == 1 + # does acts_as_versioned provide a method that returns the current version? + return PublicBody.find(old.first) end # Set the first letter, which is used for faster queries -- cgit v1.2.3 From 5d22285eef67627c58320f031d03d2bffd0ba55e Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 05:26:54 +1100 Subject: Set locale with I18n rather than through globalize Conflicts: app/controllers/general_controller.rb --- app/controllers/admin_public_body_controller.rb | 10 +++++----- app/controllers/general_controller.rb | 2 +- app/controllers/public_body_controller.rb | 4 ++-- app/controllers/request_controller.rb | 6 +++--- app/models/public_body.rb | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'app') diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index bb5e98852..93715d364 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -14,7 +14,7 @@ class AdminPublicBodyController < AdminController def _lookup_query_internal @locale = self.locale_from_params() - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do @query = params[:query] if @query == "" @query = nil @@ -75,7 +75,7 @@ class AdminPublicBodyController < AdminController def show @locale = self.locale_from_params() - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do @public_body = PublicBody.find(params[:id]) render end @@ -87,7 +87,7 @@ class AdminPublicBodyController < AdminController end def create - PublicBody.with_locale(I18n.default_locale) do + I18n.with_locale(I18n.default_locale) do params[:public_body][:last_edit_editor] = admin_current_user() @public_body = PublicBody.new(params[:public_body]) if @public_body.save @@ -106,7 +106,7 @@ class AdminPublicBodyController < AdminController end def update - PublicBody.with_locale(I18n.default_locale) do + I18n.with_locale(I18n.default_locale) do params[:public_body][:last_edit_editor] = admin_current_user() @public_body = PublicBody.find(params[:id]) if @public_body.update_attributes(params[:public_body]) @@ -120,7 +120,7 @@ class AdminPublicBodyController < AdminController def destroy @locale = self.locale_from_params() - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do public_body = PublicBody.find(params[:id]) if public_body.info_requests.size > 0 diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index f6a46458e..0783fc579 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -25,7 +25,7 @@ class GeneralController < ApplicationController @locale = self.locale_from_params() locale_condition = 'public_body_translations.locale = ?' conditions = [locale_condition, @locale] - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do if body_short_names.empty? # This is too slow @popular_bodies = PublicBody.visible.find(:all, diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 9e4f7c023..1821e6725 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -69,7 +69,7 @@ class PublicBodyController < ApplicationController @public_body = PublicBody.find_by_url_name_with_historic(params[:url_name]) raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil? - PublicBody.with_locale(self.locale_from_params()) do + I18n.with_locale(self.locale_from_params()) do if params[:submitted_view_email] if verify_recaptcha flash.discard(:error) @@ -127,7 +127,7 @@ class PublicBodyController < ApplicationController @description = _("in the category ‘{{category_name}}’", :category_name=>category_name) end end - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do @public_bodies = PublicBody.paginate( :order => "public_body_translations.name", :page => params[:page], :per_page => 100, :conditions => conditions, diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index ec5c9d055..8807d2354 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -52,7 +52,7 @@ class RequestController < ApplicationController medium_cache end @locale = self.locale_from_params() - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do # Look up by old style numeric identifiers if params[:url_title].match(/^[0-9]+$/) @@ -811,7 +811,7 @@ class RequestController < ApplicationController # FOI officers can upload a response def upload_response @locale = self.locale_from_params() - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do @info_request = InfoRequest.find_by_url_title!(params[:url_title]) @reason_params = { @@ -868,7 +868,7 @@ class RequestController < ApplicationController def download_entire_request @locale = self.locale_from_params() - PublicBody.with_locale(@locale) do + I18n.with_locale(@locale) do @info_request = InfoRequest.find_by_url_title!(params[:url_title]) # Test for whole request being hidden or requester-only if !@info_request.all_can_view? diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 6fe5cc3e5..199440a28 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -326,7 +326,7 @@ class PublicBody < ActiveRecord::Base # The "internal admin" is a special body for internal use. def PublicBody.internal_admin_body - PublicBody.with_locale(I18n.default_locale) do + I18n.with_locale(I18n.default_locale) do pb = PublicBody.find_by_url_name("internal_admin_authority") if pb.nil? pb = PublicBody.new( @@ -364,7 +364,7 @@ class PublicBody < ActiveRecord::Base # of updating them bodies_by_name = {} set_of_existing = Set.new() - PublicBody.with_locale(I18n.default_locale) do + I18n.with_locale(I18n.default_locale) do bodies = (tag.nil? || tag.empty?) ? PublicBody.find(:all) : PublicBody.find_by_tag(tag) for existing_body in bodies # Hide InternalAdminBody from import notes @@ -407,7 +407,7 @@ class PublicBody < ActiveRecord::Base if public_body = bodies_by_name[name] # Existing public body available_locales.each do |locale| - PublicBody.with_locale(locale) do + I18n.with_locale(locale) do changed = ActiveSupport::OrderedHash.new field_list.each do |field_name| localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}" @@ -442,7 +442,7 @@ class PublicBody < ActiveRecord::Base else # New public body public_body = PublicBody.new(:name=>"", :short_name=>"", :request_email=>"") available_locales.each do |locale| - PublicBody.with_locale(locale) do + I18n.with_locale(locale) do changed = ActiveSupport::OrderedHash.new field_list.each do |field_name| localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}" -- cgit v1.2.3 From f6f1afd6d4d7908fd56173637fd7afbd76a8aba4 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 05:49:55 +1100 Subject: Refactor using I18.with_locale --- app/models/track_mailer.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb index 51440e4d7..7262c82f3 100644 --- a/app/models/track_mailer.rb +++ b/app/models/track_mailer.rb @@ -91,10 +91,9 @@ class TrackMailer < ApplicationMailer if email_about_things.size > 0 # Send the email - previous_locale = I18n.locale - I18n.locale = user.get_locale - TrackMailer.deliver_event_digest(user, email_about_things) - I18n.locale = previous_locale + I18n.with_locale(user.get_locale) do + TrackMailer.deliver_event_digest(user, email_about_things) + end end # Record that we've now sent those alerts to that user -- cgit v1.2.3 From d7fe6deb9d573889274797039c8472bb40d08669 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 05:50:32 +1100 Subject: Small refactor --- app/models/user.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'app') diff --git a/app/models/user.rb b/app/models/user.rb index e6c666e47..612ac7fa2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -98,12 +98,7 @@ class User < ActiveRecord::Base end def get_locale - if !self.locale.nil? - locale = self.locale - else - locale = I18n.locale - end - return locale.to_s + (self.locale || I18n.locale).to_s end def visible_comments -- cgit v1.2.3 From f0b73deefec594c9cd35985f19b66cc3bb836788 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 05:51:09 +1100 Subject: As much as possible use I18n.locale for getting the locale --- app/models/public_body.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 199440a28..b4d36fe91 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -240,13 +240,13 @@ class PublicBody < ActiveRecord::Base # When name or short name is changed, also change the url name def short_name=(short_name) - globalize.write(self.class.locale || I18n.locale, :short_name, short_name) + globalize.write(I18n.locale, :short_name, short_name) self[:short_name] = short_name self.update_url_name end def name=(name) - globalize.write(self.class.locale || I18n.locale, :name, name) + globalize.write(I18n.locale, :name, name) self[:name] = name self.update_url_name end -- cgit v1.2.3 From 965422836cbba050eab1682be8de5f83be3676b2 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 08:42:30 +1100 Subject: Remove link html from translation message Conflicts: locale/id/app.po locale/pt_BR/app.po locale/ro_RO/app.po locale/sq/app.po_ locale/sq/app__.po locale/sq/app_old3.po locale/sq/app_old4.po locale/sq/app_old5.po --- app/views/public_body/_list_sidebar_extra.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/_list_sidebar_extra.rhtml b/app/views/public_body/_list_sidebar_extra.rhtml index d3d65fec8..4b3df0606 100644 --- a/app/views/public_body/_list_sidebar_extra.rhtml +++ b/app/views/public_body/_list_sidebar_extra.rhtml @@ -1,5 +1,5 @@

- <%= raw(_('Are we missing a public authority?') % [help_requesting_path + '#missing_body']) %> + <%= link_to _('Are we missing a public authority?', help_requesting_path + '#missing_body') %>

<%= link_to _('List of all authorities (CSV)'), all_public_bodies_csv_path %> -- cgit v1.2.3 From d5bd813fbaeb45d64482a4d26679554446ed19a7 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 15:40:20 +0000 Subject: Fix closing bracket position - we only want to translate the text, not pass the url as well. --- app/views/public_body/_list_sidebar_extra.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/_list_sidebar_extra.rhtml b/app/views/public_body/_list_sidebar_extra.rhtml index 4b3df0606..290593d6a 100644 --- a/app/views/public_body/_list_sidebar_extra.rhtml +++ b/app/views/public_body/_list_sidebar_extra.rhtml @@ -1,5 +1,5 @@

- <%= link_to _('Are we missing a public authority?', help_requesting_path + '#missing_body') %> + <%= link_to _('Are we missing a public authority?'), help_requesting_path + '#missing_body' %>

<%= link_to _('List of all authorities (CSV)'), all_public_bodies_csv_path %> -- cgit v1.2.3 From 5d3c098309dde34dcc125ab7d24e0a285cf9b3c1 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 08:50:08 +1100 Subject: Remove HTML a tag from all msgids and msgstrs. Conflicts: locale/aln/app.po locale/ar/app.po locale/bs/app.po locale/ca/app.po locale/cs/app.po locale/cy/app.po locale/de/app.po locale/en_IE/app.po locale/es/app.po locale/eu/app.po locale/fr/app.po locale/gl/app.po locale/hu_HU/app.po locale/id/app.po locale/pt_BR/app.po locale/ro_RO/app.po locale/sq/app.po locale/sq/app__.po locale/sq/app_old3.po locale/sr@latin/app.po locale/tr/app.po locale/uk/app.po --- app/views/request/_sidebar.rhtml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index af33d31a2..0d66c3c48 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -65,7 +65,6 @@ -

<%= raw(_('Are you the owner of - any commercial copyright on this page?') % [help_officers_path+"#copyright"]) %>

+

<%= link_to _('Are you the owner of any commercial copyright on this page?'), help_officers_path+"#copyright" %>

-- cgit v1.2.3 From e283db7493e8e924a14ba20a8354b5fc4045f92c Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 8 Apr 2013 12:00:23 +0100 Subject: Escape content and mark known link as HTML safe to prevent it being escaped. --- app/views/admin_request/show.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index 8606d21fa..7de0cbe9a 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -258,7 +258,7 @@ <% if column_name == 'body' %> - <%= simple_format(truncate(outgoing_message.body, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden" ))) %> + <%= simple_format(truncate(h(outgoing_message.body), :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden" )).html_safe) %>
<%= simple_format( outgoing_message.body ) %>
<% else %> <%= admin_value(value) %> @@ -303,7 +303,7 @@ <% if column_name =~ /^cached_.*?$/ %> - <%= simple_format( truncate(value, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden"))) %> + <%= simple_format( truncate(h(value), :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden")).html_safe) %>
<%= simple_format(value) %>
<% else %> <%= simple_format(value) %> -- cgit v1.2.3 From fdbbb9ecabcae26c7b48d92aee06a0405a72263e Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 28 Mar 2013 10:23:18 +1100 Subject: Escaping fix in admin display of events params_yaml --- app/views/admin_request/show.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index 7de0cbe9a..2b37e8afb 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -207,7 +207,7 @@ <% if column_name == 'params_yaml' %> - <%= info_request_event.params_yaml_as_html %> + <%= info_request_event.params_yaml_as_html.html_safe %> <% elsif value.nil? %> nil <% elsif %w(text string).include?(type) %> -- cgit v1.2.3 From 21f2e40ee8fa8bdf7f449336196d4a36d2166bc5 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 9 Apr 2013 16:08:04 +0100 Subject: Remove link html from translation message Conflicts: locale/fr/app.po locale/sq/app.po_ locale/sq/app__.po locale/sq/app_old3.po locale/sq/app_old4.po locale/sq/app_old5.po --- app/views/public_body/list.rhtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml index ea5cd9613..5846b8adf 100644 --- a/app/views/public_body/list.rhtml +++ b/app/views/public_body/list.rhtml @@ -10,7 +10,7 @@ <% for row in PublicBodyCategories::get().with_headings() %> <% if row.instance_of?(Array) %>
  • - <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_path(:tag => row[0]) %> + <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_path(:tag => row[0]) %>
  • <% else %> <% if not first_row %> @@ -23,7 +23,7 @@ <% end %> <% end %> <% if not first_row %> - + <% end %> <%= render :partial => "list_sidebar_extra" %> @@ -34,7 +34,7 @@ <% form_tag(list_public_bodies_default_url, :method => "get", :id=>"search_form") do %>
    - <%= text_field_tag(:public_body_query, params[:public_body_query], { :title => "type your search term here" } ) %> + <%= text_field_tag(:public_body_query, params[:public_body_query], { :title => "type your search term here" } ) %> <%= submit_tag(_("Search")) %>
    <% end %> @@ -43,5 +43,5 @@ <%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %> <%= will_paginate(@public_bodies) %>
    - <%= raw _('Can\'t find the one you want?') % [help_requesting_path + '#missing_body'] %> + <%= link_to _("Can't find the one you want?"), help_requesting_path + '#missing_body' %> -- cgit v1.2.3 From 5843eabfab7085a4a53210fe71ebd37242b46e6e Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 9 Apr 2013 16:15:47 +0100 Subject: Remove link html from translation message Conflicts: app/views/request/_followup.rhtml locale/fr/app.po locale/sq/app.po_ locale/sq/app__.po locale/sq/app_old3.po locale/sq/app_old4.po locale/sq/app_old5.po --- app/views/request/_followup.rhtml | 9 ++++----- app/views/request/show.rhtml | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index bccfccca7..519197e90 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -61,21 +61,20 @@ <% status = @info_request.calculate_status %> <% if status == 'waiting_response_overdue' %> -

    <%= _('The response to your request has been delayed. You can say that, +

    <%= _('The response to your request has been delayed. You can say that, by law, the authority should normally have responded promptly and') %> <% if @info_request.public_body.is_school? %> <%= _('in term time') %> <% end %> <%= _('by {{date}}',:date=>simple_date(@info_request.date_response_required_by)) %> - (<%= raw(_('details') % ["#{help_requesting_path}#quickly_response"]) %>). - + (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>).

    <% elsif status == 'waiting_response_very_overdue' %>

    - <%= _('The response to your request is long overdue. You can say that, by + <%= _('The response to your request is long overdue. You can say that, by law, under all circumstances, the authority should have responded - by now') %> (<%= raw(_('details') % ["#{help_requesting_path}#quickly_response"]) %>). + by now') %> (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>).

    <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index ef49ef958..c5157de72 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -80,11 +80,11 @@ <%= _('in term time') %> <% end %> <%= _('by') %> <%= simple_date(@info_request.date_response_required_by) %> - (<%= raw(_('details') % [help_requesting_path + '#quickly_response']) %>) + (<%= link_to _('details'), help_requesting_path + '#quickly_response' %>) <% elsif @status == 'waiting_response_very_overdue' %> <%= _('Response to this request is long overdue.') %> <%= _('By law, under all circumstances, {{public_body_link}} should have responded by now',:public_body_link => public_body_link(@info_request.public_body)) %> - (<%= raw(_('details') % [help_requesting_path + '#quickly_response']) %>). + (<%= link_to _('details'), help_requesting_path + '#quickly_response' %>). <% if !@info_request.is_external? %> <%= _('You can complain by') %> <%= link_to _("requesting an internal review"), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>. -- cgit v1.2.3 From f64f12368e41925f7e11913ce06e27e7f8ba4118 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 08:42:30 +1100 Subject: Remove link html from translation message --- app/views/public_body/_list_sidebar_extra.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/_list_sidebar_extra.rhtml b/app/views/public_body/_list_sidebar_extra.rhtml index 54f20a736..1ce0fbaa9 100644 --- a/app/views/public_body/_list_sidebar_extra.rhtml +++ b/app/views/public_body/_list_sidebar_extra.rhtml @@ -1,5 +1,5 @@

    - <%= raw(_('Are we missing a public authority?') % [help_requesting_path + '#missing_body']) %> + <%= link_to _('Are we missing a public authority?'), help_requesting_path + '#missing_body' %>

    <%= link_to _('List of all authorities (CSV)'), all_public_bodies_csv_url() %> -- cgit v1.2.3 From 4369a320459c00ece0d56dc3e2000e43ac01c8c6 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 08:50:08 +1100 Subject: Remove link html from translation message --- app/views/request/_sidebar.rhtml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index d349bee14..5552d6930 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -62,7 +62,6 @@ -

    <%= raw(_('Are you the owner of - any commercial copyright on this page?') % [help_officers_path+"#copyright"]) %>

    +

    <%= link_to _('Are you the owner of any commercial copyright on this page?'), help_officers_path+"#copyright" %>

    -- cgit v1.2.3 From 5415e74f2308cae04609c638a5d6fdcd60dccc53 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 09:04:04 +1100 Subject: Remove link html from translation message --- app/views/public_body/list.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml index 94fbb759c..096282edf 100644 --- a/app/views/public_body/list.rhtml +++ b/app/views/public_body/list.rhtml @@ -43,5 +43,5 @@ <%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %> <%= will_paginate(@public_bodies) %>
    - <%= raw _('Can\'t find the one you want?') % [help_requesting_path + '#missing_body'] %> + <%= link_to _("Can't find the one you want?", help_requesting_path + '#missing_body') %> -- cgit v1.2.3 From 1ed460e5dc13619e1d4335d3372b5587e5fdb675 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 16:02:02 +0000 Subject: Move closing bracket to end of string, only want to translate text. --- app/views/public_body/list.rhtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml index 096282edf..9ae9e0c5f 100644 --- a/app/views/public_body/list.rhtml +++ b/app/views/public_body/list.rhtml @@ -10,7 +10,7 @@ <% for row in PublicBodyCategories::get().with_headings() %> <% if row.instance_of?(Array) %>
  • - <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_url(:tag => row[0]) %> + <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_url(:tag => row[0]) %>
  • <% else %> <% if not first_row %> @@ -23,7 +23,7 @@ <% end %> <% end %> <% if not first_row %> - + <% end %> <%= render :partial => "list_sidebar_extra" %> @@ -34,7 +34,7 @@ <% form_tag(list_public_bodies_default_url, :method => "get", :id=>"search_form") do %>
    - <%= text_field_tag(:public_body_query, params[:public_body_query]) %> + <%= text_field_tag(:public_body_query, params[:public_body_query]) %> <%= submit_tag(_("Search")) %>
    <% end %> @@ -43,5 +43,5 @@ <%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %> <%= will_paginate(@public_bodies) %>
    - <%= link_to _("Can't find the one you want?", help_requesting_path + '#missing_body') %> + <%= link_to _("Can't find the one you want?"), help_requesting_path + '#missing_body' %> -- cgit v1.2.3 From 3634d085d1bfe49c993780b13b3014dda70b0f84 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 17 Jan 2013 09:19:31 +1100 Subject: Remove link html from translation message --- app/views/request/_followup.rhtml | 4 ++-- app/views/request/show.rhtml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index 451932b8d..959dae6d0 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -63,14 +63,14 @@ <%= _('in term time') %> <% end %> <%= _('by {{date}}',:date=>simple_date(@info_request.date_response_required_by)) %> - (<%= raw(_('details') % ["#{help_requesting_path}#quickly_response"]) %>). + (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>).

    <% elsif status == 'waiting_response_very_overdue' %>

    <%= _('The response to your request is long overdue. You can say that, by law, under all circumstances, the authority should have responded - by now') %> (<%= raw(_('details') % ["#{help_requesting_path}#quickly_response"]) %>). + by now') %> (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>).

    <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 0cae3a9aa..cd6ed916e 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -80,11 +80,11 @@ <%= _('in term time') %> <% end %> <%= _('by') %> <%= simple_date(@info_request.date_response_required_by) %> - (<%= raw(_('details') % [help_requesting_path + '#quickly_response']) %>) + (<%= link_to _('details'), help_requesting_path + '#quickly_response' %>) <% elsif @status == 'waiting_response_very_overdue' %> <%= _('Response to this request is long overdue.') %> <%= _('By law, under all circumstances, {{public_body_link}} should have responded by now',:public_body_link => public_body_link(@info_request.public_body)) %> - (<%= raw(_('details') % [help_requesting_path + '#quickly_response']) %>). + (<%= link_to _('details'), help_requesting_path + '#quickly_response' %>). <% if !@info_request.is_external? %> <%= _('You can complain by') %> <%= link_to _("requesting an internal review"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>. -- cgit v1.2.3 From 0bcc31dcb9a4e3e689290693ee0e0a157b3ce09d Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 16:27:18 +0000 Subject: Replace %s with {{}} formatting in translation string with url. --- app/views/request/_followup.rhtml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'app') diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index 959dae6d0..2ac1d57d4 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -8,16 +8,16 @@

    <%= _('Request an internal review from {{person_or_body}}', :person_or_body => name_for_followup) %>

    <% elsif incoming_message.nil? || !incoming_message.valid_to_reply_to? %> -

    <%= _('Send a public follow up message to {{person_or_body}}', :person_or_body => name_for_followup) %> +

    <%= _('Send a public follow up message to {{person_or_body}}', :person_or_body => name_for_followup) %>

    <% else %> -

    <%= _('Send a public reply to {{person_or_body}}', :person_or_body => name_for_followup) %> +

    <%= _('Send a public reply to {{person_or_body}}', :person_or_body => name_for_followup) %>

    <% end %> <% if @info_request.who_can_followup_to(incoming_message).count > 0 %>
    - <%= _("Don't want to address your message to {{person_or_body}}? You can also write to:", :person_or_body => name_for_followup) %> -
      + <%= _("Don't want to address your message to {{person_or_body}}? You can also write to:", :person_or_body => name_for_followup) %> +
        <% @info_request.who_can_followup_to(incoming_message).each do |name, email, id| %> <% if id.nil? && !incoming_message.nil? && incoming_message.valid_to_reply_to? %>
      • <%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %>
      • @@ -44,31 +44,31 @@ <% else %> <% if @internal_review %>

        - <%= raw(_('If you are dissatisfied by the response you got from + <%= _('If you are dissatisfied by the response you got from the public authority, you have the right to - complain (details).') % "http://foiwiki.com/foiwiki/index.php/Internal_reviews") %> + complain (details).', :url => "http://foiwiki.com/foiwiki/index.php/Internal_reviews".html_safe) %>

        <% end %>

        - <%= _('Please only write messages directly relating to your request {{request_link}}. If you would like to ask for information that was not in your original request, then file a new request.', :request_link=>request_link(@info_request), :new_request_link => new_request_to_body_url(:url_name => @info_request.public_body.url_name)) %> + <%= _('Please only write messages directly relating to your request {{request_link}}. If you would like to ask for information that was not in your original request, then file a new request.', :request_link=>request_link(@info_request), :new_request_link => new_request_to_body_url(:url_name => @info_request.public_body.url_name)) %>

        <% status = @info_request.calculate_status %> <% if status == 'waiting_response_overdue' %> -

        <%= _('The response to your request has been delayed. You can say that, +

        <%= _('The response to your request has been delayed. You can say that, by law, the authority should normally have responded promptly and') %> <% if @info_request.public_body.is_school? %> - <%= _('in term time') %> + <%= _('in term time') %> <% end %> <%= _('by {{date}}',:date=>simple_date(@info_request.date_response_required_by)) %> (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>). - +

        <% elsif status == 'waiting_response_very_overdue' %>

        - <%= _('The response to your request is long overdue. You can say that, by + <%= _('The response to your request is long overdue. You can say that, by law, under all circumstances, the authority should have responded by now') %> (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>).

        @@ -97,8 +97,8 @@ -->
        <%= radio_button "outgoing_message", "what_doing", "internal_review", :id => "internal_review" %> -
        -- cgit v1.2.3 From d8ba66ec47569bb16b3f4d6410a6f97d6986df23 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 16:45:49 +0000 Subject: Replace %s with {{}} interpolation format in url. --- app/views/request/preview.rhtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml index 8d1fd753e..3171acfd3 100644 --- a/app/views/request/preview.rhtml +++ b/app/views/request/preview.rhtml @@ -1,12 +1,12 @@ <% @title = "Preview new " + h(@info_request.law_used_short) + " request to '" + h(@info_request.public_body.name) + "'" %> <% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %> - +

        <%= _('3. Now check your request') %>

        • <%= _('Check you haven\'t included any personal information.') %>
        • <%= raw(_('Your name, request and any responses will appear in search engines - (details).') % [help_privacy_path+"#public_request"]) %> + (details).', :url => (help_privacy_path+"#public_request").html_safe)) %>
        @@ -23,7 +23,7 @@ <%= o.hidden_field(:body) %>
        -

        +

    <% end %> @@ -38,7 +38,7 @@ <%= hidden_field_tag(:submitted_new_request, 1) %> <%= hidden_field_tag(:preview, 0 ) %> <%= submit_tag _("Edit this request"), :name => 'reedit', :id => 'reedit_button' %> - <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %> + <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %>

    <% if !@info_request.tag_string.empty? %> -- cgit v1.2.3 From 5fe436b52859d3e9be30d7c849cf8f83b3316b91 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 17:01:09 +0000 Subject: Use {{}} instead of %s in url string interpolation. --- app/views/user/_signup.rhtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.rhtml index 913423ffa..705a59641 100644 --- a/app/views/user/_signup.rhtml +++ b/app/views/user/_signup.rhtml @@ -10,8 +10,8 @@ <%= text_field 'user_signup', 'email', { :size => 20, :tabindex => 60 } %>

    - <%= raw(_('We will not reveal your email address to anybody unless you or - the law tell us to (details). ') %[help_privacy_path]) %> + <%= _('We will not reveal your email address to anybody unless you or + the law tell us to (details). ', :url => help_privacy_path) %>

    @@ -19,10 +19,10 @@ <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 70 } %>

    - <%= raw(_('Your name will appear publicly + <%= raw(_('Your name will appear publicly (why?) on this website and in search engines. If you - are thinking of using a pseudonym, please + are thinking of using a pseudonym, please read this first.') % [help_privacy_path+"#public_request", help_privacy_path+"#real_name"]) %>
    -- cgit v1.2.3 From 884b879400f7da1e70436a42469cbfdda6e2d6c2 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 17:24:55 +0000 Subject: Use {{}} instead of %s in url interpolation. --- app/controllers/request_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 49d2f35f3..cbd6543cb 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -322,9 +322,9 @@ class RequestController < ApplicationController message = "" if @outgoing_message.contains_email? if @user.nil? - message += (_("

    You do not need to include your email in the request in order to get a reply, as we will ask for it on the next screen (details).

    ") % [help_privacy_path+"#email_address"]).html_safe; + message += _("

    You do not need to include your email in the request in order to get a reply, as we will ask for it on the next screen (details).

    ", :url => (help_privacy_path+"#email_address").html_safe); else - message += (_("

    You do not need to include your email in the request in order to get a reply (details).

    ") % [help_privacy_path+"#email_address"]).html_safe; + message += _("

    You do not need to include your email in the request in order to get a reply (details).

    ", :url => (help_privacy_path+"#email_address").html_safe); end message += _("

    We recommend that you edit your request and remove the email address. If you leave it, the email address will be sent to the authority, but will not be displayed on the site.

    ") @@ -333,7 +333,7 @@ class RequestController < ApplicationController message += _("

    Your request contains a postcode. Unless it directly relates to the subject of your request, please remove any address as it will appear publicly on the Internet.

    "); end if not message.empty? - flash.now[:error] = message + flash.now[:error] = message.html_safe end render :action => 'preview' return -- cgit v1.2.3 From 9fbfbbb4c5e492bd0a653a65bc651db7783a8f88 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 11:52:37 +1100 Subject: Remove translation string that is just html and no words --- app/views/public_body/show.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 6431b4742..4833657f6 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -56,7 +56,7 @@ <% else %> <%= _('Make a new Freedom of Information request to {{public_body}}', :public_body => h(@public_body.name))%> <% end %> -  <%= _('{{text}}', :url=>new_request_to_body_url(:url_name => @public_body.url_name), :text=>_("Start"))%> +  <%= link_to _("Start"), new_request_to_body_url(:url_name => @public_body.url_name), :class => "link_button_green" %> <% elsif @public_body.has_notes? %> <%= @public_body.notes_as_html %> <% elsif @public_body.not_requestable_reason == 'not_apply' %> -- cgit v1.2.3 From adb74ad68c8bfa22869bf21088767a85175edbbb Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 17:48:17 +0000 Subject: Remove url from translation. --- app/views/request/_followup.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index 2ac1d57d4..4f7d99dd4 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -98,7 +98,7 @@
    <%= radio_button "outgoing_message", "what_doing", "internal_review", :id => "internal_review" %>
    -- cgit v1.2.3 From 59846923c92d25c6f8aad74836b9fc9244d20be0 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 12:33:48 +1100 Subject: In translation strings replace %s with {{}} formatting --- app/views/comment/_comment_form.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/comment/_comment_form.rhtml b/app/views/comment/_comment_form.rhtml index 120929643..d834b5b90 100644 --- a/app/views/comment/_comment_form.rhtml +++ b/app/views/comment/_comment_form.rhtml @@ -13,7 +13,7 @@ <%= hidden_field_tag 'submitted_comment', 1 %> <%= hidden_field_tag 'preview', 1 %> <%= submit_tag _('Preview your annotation') %> - <%= raw(_(' (no ranty politics, read our moderation policy)') % [help_requesting_path+'#moderation']) %> + <%= _(' (no ranty politics, read our moderation policy)', :url => (help_requesting_path+'#moderation').html_safe) %>

    <% end %> -- cgit v1.2.3 From a003563920333598c129c4b47410e621eb24a4eb Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 12:40:57 +1100 Subject: In translation strings replace %s with {{}} formatting --- app/views/public_body/view_email.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/public_body/view_email.rhtml b/app/views/public_body/view_email.rhtml index 50601069f..014f5a5c0 100644 --- a/app/views/public_body/view_email.rhtml +++ b/app/views/public_body/view_email.rhtml @@ -27,8 +27,8 @@ <% if @public_body.is_requestable? || @public_body.not_requestable_reason != 'bad_contact' %> <%= _('If the address is wrong, or you know a better address, please contact us.')% [help_contact_path]%> <% else %> - <%= _(' If you know the address to use, then please send it to us. - You may be able to find the address on their website, or by phoning them up and asking.')% [help_contact_path] %> + <%= _(' If you know the address to use, then please send it to us. + You may be able to find the address on their website, or by phoning them up and asking.', :url =>help_contact_path.html_safe) %> <% end %>

    -- cgit v1.2.3 From 0b9378f8f4f621d403d7aa7b8060a9eddecb2e33 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 13:45:20 +1100 Subject: In translation strings replace %s and %d with {{}} formatting --- app/views/public_body/show.rhtml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 4833657f6..563beb383 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -93,7 +93,11 @@ <% if @public_body.info_requests.size > 4 %> <%= n_('Search within the %d Freedom of Information requests to %s', 'Search within the %d Freedom of Information requests made to %s', @public_body.info_requests.size) % [@public_body.info_requests.size, @public_body.name] %> <% else %> - <%= n_('%d Freedom of Information request to %s', '%d Freedom of Information requests to %s', @public_body.info_requests.size) % [@public_body.info_requests.size, @public_body.name] %> + <%= n_('{{count}} Freedom of Information request to {{public_body_name}}', + '{{count}} Freedom of Information requests to {{public_body_name}}', + @public_body.info_requests.size, + :count => @public_body.info_requests.size, + :public_body_name => @public_body.name) %> <% end %> <% end %> <%= @page_desc %> -- cgit v1.2.3 From 26679b1b514e1a8f823cd86a81955a7867d537b6 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 14:02:35 +1100 Subject: In translation strings replace %d with {{}} formatting --- app/views/public_body/_body_listing_single.rhtml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/_body_listing_single.rhtml b/app/views/public_body/_body_listing_single.rhtml index b01d2ebb2..600fe3b6d 100644 --- a/app/views/public_body/_body_listing_single.rhtml +++ b/app/views/public_body/_body_listing_single.rhtml @@ -18,7 +18,8 @@ <% end %> - <%= n_('%d request made.', '%d requests made.', public_body.info_requests.size) % public_body.info_requests.size %> + <%= n_('{{count}} request made.', '{{count}} requests made.', public_body.info_requests.size, + :count => 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 %> -- cgit v1.2.3 From 54d9fcb1dd7218d23b3e162b22c87b7e2bce80e6 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 14:10:05 +1100 Subject: In translation strings replace %d with {{}} formatting --- app/views/general/_frontpage_bodies_list.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/general/_frontpage_bodies_list.rhtml b/app/views/general/_frontpage_bodies_list.rhtml index 503b38953..a32885f31 100644 --- a/app/views/general/_frontpage_bodies_list.rhtml +++ b/app/views/general/_frontpage_bodies_list.rhtml @@ -6,7 +6,7 @@
      <% for popular_body in @popular_bodies %>
    • <%=public_body_link(popular_body)%> - <%= n_('%d request', '%d requests', popular_body.info_requests_count) % popular_body.info_requests_count %> + <%= n_('{{count}} request', '{{count}} requests', popular_body.info_requests_count, :count => popular_body.info_requests_count) %>
    • <% end%>
    -- cgit v1.2.3 From 29f26dd923c1d709dcb3e654afef2ba874a34301 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 14:27:29 +1100 Subject: In translation strings replace %d with {{}} formatting and get rid of html --- app/views/public_body/show.rhtml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 563beb383..39f62fedc 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -4,7 +4,12 @@

    <%= _('Follow this authority')%>

    <% follower_count = TrackThing.count(:all, :conditions => ["public_body_id = ?", @public_body.id]) %> -

    <%= raw(n_("%d person is following this authority", "%d people are following this authority", follower_count) % follower_count) %>

    +

    + <%= n_("{{count}} person is following this authority", + "{{count}} people are following this authority", + follower_count, + :count => content_tag(:span, follower_count, :id => "follow_count")) %> +

    <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %>

    <%= _('More about this authority')%>

    -- cgit v1.2.3 From 79f552fbe1b088629ffa7bc32cf580656935a432 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 14:48:01 +1100 Subject: In translation strings replace %s and %d with {{}} formatting --- app/views/public_body/list.rhtml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml index 9ae9e0c5f..9edaf1c36 100644 --- a/app/views/public_body/list.rhtml +++ b/app/views/public_body/list.rhtml @@ -39,7 +39,13 @@
    <% end %> -

    <%= n_('Found %d public authority %s', 'Found %d public authorities %s', @public_bodies.total_entries) % [@public_bodies.total_entries, @description] %>

    +

    + <%= n_('Found {{count}} public authority {{description}}', + 'Found {{count}} public authorities {{description}}', + @public_bodies.total_entries, + :count => @public_bodies.total_entries, + :description => @description) %> +

    <%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %> <%= will_paginate(@public_bodies) %>
    -- cgit v1.2.3 From 20605630197686023576768f7abbc211a3044202 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 15:02:33 +1100 Subject: In translation strings replace %{} with {{}} formatting --- app/models/profile_photo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb index 6e605651d..bcb0390b5 100644 --- a/app/models/profile_photo.rb +++ b/app/models/profile_photo.rb @@ -97,7 +97,7 @@ class ProfilePhoto < ActiveRecord::Base end if !self.draft && (self.image.columns != WIDTH || self.image.rows != HEIGHT) - errors.add(:data, N_("Failed to convert image to the correct size: at %{cols}x%{rows}, need %{width}x%{height}" % { :cols => self.image.columns, :rows => self.image.rows, :width => WIDTH, :height => HEIGHT })) + errors.add(:data, _("Failed to convert image to the correct size: at {{cols}}x{{rows}}, need {{width}}x{{height}}", :cols => self.image.columns, :rows => self.image.rows, :width => WIDTH, :height => HEIGHT)) end if self.draft && self.user_id -- cgit v1.2.3 From 327f8bbfa2a1a329fabdbf621cc2e024ce7e04ba Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 18:35:01 +0000 Subject: Replace %s and %d with {{}} formatting in translated string. --- app/views/public_body/show.rhtml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 39f62fedc..6e0e0c010 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -32,14 +32,14 @@ <% end %> <% end %> <%= link_to _('View FOI email address'), view_public_body_email_url(@public_body.url_name) %>
    - +

    <%= _("Freedom of information requests to") %>

    <%=h(@public_body.name)%>

    - <%=@public_body.type_of_authority(true)%><% if not @public_body.short_name.empty? %>, + <%=@public_body.type_of_authority(true)%><% if not @public_body.short_name.empty? %>, <%= _('also called {{public_body_short_name}}', :public_body_short_name => h(@public_body.short_name))%><% end %> <% if !@user.nil? && @user.admin_page_links? %> (<%= link_to _("admin"), public_body_admin_url(@public_body) %>) @@ -96,7 +96,7 @@ <%= pluralize(@public_body.info_requests.size, "Environmental Information Regulations request made using this site") %> <% else %> <% if @public_body.info_requests.size > 4 %> - <%= n_('Search within the %d Freedom of Information requests to %s', 'Search within the %d Freedom of Information requests made to %s', @public_body.info_requests.size) % [@public_body.info_requests.size, @public_body.name] %> + <%= n_('Search within the {{count}} Freedom of Information requests to {{public_body_name}}', 'Search within the {{count}} Freedom of Information requests made to {{public_body_name}}', @public_body.info_requests.size, :count => @public_body.info_requests.size, :public_body_name => @public_body.name) %> <% else %> <%= n_('{{count}} Freedom of Information request to {{public_body_name}}', '{{count}} Freedom of Information requests to {{public_body_name}}', @@ -108,7 +108,7 @@ <%= @page_desc %> - + <% if @public_body.info_requests.size > 4 %> <%= render :partial => 'request/request_filter_form' %> <% end %> @@ -129,7 +129,7 @@

    <%= _('Only requests made using {{site_name}} are shown.', :site_name => site_name) %>

    <% end %> - <% else %> + <% else %> <% if @public_body.eir_only? %>

    <%= _('Environmental Information Regulations requests made') %>

    <% else %> -- cgit v1.2.3 From dddd7c55dde90d2afa9019b862fedc6a78a393c2 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 18 Jan 2013 15:38:07 +1100 Subject: In translation strings replace %d with {{}} formatting --- app/views/request/_sidebar.rhtml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index 5552d6930..5c4ef97ef 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -3,7 +3,12 @@

    <%= _('Follow this request') %>

    <% follower_count = TrackThing.count(:all, :conditions => ["info_request_id = ?", @info_request.id]) + 1 %> -

    <%= n_("There is %d person following this request", "There are %d people following this request", follower_count) % follower_count %>

    +

    + <%= n_("There is {{count}} person following this request", + "There are {{count}} people following this request", + follower_count, + :count => follower_count) %> +

    <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => @info_request.user == @user, :location => 'sidebar' } %>
    <% if @info_request.described_state != "attention_requested" %> -- cgit v1.2.3 From 3f894f807857b214a655c4b8fdef1956663cdcdc Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 21 Jan 2013 12:40:43 +1100 Subject: In translation strings replace %d with {{}} formatting --- app/views/user/show.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 31ea2a70b..2d784cf52 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -128,7 +128,7 @@ <% end %> <% else %>

    - <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated.to_s : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated %> + <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated.to_s : n_("This person's {{count}} Freedom of Information request", "This person's {{count}} Freedom of Information requests", @xapian_requests.matches_estimated, :count => @xapian_requests.matches_estimated) %> <%= @match_phrase %> <%= @page_desc %> -- cgit v1.2.3 From e39ca6eec6c06b9bf81b1ba622672284c4eb9d16 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 21 Jan 2013 12:48:19 +1100 Subject: In translation strings replace %d with {{}} formatting --- app/views/user/show.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 2d784cf52..33e3d8f56 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -158,7 +158,7 @@ <% end %> <% else %>

    - <%= @is_you ? n_('Your %d annotation', 'Your %d annotations', @display_user.visible_comments.size) % @display_user.visible_comments.size : n_('This person\'s %d annotation', 'This person\'s %d annotations', @display_user.visible_comments.size) % @display_user.visible_comments.size %> + <%= @is_you ? n_('Your %d annotation', 'Your %d annotations', @display_user.visible_comments.size) % @display_user.visible_comments.size : n_("This person's {{count}} annotation", "This person's {{count}} annotations", @display_user.visible_comments.size, :count => @display_user.visible_comments.size) %> <%= @page_desc %>

    -- cgit v1.2.3 From 14bc45c803422a0ba0702e7806f7bc2ffefb3ae7 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 21 Jan 2013 12:53:36 +1100 Subject: In translation strings replace %d with {{}} formatting --- app/views/user/show.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 33e3d8f56..0bb12ac4a 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -128,7 +128,7 @@ <% end %> <% else %>

    - <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated.to_s : n_("This person's {{count}} Freedom of Information request", "This person's {{count}} Freedom of Information requests", @xapian_requests.matches_estimated, :count => @xapian_requests.matches_estimated) %> + <%= @is_you ? n_('Your {{count}} Freedom of Information request', 'Your {{count}} Freedom of Information requests', @xapian_requests.matches_estimated, :count => @xapian_requests.matches_estimated) : n_("This person's {{count}} Freedom of Information request", "This person's {{count}} Freedom of Information requests", @xapian_requests.matches_estimated, :count => @xapian_requests.matches_estimated) %> <%= @match_phrase %> <%= @page_desc %> -- cgit v1.2.3 From 7eb8d3ef1c1b784698346f8c148bdd3a652af150 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 21 Jan 2013 12:58:26 +1100 Subject: In translation strings replace %d with {{}} formatting --- app/views/user/show.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 0bb12ac4a..1bcb1860b 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -158,7 +158,7 @@ <% end %> <% else %>

    - <%= @is_you ? n_('Your %d annotation', 'Your %d annotations', @display_user.visible_comments.size) % @display_user.visible_comments.size : n_("This person's {{count}} annotation", "This person's {{count}} annotations", @display_user.visible_comments.size, :count => @display_user.visible_comments.size) %> + <%= @is_you ? n_('Your {{count}} annotation', 'Your {{count}} annotations', @display_user.visible_comments.size, :count => @display_user.visible_comments.size) : n_("This person's {{count}} annotation", "This person's {{count}} annotations", @display_user.visible_comments.size, :count => @display_user.visible_comments.size) %> <%= @page_desc %>

    -- cgit v1.2.3 From dc0f6181e445a64cd14f6c5bb5e052dc320cd956 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 19:30:39 +0000 Subject: Use {{}} not %s in translation. --- app/controllers/request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index cbd6543cb..bf9e6c689 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -625,7 +625,7 @@ class RequestController < ApplicationController if !params[:submitted_followup].nil? && !params[:reedit] if @info_request.allow_new_responses_from == 'nobody' - flash[:error] = (_('Your follow up has not been sent because this request has been stopped to prevent spam. Please contact us if you really want to send a follow up message.') % [help_contact_path]).html_safe + flash[:error] = _('Your follow up has not been sent because this request has been stopped to prevent spam. Please contact us if you really want to send a follow up message.', :url => help_contact_path.html_safe) else if @info_request.find_existing_outgoing_message(params[:outgoing_message][:body]) flash[:error] = _('You previously submitted that exact follow up message for this request.') -- cgit v1.2.3 From 230082876d069523d7c0b1bbf1578dc1419dfb23 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 21 Jan 2013 19:44:23 +0000 Subject: Replace %s with {{}} in translation for "Browse all..." --- app/views/general/search.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 6df12d980..9640bc674 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -164,7 +164,7 @@ <% if @spelling_correction %>

    <%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @postfix)) %>

    <% end %> -

    <%= raw(_('Browse all or ask us to add one.') % [list_public_bodies_default, help_requesting_path + '#missing_body']) %>

    +

    <%= _('Browse all or ask us to add one.', :browse_url => list_public_bodies_default.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe) %>

    <% end %> -- cgit v1.2.3 From 953e7fc3f934b0adec2eda26f1aa5c00f47afea1 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 15:48:34 +0000 Subject: Replace %s with {{}} in translations. --- app/views/request/show_response.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/show_response.rhtml b/app/views/request/show_response.rhtml index ac1f04227..a61359679 100644 --- a/app/views/request/show_response.rhtml +++ b/app/views/request/show_response.rhtml @@ -26,8 +26,8 @@ <%= _('The authority only has a paper copy of the information.') %>
    - <%= raw(_('At the bottom of this page, write a reply to them trying to persuade them to scan it in - (more details).') % [help_privacy_path + '#postal_answer']) %> + <%= _('At the bottom of this page, write a reply to them trying to persuade them to scan it in + (more details).', :url => (help_privacy_path + '#postal_answer').html_safe) %>
    -- cgit v1.2.3 From 7e0163d15da2bc83eecc589937bd779d3a16c467 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:05:34 +0000 Subject: Replace %s with {{}} in translation "If the address is wrong..." --- app/views/public_body/view_email.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/public_body/view_email.rhtml b/app/views/public_body/view_email.rhtml index 014f5a5c0..a213ff93d 100644 --- a/app/views/public_body/view_email.rhtml +++ b/app/views/public_body/view_email.rhtml @@ -25,7 +25,7 @@

    <% if @public_body.is_requestable? || @public_body.not_requestable_reason != 'bad_contact' %> - <%= _('If the address is wrong, or you know a better address, please contact us.')% [help_contact_path]%> + <%= _('If the address is wrong, or you know a better address, please contact us.', :url => help_contact_path.html_safe) %> <% else %> <%= _(' If you know the address to use, then please send it to us. You may be able to find the address on their website, or by phoning them up and asking.', :url =>help_contact_path.html_safe) %> -- cgit v1.2.3 From e88d925b41ae2c54e555cf0d536e8d2abe47b6d7 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:08:17 +0000 Subject: Replace %s with {{}} in translation. --- app/views/request/_after_actions.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml index 3d74cf42d..204c407ee 100644 --- a/app/views/request/_after_actions.rhtml +++ b/app/views/request/_after_actions.rhtml @@ -7,7 +7,7 @@

      <% if @info_request.comments_allowed? %>
    • - <%= raw(_('Add an annotation (to help the requester or others)') % [new_comment_url(:url_title => @info_request.url_title)]) %> + <%= _('Add an annotation (to help the requester or others)', :url => new_comment_url(:url_title => @info_request.url_title).html_safe) %>
    • <% end %> <% if @old_unclassified %> -- cgit v1.2.3 From c216ecd7c15288a759d3c09781a7c29dad75fc49 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:14:48 +0000 Subject: Replace %s with {{}} in translation. --- app/views/user/show.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 1bcb1860b..cbb05ebf6 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -97,7 +97,7 @@ <% if not @is_you %>

      - <%= raw(_('Sign in to change password, subscriptions and more ({{user_name}} only)',:user_name=>h(@display_user.name)) % [signin_url(:r => request.request_uri)]) %> + <%= _('Sign in to change password, subscriptions and more ({{user_name}} only)',:user_name=>h(@display_user.name), :url => signin_url(:r => request.request_uri).html_safe) %>

      <% end %> -- cgit v1.2.3 From ad6d122d2ad401bbdfff3a61591f13df557c3bb7 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:24:38 +0000 Subject: Replace %s with {{}} in translation "Can I request information about myself?..." --- app/views/request/new.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index f396ea9ec..4b23211da 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -127,8 +127,8 @@ <% end %>

      - <%= raw(_(" Can I request information about myself?\n" + - "\t\t\tNo! (Click here for details)") % [help_requesting_path+"#data_protection"]) %> + <%= _(" Can I request information about myself?\n" + + "\t\t\tNo! (Click here for details)", :url => (help_requesting_path+"#data_protection").html_safe) %>

      -- cgit v1.2.3 From 684b44d9f12a2abe8fd02e811e91b2371ad99f29 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:32:50 +0000 Subject: Replace %s with {{}} in translations. --- app/views/request/preview.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml index 3171acfd3..424277b50 100644 --- a/app/views/request/preview.rhtml +++ b/app/views/request/preview.rhtml @@ -28,8 +28,8 @@
      <% end %> -

      <%= raw(_('Privacy note: If you want to request private information about - yourself then click here.') % [help_requesting_path+"#data_protection"]) %> +

      <%= _('Privacy note: If you want to request private information about + yourself then click here.', :url => (help_requesting_path+"#data_protection").html_safe) %>

      <%= f.hidden_field(:title) %> -- cgit v1.2.3 From 433034167b09df2e207810b04c6508985827becd Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:46:26 +0000 Subject: Replace %s with {{}} in translation. --- app/views/user/wrong_user_unknown_email.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/user/wrong_user_unknown_email.rhtml b/app/views/user/wrong_user_unknown_email.rhtml index c59c56941..c1967fc1f 100644 --- a/app/views/user/wrong_user_unknown_email.rhtml +++ b/app/views/user/wrong_user_unknown_email.rhtml @@ -1,8 +1,8 @@

      -<%= @reason_params[:web] %>. <%= raw(_('Unfortunately we don\'t know the FOI +<%= @reason_params[:web] %>. <%= _('Unfortunately we don\'t know the FOI email address for that authority, so we can\'t validate this. -Please contact us to sort it out.') % [help_contact_path]) %> +Please contact us to sort it out.', :url => help_contact_path.html_safe) %>

      -- cgit v1.2.3 From 8a2c486326db0b4f959a2d4168c985228b22bb9b Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:49:14 +0000 Subject: Replace %s with {{}} in translation. --- app/views/user/no_cookies.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/user/no_cookies.rhtml b/app/views/user/no_cookies.rhtml index c291367f2..d52322cda 100644 --- a/app/views/user/no_cookies.rhtml +++ b/app/views/user/no_cookies.rhtml @@ -12,7 +12,7 @@ browser. Then press refresh to have another go.')%>

      <%= _('If your browser is set to accept cookies and you are seeing this message, then there is probably a fault with our server.')%> -<%= raw(_('Please get in touch with us so we can fix it.') % [help_contact_path]) %> +<%= _('Please get in touch with us so we can fix it.', :url => help_contact_path.html_safe) %> <%= _('Let us know what you were doing when this message appeared and your browser and operating system type and version.')%>

      -- cgit v1.2.3 From edd083fbb989248c48efcbb990b6dfee3531aa1d Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 16:53:36 +0000 Subject: Replace %s with {{}} in translation. --- app/views/user/no_cookies.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/user/no_cookies.rhtml b/app/views/user/no_cookies.rhtml index d52322cda..0a4a39b1b 100644 --- a/app/views/user/no_cookies.rhtml +++ b/app/views/user/no_cookies.rhtml @@ -17,6 +17,6 @@ then there is probably a fault with our server.')%> <%= _('Let us know what you were doing when this message appeared and your browser and operating system type and version.')%>

      -

      <%= raw(_('If you are still having trouble, please contact us.') % [help_contact_path]) %> +

      <%= _('If you are still having trouble, please contact us.', :url => help_contact_path.html_safe) %>

      -- cgit v1.2.3 From a4cd441fa946680a48062eb14929d04361089c38 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 17:01:41 +0000 Subject: Replace %s with {{}} in translation. --- app/views/request/_sidebar.rhtml | 4 ++-- app/views/request/show.rhtml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index 5c4ef97ef..0d862ad41 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -22,8 +22,8 @@ <% elsif @info_request.prominence == 'requester_only' %> <%# The eccentric formatting of the following string is in order that it be identical to the corresponding string in request/show.rhtml %> -

      <%= raw(_('This request is hidden, so that only you the requester can see it. Please - contact us if you are not sure why.') % [help_requesting_path]) %>

      +

      <%= _('This request is hidden, so that only you the requester can see it. Please + contact us if you are not sure why.', :url => help_requesting_path.html_safe) %>

      <% else %>

      <%= raw(_('This request has been marked for review by the site administrators, who have not hidden it at this time. If you believe it should be hidden, please contact us.') % [help_requesting_path]) %>

      <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index cd6ed916e..ce205d68c 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -10,8 +10,8 @@ <% end %> <% if @info_request.prominence == 'requester_only' %>

      - <%= raw(_('This request is hidden, so that only you the requester can see it. Please - contact us if you are not sure why.') % [help_requesting_path]) %> + <%= _('This request is hidden, so that only you the requester can see it. Please + contact us if you are not sure why.', :url => help_requesting_path.html_safe) %>

      <% end %> -- cgit v1.2.3 From 25c9865a793a3fa0029b40e1177496acc3024b7b Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 17:56:55 +0000 Subject: Replace %s with {{}} in translations. --- app/views/user/_signup.rhtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.rhtml index 705a59641..f29cfc8bf 100644 --- a/app/views/user/_signup.rhtml +++ b/app/views/user/_signup.rhtml @@ -19,11 +19,11 @@ <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 70 } %>

      - <%= raw(_('Your name will appear publicly - (why?) + <%= _('Your name will appear publicly + (why?) on this website and in search engines. If you are thinking of using a pseudonym, please - read this first.') % [help_privacy_path+"#public_request", help_privacy_path+"#real_name"]) %> + read this first.', :why_url => (help_privacy_path+"#public_request").html_safe, :help_url => (help_privacy_path+"#real_name").html_safe) %>

      -- cgit v1.2.3 From d2bf5fd71f36b43615ffe57c9ee5134f0a1e2279 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 18:22:45 +0000 Subject: Replace %s with {{}} in translation "Your response will appear.." --- app/views/request/upload_response.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/upload_response.rhtml b/app/views/request/upload_response.rhtml index bc129426d..a0611ff96 100644 --- a/app/views/request/upload_response.rhtml +++ b/app/views/request/upload_response.rhtml @@ -12,7 +12,7 @@

      <%= _('Respond to the FOI request')%> '<%=request_link(@info_request)%>'<% _(' made by ')%><%=user_link(@info_request.user) %>

      - <%= _('Your response will appear on the Internet, read why and answers to other questions.')% [help_officers_path] %> + <%= _('Your response will appear on the Internet, read why and answers to other questions.', :url => help_officers_path.html_safe) %>

      <%= _('Respond by email')%>

      -- cgit v1.2.3 From 2138c847c228f009da01c990360600b4ec9e184d Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 19:08:10 +0000 Subject: Replace %s with {{}} in translation for ""This request has been marked for review by the site administrators..." --- app/views/request/_sidebar.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index 0d862ad41..6f1349715 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -25,7 +25,7 @@

      <%= _('This request is hidden, so that only you the requester can see it. Please contact us if you are not sure why.', :url => help_requesting_path.html_safe) %>

      <% else %> -

      <%= raw(_('This request has been marked for review by the site administrators, who have not hidden it at this time. If you believe it should be hidden, please contact us.') % [help_requesting_path]) %>

      +

      <%= _('This request has been marked for review by the site administrators, who have not hidden it at this time. If you believe it should be hidden, please contact us.', :url => help_requesting_path.html_safe) %>

      <% end %> <% else %>

      <%= _('Requests for personal information and vexatious requests are not considered valid for FOI purposes (read more).') %>

      -- cgit v1.2.3 From 9ddb98511faf8b5d29223e5f0768818ac6438452 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 23 Jan 2013 19:33:59 +0000 Subject: Replacing %s with {{}} in translation of "Enter your response below..." --- app/views/request/upload_response.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/upload_response.rhtml b/app/views/request/upload_response.rhtml index a0611ff96..e8b9ec150 100644 --- a/app/views/request/upload_response.rhtml +++ b/app/views/request/upload_response.rhtml @@ -28,7 +28,7 @@

      <%= _('Respond using the web')%>

      <%= _('Enter your response below. You may attach one file (use email, or - contact us if you need more).')% [help_contact_path] %>

      + contact us if you need more).', :url => help_contact_path.html_safe) %>

      <% form_tag '', :id => 'upload_response_form', :multipart => true do %>

      -- cgit v1.2.3 From 903a90943e82fc7aee767ea7bca42e7e20f92fd7 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 13:12:44 +0000 Subject: Replace %s with {{}} in 'Keep it focused' translation. --- app/views/request/new.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index 4b23211da..857cb9f45 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -98,7 +98,7 @@

      • <%= _('Write your request in simple, precise language.') %>
      • <%= _('Ask for specific documents or information, this site is not suitable for general enquiries.') %>
      • -
      • <%= raw(_('Keep it focused, you\'ll be more likely to get what you want (why?).') % [help_requesting_path + '#focused']) %>
      • +
      • <%= _('Keep it focused, you\'ll be more likely to get what you want (why?).', :url => (help_requesting_path + '#focused').html_safe) %>
      -- cgit v1.2.3 From d19982f53deca9e5c4ce6726ff55f2534fe09267 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 14:09:26 +0000 Subject: Replace %s with {{}} in translation "This response has been hidden." --- app/views/request/_hidden_correspondence.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/_hidden_correspondence.rhtml b/app/views/request/_hidden_correspondence.rhtml index 0873b312f..23e383ffd 100644 --- a/app/views/request/_hidden_correspondence.rhtml +++ b/app/views/request/_hidden_correspondence.rhtml @@ -7,8 +7,8 @@ %>

      - <%= raw(_('This response has been hidden. See annotations to find out why. - If you are the requester, then you may sign in to view the response.') % [signin_url(:r => request.request_uri)]) %> + <%= _('This response has been hidden. See annotations to find out why. + If you are the requester, then you may sign in to view the response.', :url => signin_url(:r => request.request_uri).html_safe) %>

      <% elsif [ 'sent', 'followup_sent', 'resent', 'followup_resent' ].include?(info_request_event.event_type) %> -- cgit v1.2.3 From 5ffe4c63c5e213a53baa2408855ecf5612e332ba Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 14:14:07 +0000 Subject: Replace %s with {{}} in translation "This outgoing message has been hidden" --- app/views/request/_hidden_correspondence.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/_hidden_correspondence.rhtml b/app/views/request/_hidden_correspondence.rhtml index 23e383ffd..2da12bdc7 100644 --- a/app/views/request/_hidden_correspondence.rhtml +++ b/app/views/request/_hidden_correspondence.rhtml @@ -14,8 +14,8 @@ <% elsif [ 'sent', 'followup_sent', 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>

      - <%= raw(_('This outgoing message has been hidden. See annotations to - find out why. If you are the requester, then you may sign in to view the response.') % [signin_url(:r => request.request_uri)]) %> + <%= _('This outgoing message has been hidden. See annotations to + find out why. If you are the requester, then you may sign in to view the response.', :url => signin_url(:r => request.request_uri).html_safe) %>

      <% elsif info_request_event.event_type == 'comment' %> -- cgit v1.2.3 From 8e9374145b7e153539285a4cd82dffa55bcddc9e Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 14:17:00 +0000 Subject: Replace %s with {{}} in translation "When you're done..." --- app/views/request/new_please_describe.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/new_please_describe.rhtml b/app/views/request/new_please_describe.rhtml index ff27405b8..808fbb206 100644 --- a/app/views/request/new_please_describe.rhtml +++ b/app/views/request/new_please_describe.rhtml @@ -13,7 +13,7 @@ if they are successful yet or not.') %>

    - <%= raw(_('When you\'re done, come back here, reload this page and file your new request.') % [request.request_uri]) %> + <%= _('When you\'re done, come back here, reload this page and file your new request.', :url => request.request_uri.html_safe) %>

    -- cgit v1.2.3 From cc030d0925101e3c83159f1c308ddc553d69d472 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 14:20:02 +0000 Subject: Replace %s with {{}} in translation "This comment has been hidden" --- app/views/request/_hidden_correspondence.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/_hidden_correspondence.rhtml b/app/views/request/_hidden_correspondence.rhtml index 2da12bdc7..a08c1badf 100644 --- a/app/views/request/_hidden_correspondence.rhtml +++ b/app/views/request/_hidden_correspondence.rhtml @@ -20,8 +20,8 @@ <% elsif info_request_event.event_type == 'comment' %>

    -

    <%= raw(_('This comment has been hidden. See annotations to - find out why. If you are the requester, then you may sign in to view the response.') % [signin_url(:r => request.request_uri)]) %> +

    <%= _('This comment has been hidden. See annotations to + find out why. If you are the requester, then you may sign in to view the response.', :url => signin_url(:r => request.request_uri).html_safe) %>

    <% end %> -- cgit v1.2.3 From 5a99c8650e9939da0b0b270cf1607e8a4be004cb Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 14:25:44 +0000 Subject: Replacing %s with {{}} in translations "From the request page, try replying to a particular message.." --- app/views/request/followup_bad.rhtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/request/followup_bad.rhtml b/app/views/request/followup_bad.rhtml index c892263e6..b712674d8 100644 --- a/app/views/request/followup_bad.rhtml +++ b/app/views/request/followup_bad.rhtml @@ -9,16 +9,16 @@ <% if @reason == 'not_apply' %>

    <%= _('Freedom of Information law no longer applies to') %> <%=h @info_request.public_body.name %>. - <%= raw(_('From the request page, try replying to a particular message, rather than sending + <%= _('From the request page, try replying to a particular message, rather than sending a general followup. If you need to make a general followup, and know - an email which will go to the right place, please send it to us.') % [help_contact_path]) %> + an email which will go to the right place, please send it to us.', :url => help_contact_path.html_safe) %>

    <% elsif @reason == 'defunct' %> -

    <%=h @info_request.public_body.name %> <%= raw(_('no longer exists. If you are trying to make +

    <%=h @info_request.public_body.name %> <%= _('no longer exists. If you are trying to make From the request page, try replying to a particular message, rather than sending a general followup. If you need to make a general followup, and know - an email which will go to the right place, please send it to us.') % [help_contact_path]) %> + an email which will go to the right place, please send it to us.', :url => help_contact_path.html_safe) %>

    <% elsif @reason == 'bad_contact' %>

    <%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.',:law_used_full=>h(@info_request.law_used_full),:public_body_name=>h(@info_request.public_body.name)) %> <%= raw(_('You may be able to find -- cgit v1.2.3 From 67ffc7a8724ea985e10246e5b7b2b87d5333a163 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 14:37:21 +0000 Subject: Change %s to {{}} in translation "If you are the requester,..." --- app/views/request/hidden.rhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/request/hidden.rhtml b/app/views/request/hidden.rhtml index 2d038a663..4e0e705c3 100644 --- a/app/views/request/hidden.rhtml +++ b/app/views/request/hidden.rhtml @@ -12,7 +12,7 @@ various reasons why we might have done this, sorry we can\'t be more specific he

    <% if @info_request.prominence == 'requester_only' %>

    - <%= raw(_('If you are the requester, then you may sign in to view the request.') % [signin_url(:r => request.request_uri)]) %> + <%= _('If you are the requester, then you may sign in to view the request.', :url => signin_url(:r => request.request_uri).html_safe) %>

    <% end %> -- cgit v1.2.3 From 30df1366d783ea320f5f76d268101e63b549a0ac Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 15:00:43 +0000 Subject: Replace %s with {{}} in translation "We do not have a working.." --- app/views/request/followup_bad.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/followup_bad.rhtml b/app/views/request/followup_bad.rhtml index b712674d8..ea2400c5d 100644 --- a/app/views/request/followup_bad.rhtml +++ b/app/views/request/followup_bad.rhtml @@ -21,9 +21,9 @@ an email which will go to the right place, please send it to us.', :url => help_contact_path.html_safe) %>

    <% elsif @reason == 'bad_contact' %> -

    <%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.',:law_used_full=>h(@info_request.law_used_full),:public_body_name=>h(@info_request.public_body.name)) %> <%= raw(_('You may be able to find +

    <%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.',:law_used_full=>h(@info_request.law_used_full),:public_body_name=>h(@info_request.public_body.name)) %> <%= _('You may be able to find one on their website, or by phoning them up and asking. If you manage - to find one, then please send it to us.') % [help_contact_path]) %> + to find one, then please send it to us.', :url => help_contact_path.html_safe) %>

    <% elsif @reason == 'external' %>

    <%= _("Followups cannot be sent for this request, as it was made externally, and published here by {{public_body_name}} on the requester's behalf.", :public_body_name => h(@info_request.public_body.name)) %> -- cgit v1.2.3 From b84331ff0502e3fb3fdc8bcecbd6746d50df799b Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 15:14:18 +0000 Subject: Replace %s with {{}} in translation "If you are thinking of using a pseudonym..." --- app/views/request/new.rhtml | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'app') diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index 857cb9f45..6323acabe 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -7,26 +7,26 @@ $("#typeahead_response").load("<%=search_ahead_url%>?q="+encodeURI(this.value), function() { // When following links in typeahead results, open new tab/window $("#typeahead_response a").attr("target","_blank"); - + // Update the public body site search link $("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+ "+site:<%= @info_request.public_body.calculated_home_page %>"); }); })); - + }); <% @title = _("Make an {{law_used_short}} request to '{{public_body_name}}'",:law_used_short=>h(@info_request.law_used_short),:public_body_name=>h(@info_request.public_body.name)) %>

    <%= _('2. Ask for Information') %>

    - + <% if @existing_request %>
    • <%= _('{{existing_request_user}} already created the same request on {{date}}. You can either view the existing request, - or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_url(@existing_request)) %> + or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_url(@existing_request)) %>
    <% end %> @@ -37,7 +37,7 @@
    - + <%=h(@info_request.public_body.name)%>
    <% if @info_request.public_body.info_requests.size > 0 %> @@ -48,7 +48,7 @@
    <% if @info_request.public_body.has_notes? %> -
    +

    <%= _('Special note for this authority!') %>

    <%= @info_request.public_body.notes_as_html %>

    @@ -57,9 +57,9 @@ <% if @info_request.public_body.eir_only? %>

    <%= _('Please ask for environmental information only') %>

    -

    <%= _('The Freedom of Information Act does not apply to') %> <%=h(@info_request.public_body.name)%>. +

    <%= _('The Freedom of Information Act does not apply to') %> <%=h(@info_request.public_body.name)%>. <%= _('However, you have the right to request environmental - information under a different law') %> (explanation). + information under a different law') %> (explanation). <%= _('This covers a very wide spectrum of information about the state of the natural and built environment, such as:') %> @@ -79,21 +79,21 @@ <% end %>

    -
    +

    - + <%= f.text_field :title, :size => 50, :id =>"typeahead_search" %>

    - (<%= _("a one line summary of the information you are requesting, \n\t\t\te.g.") %> + (<%= _("a one line summary of the information you are requesting, \n\t\t\te.g.") %> <%= render :partial => "summary_suggestion" %>)
    - +
    - +
    • <%= _('Write your request in simple, precise language.') %>
    • @@ -102,35 +102,35 @@
    -
    +
    <% fields_for :outgoing_message do |o| %>

    - + <%= o.text_area :body, :rows => 20, :cols => 60 %>

    <% end %> - + <% if !@user %>

    - <%= raw(_('Everything that you enter on this page, including your name, + <%= raw(_('Everything that you enter on this page, including your name, will be displayed publicly on - this website forever (why?).') % [help_privacy_path+"#public_request"]) %> - <%= raw(_('If you are thinking of using a pseudonym, - please read this first.') % [help_privacy_path+"#real_name"]) %> + this website forever (why?).') % [help_privacy_path+"#public_request"]) %> + <%= _('If you are thinking of using a pseudonym, + please read this first.', :url => (help_privacy_path+"#real_name").html_safe) %>

    <% else %>

    - <%= raw(_('Everything that you enter on this page + <%= raw(_('Everything that you enter on this page will be displayed publicly on - this website forever (why?).') % [help_privacy_path+"#public_request"]) %> + this website forever (why?).') % [help_privacy_path+"#public_request"]) %>

    <% end %> - +

    <%= _(" Can I request information about myself?\n" + - "\t\t\tNo! (Click here for details)", :url => (help_requesting_path+"#data_protection").html_safe) %> + "\t\t\tNo! (Click here for details)", :url => (help_requesting_path+"#data_protection").html_safe) %>

    - +
    <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> <%= hidden_field_tag(:submitted_new_request, 1 ) %> @@ -140,14 +140,14 @@ <% if !@info_request.tag_string.empty? %>

    - <%= f.hidden_field(:tag_string) %> Tags: <%=h @info_request.tag_string %>

    <% end %> - +
    <% end %> -- cgit v1.2.3 From bc78d89e0db7e2a7049b06d20831f485786b699a Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 28 Jan 2013 15:23:05 +0000 Subject: Replace %s with {{}} in "Everything that you enter on this page..." --- app/views/request/new.rhtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index 6323acabe..9a2182f8b 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -112,17 +112,17 @@ <% if !@user %>

    - <%= raw(_('Everything that you enter on this page, including your name, + <%= _('Everything that you enter on this page, including your name, will be displayed publicly on - this website forever (why?).') % [help_privacy_path+"#public_request"]) %> + this website forever (why?).', :url => (help_privacy_path+"#public_request").html_safe) %> <%= _('If you are thinking of using a pseudonym, please read this first.', :url => (help_privacy_path+"#real_name").html_safe) %>

    <% else %>

    - <%= raw(_('Everything that you enter on this page + <%= _('Everything that you enter on this page will be displayed publicly on - this website forever (why?).') % [help_privacy_path+"#public_request"]) %> + this website forever (why?).', :url => (help_privacy_path+"#public_request").html_safe) %>

    <% end %> -- cgit v1.2.3 From 77ecc648e9d68927c2ddc8c5a30906d5946db5fc Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 21 Jan 2013 14:00:20 +1100 Subject: In translation strings replace %{} with {{}} formatting --- app/models/outgoing_message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 441813e5f..3cb0ebf49 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -152,7 +152,7 @@ class OutgoingMessage < ActiveRecord::Base end end if self.body =~ /#{get_signoff}\s*\Z/m - errors.add(:body, _("Please sign at the bottom with your name, or alter the \"%{signoff}\" signature" % { :signoff => get_signoff })) + errors.add(:body, _("Please sign at the bottom with your name, or alter the \"{{signoff}}\" signature", :signoff => get_signoff)) end if !MySociety::Validate.uses_mixed_capitals(self.body) errors.add(:body, _('Please write your message using a mixture of capital and lower case letters. This makes it easier for others to read.')) -- cgit v1.2.3 From 781502005b943bb2afb9adcacb01e07cb16ccdb9 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 21 Jan 2013 14:05:53 +1100 Subject: In translation strings replace %s with {{}} formatting Conflicts: locale/eu/app.po locale/sq/app.po --- app/views/request/hidden.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/hidden.rhtml b/app/views/request/hidden.rhtml index 4e0e705c3..4190fb47c 100644 --- a/app/views/request/hidden.rhtml +++ b/app/views/request/hidden.rhtml @@ -6,9 +6,9 @@ <%=@details%>

    -

    <%= raw(_('The request you have tried to view has been removed. There are +

    <%= _('The request you have tried to view has been removed. There are various reasons why we might have done this, sorry we can\'t be more specific here. Please contact us if you have any questions.') % [help_contact_path]) %> + href="{{url}}">contact us if you have any questions.', :url => help_contact_path.html_safe) %>

    <% if @info_request.prominence == 'requester_only' %>

    -- cgit v1.2.3 From 49d70bdc7f8ea1e20060203b7ac53f9b63cbd369 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 21 Jan 2013 14:08:45 +1100 Subject: In translation strings replace %s with {{}} formatting --- app/views/request/select_authority.rhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml index 652c24da9..16fce1a39 100644 --- a/app/views/request/select_authority.rhtml +++ b/app/views/request/select_authority.rhtml @@ -33,9 +33,9 @@ <% form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %>

    - <%= raw(_('First, type in the name of the UK public authority you\'d + <%= _('First, type in the name of the UK public authority you\'d like information from. By law, they have to respond - (why?).') % [help_about_url, "whybother_them"]) %> + (why?).', :url => (help_about_url + "#whybother_them").html_safe) %>

    <%= text_field_tag 'query', params[:query], { :size => 30 } %> <%= hidden_field_tag 'bodies', 1 %> -- cgit v1.2.3 From 768ea68463b5fc063f1516e12537195dc2a975cd Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 16 Apr 2013 14:16:01 +0100 Subject: Update outgoing message signoff translation --- app/models/outgoing_message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index c75894e6a..248125808 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -268,7 +268,7 @@ class OutgoingMessage < ActiveRecord::Base end end if self.body =~ /#{get_signoff}\s*\Z/m - errors.add(:body, _("Please sign at the bottom with your name, or alter the \"%{signoff}\" signature" % { :signoff => get_signoff })) + errors.add(:body, _("Please sign at the bottom with your name, or alter the \"{{signoff}}\" signature", :signoff => get_signoff)) end if !MySociety::Validate.uses_mixed_capitals(self.body) errors.add(:body, _('Please write your message using a mixture of capital and lower case letters. This makes it easier for others to read.')) -- cgit v1.2.3 From 0287ca92fb6bd39bade5bfb44f52ac6e006139d0 Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Fri, 12 Apr 2013 18:48:52 +0100 Subject: Fix the deadlock on dealing with incoming email Fixes #336 There was an occasional deadlock when two emails for the same request came in near-simultaneously; two processes would be started via script/mailin, each to deal with one email which are both updating the same InfoRequest. The error would look like: 2013-04-07 09:19:03 BST [13398]: [2-1] DETAIL: Process 13398 waits for ShareLock on transaction 36193647; blocked by process 13397. Process 13397 waits for ExclusiveLock on tuple (390,35) of relation 32918788 of database 32918687; blocked by process 13398. Process 13398: UPDATE "info_requests" SET "updated_at" = '2013-04-07 08:19:02.139515', "awaiting_description" = 't' WHERE "id" = 156200 Process 13397: UPDATE "info_requests" SET "updated_at" = '2013-04-07 08:19:02.143624', "awaiting_description" = 't' WHERE "id" = 156200 This arose from the following section of code: ActiveRecord::Base.transaction do raw_email = RawEmail.new incoming_message.raw_email = raw_email incoming_message.info_request = self incoming_message.save! raw_email.data = raw_email_data raw_email.save! self.awaiting_description = true params = { :incoming_message_id => incoming_message.id } if !rejected_reason.empty? params[:rejected_reason] = rejected_reason.to_str end self.log_event("response", params) self.save! end Matthew Somerville explained what was happening here in the issue report; to repeat his explanation from the bug report, both processes enter the transaction block and acquire a ShareLock on self with: incoming_message.info_request = self incoming_message.save! However, in order to update the self.awaiting_description field of the InfoRequest, with: self.awaiting_description = true [...] self.save! ... the ShareLock needs to be upgraded to an ExclusiveLock, but both will wait until the other's ShareLock is released, which would only happen at the end of the transaction. We can avoid this deadlock by using SELECT ... FOR UPDATE for the row in info_requests. In Rails 3.2.0 there is ActiveRecord support for this (via with_lock and lock! on a model instance) but so as not to require upgrading rails, I'm just using raw SQL. --- app/models/info_request.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 237364f56..eaed25a61 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -474,6 +474,17 @@ public incoming_message = IncomingMessage.new ActiveRecord::Base.transaction do + + # To avoid a deadlock when simultaneously dealing with two + # incoming emails that refer to the same InfoRequest, we + # lock the row for update. In Rails 3.2.0 and later this + # can be done with info_request.with_lock or + # info_request.lock!, but upgrading to that version of + # Rails creates many other problems at the moment. In the + # interim, just use raw SQL to do the SELECT ... FOR UPDATE + raw_sql = "SELECT * FROM info_requests WHERE id = #{self.id} LIMIT 1 FOR UPDATE" + ActiveRecord::Base.connection.execute(raw_sql) + raw_email = RawEmail.new incoming_message.raw_email = raw_email incoming_message.info_request = self -- cgit v1.2.3 From 0010d44962185ed42fd616d19f864cb20a6630f5 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 23 Apr 2013 13:43:20 +0100 Subject: Restore call to N_ --- app/models/profile_photo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb index 47ce221b2..f6aec6338 100644 --- a/app/models/profile_photo.rb +++ b/app/models/profile_photo.rb @@ -101,7 +101,7 @@ class ProfilePhoto < ActiveRecord::Base end if !self.draft && (self.image.columns != WIDTH || self.image.rows != HEIGHT) - errors.add(:data, _("Failed to convert image to the correct size: at {{cols}}x{{rows}}, need {{width}}x{{height}}", :cols => self.image.columns, :rows => self.image.rows, :width => WIDTH, :height => HEIGHT)) + errors.add(:data, N_("Failed to convert image to the correct size: at {{cols}}x{{rows}}, need {{width}}x{{height}}", :cols => self.image.columns, :rows => self.image.rows, :width => WIDTH, :height => HEIGHT)) end if self.draft && self.user_id -- cgit v1.2.3