Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add i18n and french translations for contact form

  • Loading branch information...
commit 746b866fbc1c155a1493673981baf08a31e028a1 1 parent d243d5f
@reidab authored
View
2  app/controllers/people_controller.rb
@@ -84,7 +84,7 @@ def submit_contact_form
@person = Person.find(params[:id])
@form = ContactForm.new(params[:contact_form])
if @form.valid? && PersonMailer.message_from_user(@person, current_user, @form.message).deliver
- flash[:notice] = "Message has been sent to #{@person.name}."
+ flash[:notice] = t('people.contact.message_has_been_sent', :name => @person.name)
redirect_to(:action => 'show') and return
else
render 'contact'
View
2  app/mailers/person_mailer.rb
@@ -6,7 +6,7 @@ def message_from_user(to_person, from_user, message)
@from_user = from_user
@message = message
- subject = "#{SETTINGS['organization']['name']} Message From #{from_user.name || from_user.email}"
+ subject = t('people.contact.message_subject', :site_name => SETTINGS['organization']['name'], :from => (from_user.name || from_user.email))
mail(:to => to_person.email, :reply_to => from_user.email, :subject => subject)
end
View
8 app/views/people/contact.html.haml
@@ -7,10 +7,10 @@
= semantic_form_for(@form, :url => contact_person_path(@person, @form)) do |f|
= display_errors_for @form
= f.inputs do
- %label From:
+ %label= t('people.contact.field.from.label')
= current_user.name ? "#{current_user.name} <#{current_user.email}>" : current_user.email
- = f.input :message, :as => :text, :label => "Message"
+ = f.input :message, :as => :text
= f.buttons do
- = f.commit_button "Send Message"
+ = f.commit_button t('people.contact.button.send_message')
- = link_to 'Back', person_path(@person)
+ = link_to t('button.back'), person_path(@person)
View
2  app/views/people/show.html.haml
@@ -15,7 +15,7 @@
.bio= simple_format @person.bio
.links
- if user_signed_in?
- = link_to('Contact', contact_person_path(@person), :class => 'url')
+ = link_to(t('people.contact.button.send_message'), contact_person_path(@person), :class => 'url')
- if @person.url.present?
= link_to( normalize_url(@person.url), normalize_url(@person.url), :class => 'url') if @person.url.present?
View
4 app/views/person_mailer/message_from_user.text.erb
@@ -1,6 +1,6 @@
-<%= @from_user.name ? "#{@from_user.name} (#{@from_user.email})" : @from_user.email %> has sent you a message.
+<%= t('people.contact.has_sent_you_a_message', :from => (@from_user.name ? "#{@from_user.name} (#{@from_user.email})" : @from_user.email)) %>
<%= @message %>
---------------------------------
-This message was sent using the <%= SETTINGS['organization']['url'] %> contact mailer.
+<%= t('people.contact.message_footer', :site_name => SETTINGS['organization']['name'], :site_url => SETTINGS['organization']['url']) %>
View
11 config/locales/en.yml
@@ -15,6 +15,7 @@ en:
logo_url: "Logo URL"
mailing_list: "Mailing list"
meeting_info: "Meeting information"
+ message: "Message"
name: "Name"
photo_content_type: "Photo content-type"
photo_import_url: "Photo import URL"
@@ -299,6 +300,16 @@ en:
provider_not_logged_in: but you aren't logged in using your %{provider} account.
show:
are_you_this_person: Are you %{name}?
+ contact:
+ message_has_been_sent: "Message has been sent to %{name}."
+ message_subject: "%{site_name}: Message from %{from}"
+ message_footer: "This message was sent from %{site_name} at %{site_url}."
+ has_sent_you_a_message: "%{from} has sent you a message"
+ field:
+ from:
+ label: "From"
+ button:
+ send_message: "Send message"
index:
title:
one: "%{tag} person"
View
13 config/locales/fr.yml
@@ -13,6 +13,8 @@ fr:
logo_url: "URL du logo"
mailing_list: "Mailing list"
meeting_info: "Infos réunion"
+ # TODO Review translation
+ message: "Message"
name: "Nom"
photo_content_type: "Format de la photo"
photo_import_url: "URL de la photo à importer"
@@ -282,6 +284,17 @@ fr:
imported_from: Cette personne a été importée de %{provider}
sign_in_to_provider: Connectez-vous sur %{provider} pour continuer
provider_not_logged_in: mais vous n'êtes pas connecté avec votre compte %{provider}.
+ # TODO Review translation
+ contact:
+ message_has_been_sent: "Le message a été envoyé à %{name}."
+ message_subject: "%{site_name}: Un message de %{from}"
+ message_footer: "Ce message a été envoyé à partir %{site_name} au %{site_url}"
+ has_sent_you_a_message: "%{from} vous a envoyé un message"
+ field:
+ from:
+ label: "De"
+ button:
+ send_message: "Envoyer le message"
field:
mentoring:
title: "Mentorat" # people#form
View
2  spec/acceptance/people_spec.rb
@@ -365,7 +365,7 @@ def setup_people
visit contact_person_path(@first_person)
current_path.should == new_user_session_path
- page.should have_content "sign in"
+ page.should have_content I18n.t('sign_in')
end
scenario "should be accessible by users with or without person" do
Please sign in to comment.
Something went wrong with that request. Please try again.