Skip to content

Commit

Permalink
Merge RefugeRestrooms#421: Make remaining pages translation-ready
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit ad63129
Merge: 2bc775f 75b4ba0
Author: Mikena Wood <[email protected]>
Date:   Sun Jan 21 16:37:48 2018 -0800

    Merge branch 'develop' into new-translation-ready

commit 2bc775f
Author: DeeDeeG <[email protected]>
Date:   Fri Jan 19 14:14:48 2018 -0500

    contact submitted page: Make translation-ready

    * Add translation strings in `config/locales/en/contacts.en.yml`

    * Update `views/contacts/create.html.haml` to use translation strings

    * Update `contacts_controller.rb` to use translation strings

commit ba3fefa
Merge: 6483ea2 8f8d7ef
Author: DeeDeeG <[email protected]>
Date:   Wed Jan 17 13:35:40 2018 -0500

    Merge branch 'new-translation-ready' into develop

    * Fixes merge conflict with `landing.en.yml`

    * Moves English translations to the en sub-folder to match upstream.

commit 8f8d7ef
Author: DeeDeeG <[email protected]>
Date:   Wed Jan 17 13:13:02 2018 -0500

    contact: Change button label ['Submit' -> 'Send']

    * Changes the button label back from 'Submit message'
      to 'Send message'.

      (was changed in a previous commit accidentally.)

commit 7847997
Author: DeeDeeG <[email protected]>
Date:   Wed Jan 17 11:51:11 2018 -0500

    text: Make translation-ready

    * Fix translation string key names in `text.html.haml`

    * Add `centered-text` class to paragraphs to make them centered.

    * Replace explicit "style=" per-element with CSS classes for other
      instances of text-centering on the page. More readable/maintainable?

commit aede79b
Author: DeeDeeG <[email protected]>
Date:   Tue Jan 16 23:05:56 2018 -0500

    footer: Reorganize the aria-label translations

    * Moves aria-label translation strings of the footer
      into a separate sub-category in `locales/footer.en.yml`,
      allowing the individual translation key names to be much shorter.
      'refuge-restrooms-on-twitter-aria-label'
      => 'aria-labels.refuge-restrooms-on-twitter"

    * Shorten the key names further from e.g.:
      'refuge-restrooms-on-twitter' => 'twitter'

    * Updates `_footer.html.haml` to use the new key names.

      Thanks again @tkwidmer for the review.

commit 70c7c9c
Author: DeeDeeG <[email protected]>
Date:   Tue Jan 16 22:45:18 2018 -0500

    contact: Simplify code for h1 header

    Takes better advantage of interpolation features.

    Thanks @tkwidmer for pointing this out.

commit 7c87ccf
Author: DeeDeeG <[email protected]>
Date:   Mon Jan 15 18:57:19 2018 -0500

    search buttons: Make translation-ready

    * Add translation strings in `config/locales/search.en.yml`

    * Update `layouts/_search.html.haml` to use translation strings

commit 5337341
Author: DeeDeeG <[email protected]>
Date:   Mon Jan 15 18:12:53 2018 -0500

    footer: Make translation-ready

    * Add translation strings in `config/locales/footer.en.yml`

    * Update `_footer.html.haml` to use translation strings

commit 9abc8fb
Author: DeeDeeG <[email protected]>
Date:   Mon Jan 15 16:37:51 2018 -0500

    navigation: Make translation-ready

    * Add translation strings in `config/locales/navigation.en.yml`

    * update `layouts/_navigation.html.haml` to use translation strings

commit 5a37427
Author: DeeDeeG <[email protected]>
Date:   Mon Jan 15 16:07:22 2018 -0500

    restroom search & entries: Make translation-ready

    * Add translation strings in `config/locales/restrooms.en.yml`

    * Update `index.html.haml` to evaluate translation strings

    * Update `show.html.haml` to evaluate translation strings

commit 1c6ef8f
Author: DeeDeeG <[email protected]>
Date:   Mon Jan 15 14:54:00 2018 -0500

    Contact page: Fix h1 heading

    h1 heading now properly renders with the Restroom listing's name,
    when requesting contact from an existing restroom page.

    (Translating this heading with one translation string won't work,
    because dynamic Ruby content won't render properly
    in a translation string.
    In this case, the dynamic content is the name of the Restroom entry.)

commit dd0a1f1
Author: DeeDeeG <[email protected]>
Date:   Sat Jan 13 16:44:07 2018 -0500

    Contact page: Make translation-ready

    * Updates `app/views/contacts/new.html.haml`
      to evaluate translation strings

    * Add translation strings in `config/locales/contacts.en.yml`

    * Also updates `config/locales/simple_form.en.yml`
      to translate input forms on Contact page

    * Difficult to make "Thank you for contacting us" page
      translation-ready, so ignored that for now.

commit ce2cb91
Author: DeeDeeG <[email protected]>
Date:   Thu Jan 11 16:38:05 2018 -0500

    splash page: Make translation-ready

    * Add translation strings in `config/locales`

    * Update `index.html.haml` to evaluate translation strings

commit be9e684
Author: DeeDeeG <[email protected]>
Date:   Thu Jan 11 16:14:59 2018 -0500

    config/locales: Delete unused "landing" file

    This landing text insn't used anymore (was on splash page),
    so we don't need to translate it.
  • Loading branch information
DeeDeeG committed Oct 15, 2018
1 parent 30c207d commit 2821dc5
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 41 deletions.
4 changes: 2 additions & 2 deletions app/controllers/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def create
@contact.request = request
if @contact.deliver
flash.now[:error] = nil
flash.now[:notice] = 'Thank you for your message!'
flash.now[:notice] = I18n.t('contacts.submitted.thank-you-exclamation')
else
flash.now[:error] = 'Cannot send message.'
flash.now[:error] = I18n.t('contacts.submitted.cannot-send')
render :new
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/contacts/create.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.container
%h1 Thank you for your message.
%p We'll get back to you soon.
%h1= t('contacts.submitted.thank-you-period')
%p.centered-text= t('contacts.submitted.we-will-get-back-to-you')
8 changes: 4 additions & 4 deletions app/views/contacts/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- if @contact.restroom_name.present?
%h1 Request Edit for #{@contact.restroom_name} Restroom
%h1= t('.request-edit-for-restroom', restroom_name: @contact.restroom_name)
- else
%h1 Contact
%h1= t('.contact-title')
= simple_form_for @contact, html: {class: 'form-vertical headroom'} do |f|
%p
= f.input :name, :required => true
Expand All @@ -10,6 +10,6 @@
.hidden
= f.hidden_field :restroom_id, :required => false
= f.hidden_field :restroom_name, :required => false
= f.hidden_field :nickname, :hint => 'Leave this field blank!'
= f.hidden_field :nickname, :hint => t('.leave-this-field-blank')
.form-actions
= f.button :submit, 'Send message', :class=> "linkbutton"
= f.button :submit, :class=> "linkbutton"
20 changes: 10 additions & 10 deletions app/views/layouts/_footer.html.haml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
%footer
.footer
%a.iconLink{:href => "https://github.com/RefugeRestrooms/refugerestrooms", :aria => { :label => "Refuge Restrooms on github"}}
%a.iconLink{:href => "https://github.com/RefugeRestrooms/refugerestrooms", :aria => { :label => t('.aria-labels.github')}}
%i.icon.fa.fa-github-square.fa-3x
%a.iconLink{:href => "https://twitter.com/refugerestrooms", :aria => { :label => "Refuge Restrooms on twitter"}}
%a.iconLink{:href => "https://twitter.com/refugerestrooms", :aria => { :label => t('.aria-labels.twitter')}}
%i.icon.fa.fa-twitter-square.fa-3x
%a.iconLink{:href => "https://www.facebook.com/refugerestrooms", :aria => { :label => "Refuge Restrooms on facebook"}}
%a.iconLink{:href => "https://www.facebook.com/refugerestrooms", :aria => { :label => t('.aria-labels.facebook')}}
%i.icon.fa.fa-facebook-square.fa-3x
%a.iconLink{:href => "http://blog.refugerestrooms.org/", :aria => { :label => "Refuge Restrooms's blog on tumblr"}}
%a.iconLink{:href => "http://blog.refugerestrooms.org/", :aria => { :label => t('.aria-labels.tumblr')}}
%i.icon.fa.fa-tumblr-square.fa-3x
%a.iconLink{:href => contact_path, :aria => { :label => "Email Refuge Restrooms"}}
%a.iconLink{:href => contact_path, :aria => { :label => t('.aria-labels.email')}}
%i.icon.fa.fa-envelope.fa-3x
%br/
refuge restrooms is open source.
%a{:href => "https://github.com/RefugeRestrooms/refugerestrooms"} code on github.
= t('.refuge-restrooms-is-open-source')
%a{:href => "https://github.com/RefugeRestrooms/refugerestrooms"} #{t('.code-on-github')}
%br/
contribute to the project
%a{:href => "https://patreon.com/refugerestrooms"} on patreon.
= t('.contribute-to-the-project')
%a{:href => "https://patreon.com/refugerestrooms"} #{t('.on-patreon')}
%br/
= "\&copy; copyleft #{Date.today.year} refuge restrooms.".html_safe
= "\&copy; #{t('.copyleft')} #{Date.today.year} #{t('.refuge-restrooms')}".html_safe
14 changes: 7 additions & 7 deletions app/views/layouts/_navigation.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
%a#logo.toiletLogo{:href => "/"}
.navbar-brand Refuge Restrooms
%button.navbar-toggle{"data-target" => "#bs-example-navbar-collapse-1", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.sr-only= t('.toggle-navigation-button-label')
%i.fa.fa-bars.fa-2x
/ Collect the nav links, forms, and other content for toggling
#bs-example-navbar-collapse-1.collapse.navbar-collapse
%ul.nav.navbar-nav.navbar-right
%li= link_to "Submit a New Restroom", new_restroom_path
%li= link_to 'About', page_path('about')
%li= link_to 'Contact', contact_path
%li= link_to t('.submit-a-new-restroom-hyperlink-label'), new_restroom_path
%li= link_to t('.about-hyperlink-label'), page_path('about')
%li= link_to t('.contact-hyperlink-label'), contact_path
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
Resources
= t('.resources-dropdown-button-label')
%b.caret
%ul.dropdown-menu
%li
%li= link_to 'Download Unisex Restroom Signs', page_path('signs')
%li= link_to 'Public API', '/api/docs/'
%li= link_to t('.download-unisex-restroom-signs-hyperlink-label'), page_path('signs')
%li= link_to t('.public-api-hyperlink-label'), '/api/docs/'
/ /.navbar-collapse
4 changes: 2 additions & 2 deletions app/views/layouts/_search.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
.input-group
= text_field_tag :search, params[:search], class: "form-control search-bar", aria: {label: t("search_bar.enter_location")}
.input-group-btn
%button.btn.btn-light-purple.submit-search-button{type: "button", title: "Search", value: "Search", aria: { label: "Search" }}
%button.btn.btn-light-purple.submit-search-button{type: "button", title: t('.search'), value: t('.search'), aria: { label: t('.search') }}
%i.fa.fa-search.fa-2x
%i.fa.fa-refresh.fa-spin.fa-2x
%button.btn.btn-light-purple.current-location-button{type: "button", title: "Search by Current Location", aria: { label: "Search by Current Location" }, value: (splash ? "Search Current Location" : nil ) }
%button.btn.btn-light-purple.current-location-button{type: "button", title: t('.search-by-current-location'), aria: { label: t('.search-by-current-location') }, value: (splash ? t('.search-by-current-location') : nil ) }
%i.fa.fa-location-arrow.fa-2x
%i.fa.fa-refresh.fa-spin.fa-2x
6 changes: 3 additions & 3 deletions app/views/pages/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
.col-xs-12.col-sm-8.col-sm-offset-2
.splash-text-container.centered-text
%h3.headroom
Sometimes life is tough...
= t('.life-is-tough')
%h1.centered-text
Find Refuge
= t('.find-refuge')

.row.more-headroom
.col-xs-12.col-sm-8.col-sm-offset-2
Expand All @@ -14,7 +14,7 @@
.row.more-headroom
.col-xs-12.col-sm-6.col-sm-offset-3
= button_to new_restroom_path, method: :get, class: "btn btn-lg btn-purple splash-add-restroom-btn" do
Add A Restroom
= t('.add-restroom-button-label')
%i.fa.fa-plus-square-o.fa-2x
.row.even-more-headroom
.col-xs-6.col-sm-3.col-sm-offset-3
Expand Down
10 changes: 5 additions & 5 deletions app/views/pages/text.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.text-padding
%h1= t('pages.text_msg.title')
%p= t('pages.text_msg.intro').html_safe
%h2{:style => "text-align: center;"}= t('pages.text_msg.instructions')
%p= t('.tip')
%div{:style => "margin:30px auto;text-align:center;"}
%h1= t('pages.text.title')
%p.centered-text= t('pages.text.intro').html_safe
%h2.centered-text= t('pages.text.instructions')
%p.centered-text= t('.tip')
%div.centered-text{:style => "margin:30px auto"}
%img{:src => "/assets/text-msg-demo.png"}/
2 changes: 1 addition & 1 deletion app/views/restrooms/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
%i.fa.fa-child

.map-toggle-btn.mapToggle.linkbutton.btn-lg.btn-light-purple
Map View
= t('.map-view-button-label')

.restrooms-index-content
.row
Expand Down
4 changes: 2 additions & 2 deletions app/views/restrooms/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
method: 'put' do
%button.btn.btn-lg.btn-success
%i.fa.fa-thumbs-up
Thumbs Up
= t('.thumbs-up-button-label')
= link_to restroom_path(restroom: { downvote: true }),
method: 'put' do
%button.btn.btn-lg.btn-danger
%i.fa.fa-thumbs-down
Thumbs Down
= t('.thumbs-down-button-label')
.row.headroom
.col-xs-12
Expand Down
11 changes: 11 additions & 0 deletions config/locales/en/contacts.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
en:
contacts:
new:
request-edit-for-restroom: 'Request Edit for %{restroom_name} Restroom'
contact-title: 'Contact'
leave-this-field-blank: 'Leave this field blank!'
submitted:
thank-you-period: 'Thank you for your message.'
thank-you-exclamation: 'Thank you for your message!'
cannot-send: 'Cannot send message.'
we-will-get-back-to-you: "We'll get back to you soon."
15 changes: 15 additions & 0 deletions config/locales/en/footer.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
en:
layouts:
footer:
aria-labels:
github: 'Refuge Restrooms on GitHub'
twitter: 'Refuge Restrooms on twitter'
facebook: 'Refuge Restrooms on Facebook'
tumblr: 'Refuge Restrooms blog on tumblr'
email: 'Email Refuge Restrooms'
refuge-restrooms-is-open-source: 'refuge restrooms is open source.'
code-on-github: 'code on github.'
contribute-to-the-project: 'contribute to the project'
on-patreon: 'on patreon.'
copyleft: 'copyleft'
refuge-restrooms: 'refuge restrooms.'
3 changes: 0 additions & 3 deletions config/locales/en/landing.en.yml

This file was deleted.

11 changes: 11 additions & 0 deletions config/locales/en/navigation.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
en:
layouts:
navigation:
toggle-navigation-button-label: 'Toggle navigation'
submit-a-new-restroom-hyperlink-label: 'Submit a New Restroom'
about-hyperlink-label: 'About'
contact-hyperlink-label: 'Contact'

resources-dropdown-button-label: 'Resources'
download-unisex-restroom-signs-hyperlink-label: 'Download Unisex Restroom Signs'
public-api-hyperlink-label: Public API
8 changes: 8 additions & 0 deletions config/locales/en/restrooms.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
en:
restrooms:
index:
map-view-button-label: 'Map View'

show:
thumbs-up-button-label: 'Thumbs Up'
thumbs-down-button-label: 'Thumbs Down'
6 changes: 6 additions & 0 deletions config/locales/en/search.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
en:
layouts:
search:
search: 'Search'
search-by-current-location: 'Search by Current Location'

16 changes: 16 additions & 0 deletions config/locales/en/simple_form.en.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# See this documentation: https://github.com/plataformatec/simple_form#i18n
# And this StackOverflow answer: https://stackoverflow.com/questions/35906089/changing-simple-form-submit-button-i18n-text

en:
simple_form:
"yes": 'Yes'
Expand All @@ -10,6 +13,19 @@ en:
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Please review the problems below:"

labels:
defaults:
name: 'Name'
email: 'Email'
message: 'Message'

helpers:
submit:
contact:
# This is the "Send message" button on the "Contact" page.
create: 'Send message'

# Labels and hints examples
# labels:
# defaults:
Expand Down
6 changes: 6 additions & 0 deletions config/locales/en/splash.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
en:
pages:
index:
life-is-tough: 'Sometimes life is tough...'
find-refuge: 'Find Refuge'
add-restroom-button-label: 'Add A Restroom'

0 comments on commit 2821dc5

Please sign in to comment.