From e9d1cf6eb53476ff92e74d3de2ed84448a62d2d0 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 8 Oct 2015 18:09:11 +1100 Subject: [PATCH] using translate filter instead of root scope function --- .../darkswarm/i18n.translate.js.coffee | 10 ++--- .../javascripts/templates/forgot.html.haml | 8 ++-- .../javascripts/templates/login.html.haml | 10 ++--- .../templates/partials/contact.html.haml | 2 +- .../partials/enterprise_details.html.haml | 2 +- .../templates/partials/follow.html.haml | 2 +- .../templates/partials/hub_details.html.haml | 8 ++-- .../templates/price_percentage.html.haml | 4 +- .../templates/product_modal.html.haml | 2 +- .../templates/registration/about.html.haml | 30 ++++++------- .../templates/registration/contact.html.haml | 16 +++---- .../templates/registration/details.html.haml | 44 +++++++++---------- .../templates/registration/finished.html.haml | 6 +-- .../templates/registration/images.html.haml | 8 ++-- .../registration/images/logo.html.haml | 18 ++++---- .../registration/images/promo.html.haml | 18 ++++---- .../registration/introduction.html.haml | 28 ++++++------ .../registration/limit_reached.html.haml | 8 ++-- .../templates/registration/social.html.haml | 26 +++++------ .../templates/registration/type.html.haml | 16 +++---- .../registration_authentication.html.haml | 8 ++-- .../templates/shop_variant.html.haml | 6 +-- .../javascripts/templates/signup.html.haml | 10 ++--- 23 files changed, 143 insertions(+), 147 deletions(-) diff --git a/app/assets/javascripts/darkswarm/i18n.translate.js.coffee b/app/assets/javascripts/darkswarm/i18n.translate.js.coffee index 15ee584400..c455b6d9e1 100644 --- a/app/assets/javascripts/darkswarm/i18n.translate.js.coffee +++ b/app/assets/javascripts/darkswarm/i18n.translate.js.coffee @@ -1,6 +1,6 @@ # Declares the translation function t. -# You can use t('login') in Javascript. -window.t = (key, options = {}) -> +# You can use translate('login') or t('login') in Javascript. +window.translate = (key, options = {}) -> unless 'I18n' of window console.log 'The I18n object is undefined. Cannot translate text.' return key @@ -9,8 +9,4 @@ window.t = (key, options = {}) -> for name, value of options text = text.split("%{#{name}}").join(value) text - -# Provides the translation function t on all scopes. -# You can write {{t('login')}} in all templates. -window.Darkswarm.run ($rootScope) -> - $rootScope.t = t +window.t = window.translate diff --git a/app/assets/javascripts/templates/forgot.html.haml b/app/assets/javascripts/templates/forgot.html.haml index ebe5c36abd..c1990d778a 100644 --- a/app/assets/javascripts/templates/forgot.html.haml +++ b/app/assets/javascripts/templates/forgot.html.haml @@ -1,5 +1,5 @@ %tab#forgot{"ng-controller" => "ForgotCtrl", - heading: "{{t('forgot_password')}}", + heading: "{{'forgot_password' | t}}", active: "active(path)", select: "select(path)"} @@ -8,7 +8,7 @@ .row .large-12.columns .alert-box.success.radius{"ng-show" => "sent"} - {{t('password_reset_sent')}} + {{'password_reset_sent' | t}} %div{"ng-show" => "!sent"} .alert-box.alert{"ng-show" => "errors != null"} @@ -16,7 +16,7 @@ .row .large-12.columns - %label{for: "email"} {{t('signup_email')}} + %label{for: "email"} {{'signup_email' | t}} %input.title.input-text{name: "email", type: "email", id: "email", @@ -27,4 +27,4 @@ %input.button.primary{name: "commit", tabindex: "3", type: "submit", - value: "{{t('reset_password')}}"} + value: "{{'reset_password' | t}}"} diff --git a/app/assets/javascripts/templates/login.html.haml b/app/assets/javascripts/templates/login.html.haml index f002a393a1..44d2e08ced 100644 --- a/app/assets/javascripts/templates/login.html.haml +++ b/app/assets/javascripts/templates/login.html.haml @@ -1,5 +1,5 @@ %tab#login-content{"ng-controller" => "LoginCtrl", - heading: "{{t('label_login')}}", + heading: "{{'label_login' | t}}", active: "active(path)", select: "select(path)"} %form{"ng-submit" => "submit()"} @@ -9,7 +9,7 @@ {{ errors }} .row .large-12.columns - %label{for: "email"} {{t('email')}} + %label{for: "email"} {{'email' | t}} %input.title.input-text{name: "email", type: "email", id: "email", @@ -17,7 +17,7 @@ "ng-model" => "spree_user.email"} .row .large-12.columns - %label{for: "password"} {{t('password')}} + %label{for: "password"} {{'password' | t}} %input.title.input-text{name: "password", type: "password", id: "password", @@ -31,10 +31,10 @@ id: "remember_me", value: "1", "ng-model" => "spree_user.remember_me"} - %label{for: "remember_me"} {{t('remember_me')}} + %label{for: "remember_me"} {{'remember_me' | t}} .row .large-12.columns %input.button.primary{name: "commit", tabindex: "3", type: "submit", - value: "{{t('label_login')}}"} + value: "{{'label_login' | t}}"} diff --git a/app/assets/javascripts/templates/partials/contact.html.haml b/app/assets/javascripts/templates/partials/contact.html.haml index da8fdaa8ac..bdde30b8bb 100644 --- a/app/assets/javascripts/templates/partials/contact.html.haml +++ b/app/assets/javascripts/templates/partials/contact.html.haml @@ -1,6 +1,6 @@ %div.contact-container{bindonce: true} %div.modal-centered{"bo-if" => "enterprise.email || enterprise.website || enterprise.phone"} - %p.modal-header {{t('contact')}} + %p.modal-header {{'contact' | t}} %p{"bo-if" => "enterprise.phone", "bo-text" => "enterprise.phone"} %p.word-wrap{"ng-if" => "enterprise.email"} diff --git a/app/assets/javascripts/templates/partials/enterprise_details.html.haml b/app/assets/javascripts/templates/partials/enterprise_details.html.haml index 2d896baf3c..fc0a638c8d 100644 --- a/app/assets/javascripts/templates/partials/enterprise_details.html.haml +++ b/app/assets/javascripts/templates/partials/enterprise_details.html.haml @@ -3,7 +3,7 @@ / TODO: Rob add logic for taxons and properties too: / %div{"ng-if" => "enterprise.long_description.length > 0 || enterprise.logo"} %div - %p.modal-header {{t('label_about')}} + %p.modal-header {{'label_about' | t}} / TODO: Rob - add in taxons and properties and property pop-overs -# TODO: Add producer taxons and properties here diff --git a/app/assets/javascripts/templates/partials/follow.html.haml b/app/assets/javascripts/templates/partials/follow.html.haml index c4081cd94f..c04567a357 100644 --- a/app/assets/javascripts/templates/partials/follow.html.haml +++ b/app/assets/javascripts/templates/partials/follow.html.haml @@ -1,5 +1,5 @@ %div.modal-centered{bindonce: true, "bo-if" => "enterprise.twitter || enterprise.facebook || enterprise.linkedin || enterprise.instagram"} - %p.modal-header {{t('follow')}} + %p.modal-header {{'follow' | t}} .follow-icons %span{"bo-if" => "enterprise.twitter"} %a{"bo-href-i" => "http://twitter.com/{{enterprise.twitter}}", target: "_blank"} diff --git a/app/assets/javascripts/templates/partials/hub_details.html.haml b/app/assets/javascripts/templates/partials/hub_details.html.haml index c7282abe80..fa75f72253 100644 --- a/app/assets/javascripts/templates/partials/hub_details.html.haml +++ b/app/assets/javascripts/templates/partials/hub_details.html.haml @@ -2,16 +2,16 @@ .cta-container.small-12.columns .row .small-4.columns - %label{"active-table-hub-link" => "enterprise", change: "{{t('change_shop')}}", shop: "{{t('shop_at')}}"} + %label{"active-table-hub-link" => "enterprise", change: "{{'change_shop' | t}}", shop: "{{'shop_at' | t}}"} .small-8.columns.right %label.right{"bo-if" => "enterprise.pickup || enterprise.delivery"} - {{t('hubs_delivery_options')}}: + {{'hubs_delivery_options' | t}}: %span{"bo-if" => "enterprise.pickup"} %i.ofn-i_038-takeaway - {{t('hubs_pickup')}} + {{'hubs_pickup' | t}} %span{"bo-if" => "enterprise.delivery"} %i.ofn-i_039-delivery - {{t('hubs_delivery')}} + {{'hubs_delivery' | t}} .row .columns.small-12 %a.cta-hub{"bo-href" => "enterprise.path", diff --git a/app/assets/javascripts/templates/price_percentage.html.haml b/app/assets/javascripts/templates/price_percentage.html.haml index bb3ce9d01f..7892ebc0ab 100644 --- a/app/assets/javascripts/templates/price_percentage.html.haml +++ b/app/assets/javascripts/templates/price_percentage.html.haml @@ -1,5 +1,5 @@ .progress - .right {{t('fees')}} + .right {{'fees' | t}} .meter - {{t('item_cost')}} + {{'item_cost' | t}} diff --git a/app/assets/javascripts/templates/product_modal.html.haml b/app/assets/javascripts/templates/product_modal.html.haml index 294e8738eb..e13f6df60d 100644 --- a/app/assets/javascripts/templates/product_modal.html.haml +++ b/app/assets/javascripts/templates/product_modal.html.haml @@ -3,7 +3,7 @@ .columns.small-12.large-6.product-header %h3{"bo-text" => "product.name"} %span - %em {{t('products_from')}} + %em {{'products_from' | t}} %span{"bo-text" => "enterprise.name"} %br diff --git a/app/assets/javascripts/templates/registration/about.html.haml b/app/assets/javascripts/templates/registration/about.html.haml index 230154af78..7a0592799c 100644 --- a/app/assets/javascripts/templates/registration/about.html.haml +++ b/app/assets/javascripts/templates/registration/about.html.haml @@ -3,9 +3,9 @@ .row .small-12.columns %header - %h2 {{t('enterprise_about_headline')}} + %h2 {{'enterprise_about_headline' | t}} %h5 - {{t('enterprise_about_message')}} + {{'enterprise_about_message' | t}} %span{ ng: { class: "{brick: !enterprise.is_primary_producer, turquoise: enterprise.is_primary_producer}" } } {{ enterprise.name }} @@ -14,44 +14,44 @@ .small-12.columns .alert-box.info{ "ofn-inline-alert" => true, ng: { show: "visible" } } %h6 {{t('enterprise_success', {enterprise: enterprise.name})}} - %span {{t('enterprise_registration_exit_message')}} + %span {{'enterprise_registration_exit_message' | t}} %a.close{ ng: { click: "close()" } } × .small-12.large-8.columns .row .small-12.columns .field - %label{ for: 'enterprise_description' } {{t('enterprise_description')}}: - %input.chunky{ id: 'enterprise_description', placeholder: "{{t('enterprise_description_placeholder')}}", ng: { model: 'enterprise.description' } } + %label{ for: 'enterprise_description' } {{'enterprise_description' | t}}: + %input.chunky{ id: 'enterprise_description', placeholder: "{{'enterprise_description_placeholder' | t}}", ng: { model: 'enterprise.description' } } .row .small-12.columns .field - %label{ for: 'enterprise_long_desc' } {{t('enterprise_long_desc')}}: - %textarea.chunky{ id: 'enterprise_long_desc', rows: 6, placeholder: "{{t('enterprise_long_desc_placeholder')}}", ng: { model: 'enterprise.long_description' } } + %label{ for: 'enterprise_long_desc' } {{'enterprise_long_desc' | t}}: + %textarea.chunky{ id: 'enterprise_long_desc', rows: 6, placeholder: "{{'enterprise_long_desc_placeholder' | t}}", ng: { model: 'enterprise.long_description' } } %small {{t('enterprise_long_desc_length', {num: enterprise.long_description.length})}} .small-12.large-4.columns .row .small-12.columns .field - %label{ for: 'enterprise_abn' } {{t('enterprise_abn')}}: - %input.chunky{ id: 'enterprise_abn', placeholder: "{{t('enterprise_abn_placeholder')}}", ng: { model: 'enterprise.abn' } } + %label{ for: 'enterprise_abn' } {{'enterprise_abn' | t}}: + %input.chunky{ id: 'enterprise_abn', placeholder: "{{'enterprise_abn_placeholder' | t}}", ng: { model: 'enterprise.abn' } } .row .small-12.columns .field - %label{ for: 'enterprise_acn' } {{t('enterprise_acn')}}: - %input.chunky{ id: 'enterprise_acn', placeholder: "{{t('enterprise_acn_placeholder')}}", ng: { model: 'enterprise.acn' } } + %label{ for: 'enterprise_acn' } {{'enterprise_acn' | t}}: + %input.chunky{ id: 'enterprise_acn', placeholder: "{{'enterprise_acn_placeholder' | t}}", ng: { model: 'enterprise.acn' } } .row .small-12.columns .field %label{ for: 'enterprise_charges_sales_tax' }= t(:charges_sales_tax) %input{ id: 'enterprise_charges_sales_tax_true', type: 'radio', name: 'charges_sales_tax', value: 'true', required: true, ng: { model: 'enterprise.charges_sales_tax' } } - %label{ for: 'enterprise_charges_sales_tax_true' } {{t('say_yes')}} + %label{ for: 'enterprise_charges_sales_tax_true' } {{'say_yes' | t}} %input{ id: 'enterprise_charges_sales_tax_false', type: 'radio', name: 'charges_sales_tax', value: 'false', required: true, ng: { model: 'enterprise.charges_sales_tax' } } - %label{ for: 'enterprise_charges_sales_tax_false' } {{t('say_no')}} + %label{ for: 'enterprise_charges_sales_tax_false' } {{'say_no' | t}} %span.error.small-12.columns{ ng: { show: "about.charges_sales_tax.$error.required && submitted" } } - {{t('enterprise_tax_required')}} + {{'enterprise_tax_required' | t}} .row.buttons.pad-top .small-12.columns - %input.button.primary.right{ type: "submit", value: "{{t('continue')}}" } + %input.button.primary.right{ type: "submit", value: "{{'continue' | t}}" } diff --git a/app/assets/javascripts/templates/registration/contact.html.haml b/app/assets/javascripts/templates/registration/contact.html.haml index 88c217e456..1621b95a01 100644 --- a/app/assets/javascripts/templates/registration/contact.html.haml +++ b/app/assets/javascripts/templates/registration/contact.html.haml @@ -3,7 +3,7 @@ .row .small-12.columns %header - %h2 {{t('registration_greeting')}} + %h2 {{'registration_greeting' | t}} %h5 {{t('who_is_managing_enterprise', {enterprise: enterprise.name})}} @@ -12,19 +12,19 @@ .small-12.medium-12.large-7.columns .row .small-12.columns.field - %label{ for: 'enterprise_contact' } {{t('enterprise_contact')}}: + %label{ for: 'enterprise_contact' } {{'enterprise_contact' | t}}: %input.chunky.small-12.columns{ id: 'enterprise_contact', name: 'contact', required: true, placeholder: "Contact Name", ng: { model: 'enterprise.contact' } } %span.error.small-12.columns{ ng: { show: "contact.contact.$error.required && submitted" } } - {{t('enterprise_contact_required')}} + {{'enterprise_contact_required' | t}} .row .small-12.columns.field - %label{ for: 'enterprise_email' } {{t('enterprise_email')}}: + %label{ for: 'enterprise_email' } {{'enterprise_email' | t}}: %input.chunky.small-12.columns{ id: 'enterprise_email', name: 'email', type: 'email', required: true, placeholder: "eg. charlie@thefarm.com", ng: { model: 'enterprise.email' } } %span.error.small-12.columns{ ng: { show: "(contact.email.$error.email || contact.email.$error.required) && submitted" } } - {{t('enterprise_email_required')}} + {{'enterprise_email_required' | t}} .row .small-12.columns.field - %label{ for: 'enterprise_phone' } {{t('enterprise_phone')}}: + %label{ for: 'enterprise_phone' } {{'enterprise_phone' | t}}: %input.chunky.small-12.columns{ id: 'enterprise_phone', name: 'phone', placeholder: "eg. (03) 1234 5678", ng: { model: 'enterprise.phone' } } .small-12.medium-12.large-5.hide-for-small-only / %h6 @@ -43,5 +43,5 @@ .row.buttons .small-12.columns - %input.button.secondary{ type: "button", value: "{{t('back')}}", ng: { click: "select('details')" } } - %input.button.primary.right{ type: "submit", value: "{{t('continue')}}" } + %input.button.secondary{ type: "button", value: "{{'back' | t}}", ng: { click: "select('details')" } } + %input.button.primary.right{ type: "submit", value: "{{'continue' | t}}" } diff --git a/app/assets/javascripts/templates/registration/details.html.haml b/app/assets/javascripts/templates/registration/details.html.haml index 7543cc30ce..f03a48ec59 100644 --- a/app/assets/javascripts/templates/registration/details.html.haml +++ b/app/assets/javascripts/templates/registration/details.html.haml @@ -3,62 +3,62 @@ .row .small-12.columns %header - %h2 {{t('registration_detail_headline')}} - %h5{ bo: { if: "enterprise.type != 'own'" } } {{t('registration_detail_enterprise')}} - %h5{ bo: { if: "enterprise.type == 'own'" } } {{t('registration_detail_producer')}} + %h2 {{'registration_detail_headline' | t}} + %h5{ bo: { if: "enterprise.type != 'own'" } } {{'registration_detail_enterprise' | t}} + %h5{ bo: { if: "enterprise.type == 'own'" } } {{'registration_detail_producer' | t}} %form{ name: 'details', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "selectIfValid('contact',details)" } } .row .small-12.medium-9.large-12.columns.end .field - %label{ for: 'enterprise_name', bo: { if: "enterprise.type != 'own'" } } {{t('registration_detail_name_enterprise')}} - %label{ for: 'enterprise_name', bo: { if: "enterprise.type == 'own'" } } {{t('registration_detail_name_producer')}} - %input.chunky{ id: 'enterprise_name', name: 'name', placeholder: "{{t('registration_detail_name_placeholder')}}", required: true, ng: { model: 'enterprise.name' } } + %label{ for: 'enterprise_name', bo: { if: "enterprise.type != 'own'" } } {{'registration_detail_name_enterprise' | t}} + %label{ for: 'enterprise_name', bo: { if: "enterprise.type == 'own'" } } {{'registration_detail_name_producer' | t}} + %input.chunky{ id: 'enterprise_name', name: 'name', placeholder: "{{'registration_detail_name_placeholder' | t}}", required: true, ng: { model: 'enterprise.name' } } %span.error{ ng: { show: "details.name.$error.required && submitted" } } - {{t('registration_detail_name_error')}} + {{'registration_detail_name_error' | t}} .row .small-12.medium-9.large-6.columns .field - %label{ for: 'enterprise_address' } {{t('registration_detail_address1')}} - %input.chunky{ id: 'enterprise_address', name: 'address1', required: true, placeholder: "{{t('registration_detail_address1_placeholder')}}", required: true, ng: { model: 'enterprise.address.address1' } } + %label{ for: 'enterprise_address' } {{'registration_detail_address1' | t}} + %input.chunky{ id: 'enterprise_address', name: 'address1', required: true, placeholder: "{{'registration_detail_address1_placeholder' | t}}", required: true, ng: { model: 'enterprise.address.address1' } } %span.error{ ng: { show: "details.address1.$error.required && submitted" } } - {{t('registration_detail_address1_error')}} + {{'registration_detail_address1_error' | t}} .field - %label{ for: 'enterprise_address2' } {{t('registration_detail_address2')}} + %label{ for: 'enterprise_address2' } {{'registration_detail_address2' | t}} %input.chunky{ id: 'enterprise_address2', name: 'address2', required: false, placeholder: "", required: false, ng: { model: 'enterprise.address.address2' } } .small-12.medium-9.large-6.columns.end .row .small-12.medium-8.large-8.columns .field - %label{ for: 'enterprise_city' } {{t('registration_detail_suburb')}} - %input.chunky{ id: 'enterprise_city', name: 'city', required: true, placeholder: "{{t('registration_detail_suburb_placeholder')}}", ng: { model: 'enterprise.address.city' } } + %label{ for: 'enterprise_city' } {{'registration_detail_suburb' | t}} + %input.chunky{ id: 'enterprise_city', name: 'city', required: true, placeholder: "{{'registration_detail_suburb_placeholder' | t}}", ng: { model: 'enterprise.address.city' } } %span.error{ ng: { show: "details.city.$error.required && submitted" } } - {{t('registration_detail_suburb_error')}} + {{'registration_detail_suburb_error' | t}} .small-12.medium-4.large-4.columns .field - %label{ for: 'enterprise_zipcode' } {{t('registration_detail_postcode')}} - %input.chunky{ id: 'enterprise_zipcode', name: 'zipcode', required: true, placeholder: "{{t('registration_detail_postcode_placeholder')}}", ng: { model: 'enterprise.address.zipcode' } } + %label{ for: 'enterprise_zipcode' } {{'registration_detail_postcode' | t}} + %input.chunky{ id: 'enterprise_zipcode', name: 'zipcode', required: true, placeholder: "{{'registration_detail_postcode_placeholder' | t}}", ng: { model: 'enterprise.address.zipcode' } } %span.error{ ng: { show: "details.zipcode.$error.required && submitted" } } - {{t('registration_detail_postcode_error')}} + {{'registration_detail_postcode_error' | t}} .row .small-12.medium-4.large-4.columns .field - %label{ for: 'enterprise_state' } {{t('registration_detail_state')}} + %label{ for: 'enterprise_state' } {{'registration_detail_state' | t}} %select.chunky{ id: 'enterprise_state', name: 'state', ng: { model: 'enterprise.address.state_id', options: 's.id as s.abbr for s in enterprise.country.states', show: 'countryHasStates()', required: 'countryHasStates()' } } %span.error{ ng: { show: "details.state.$error.required && submitted" } } - {{t('registration_detail_state_error')}} + {{'registration_detail_state_error' | t}} .small-12.medium-8.large-8.columns .field - %label{ for: 'enterprise_country' } {{t('registration_detail_country')}} + %label{ for: 'enterprise_country' } {{'registration_detail_country' | t}} %select.chunky{ id: 'enterprise_country', name: 'country', required: true, ng: { model: 'enterprise.country', options: 'c as c.name for c in countries' } } %span.error{ ng: { show: "details.country.$error.required && submitted" } } - {{t('registration_detail_country_error')}} + {{'registration_detail_country_error' | t}} .row.buttons .small-12.columns %hr - %input.button.primary.right{ type: "submit", value: "{{t('continue')}}" } + %input.button.primary.right{ type: "submit", value: "{{'continue' | t}}" } diff --git a/app/assets/javascripts/templates/registration/finished.html.haml b/app/assets/javascripts/templates/registration/finished.html.haml index 92136147e1..1bf86d3ed5 100644 --- a/app/assets/javascripts/templates/registration/finished.html.haml +++ b/app/assets/javascripts/templates/registration/finished.html.haml @@ -2,11 +2,11 @@ .row .small-12.columns.pad-top %header - %h2 {{t('registration_finished_headline')}} + %h2 {{'registration_finished_headline' | t}} .panel.callout %p {{t('registration_finished_thanks', {enterprise: enterprise.name})}} - %p {{t('registration_finished_login')}} + %p {{'registration_finished_login' | t}} .row .small-12.columns.text-center %h4 @@ -14,4 +14,4 @@ %p{ "ng-bind-html" => "t('registration_finished_activate_instruction_html', {email: enterprise.email})"} - %a.button.primary{ type: "button", href: "/" } {{t('registration_finished_action')}} > + %a.button.primary{ type: "button", href: "/" } {{'registration_finished_action' | t}} > diff --git a/app/assets/javascripts/templates/registration/images.html.haml b/app/assets/javascripts/templates/registration/images.html.haml index 45d9cf2015..60a1ca602b 100644 --- a/app/assets/javascripts/templates/registration/images.html.haml +++ b/app/assets/javascripts/templates/registration/images.html.haml @@ -3,8 +3,8 @@ .row .small-12.columns %header - %h2 {{t('registration_images_headline')}} - %h5 {{t('registration_images_description')}} + %h2 {{'registration_images_headline' | t}} + %h5 {{'registration_images_description' | t}} %form{ name: 'images', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "select('social')" } } .row{ ng: { repeat: 'image_step in imageSteps', show: "imageStep == image_step" } } @@ -18,5 +18,5 @@ .row.buttons.pad-top{ ng: { if: "imageStep == 'promo'" } } .small-12.columns - %input.button.secondary{ type: "button", value: "{{t('back')}}", ng: { click: "imageSelect('logo')" } } - %input.button.primary.right{ type: "submit", value: "{{t('continue')}}" } + %input.button.secondary{ type: "button", value: "{{'back' | t}}", ng: { click: "imageSelect('logo')" } } + %input.button.primary.right{ type: "submit", value: "{{'continue' | t}}" } diff --git a/app/assets/javascripts/templates/registration/images/logo.html.haml b/app/assets/javascripts/templates/registration/images/logo.html.haml index 9c0b02ca87..842cbcbe11 100644 --- a/app/assets/javascripts/templates/registration/images/logo.html.haml +++ b/app/assets/javascripts/templates/registration/images/logo.html.haml @@ -4,42 +4,42 @@ .row .small-12.columns.center %h4 - {{t('select_logo')}} + {{'select_logo' | t}} .row .small-12.columns.center %span.small - {{t('logo_tip')}} + {{'logo_tip' | t}} .row.pad-top .small-12.columns .image-select.small-12.columns - %label.small-12.columns.button{ for: 'image-select' } {{t('logo_label')}} + %label.small-12.columns.button{ for: 'image-select' } {{'logo_label' | t}} %input#image-select{ type: 'file', hidden: true, 'nv-file-select' => true, uploader: "imageUploader", options: '{ alias: imageStep }' } .row.show-for-large-up .large-12.columns %span#or.large-12.columns - {{t('action_or')}} + {{'action_or' | t}} .row.show-for-large-up .large-12.columns #image-over{ 'nv-file-over' => true, uploader: "imageUploader" } - {{t('logo_drag')}} + {{'logo_drag' | t}} .small-12.medium-12.large-6.columns .row .small-12.columns.center .row .small-12.columns.center %h4 - {{t('review_logo')}} + {{'review_logo' | t}} .row .small-12.columns.center %span.small - {{t('review_logo_tip')}} + {{'review_logo_tip' | t}} .row.pad-top .small-12.columns.center #image-placeholder.logo %img{ ng: { show: "imageSrc() && !imageUploader.isUploading", src: '{{ imageSrc() }}' } } .message{ ng: { hide: "imageSrc() || imageUploader.isUploading" } } - {{t('logo_placeholder')}} + {{'logo_placeholder' | t}} .loading{ ng: { hide: "!imageUploader.isUploading" } } %img.spinner{ src: "/assets/spinning-circles.svg" } %br/ - {{t('uploading')}} + {{'uploading' | t}} diff --git a/app/assets/javascripts/templates/registration/images/promo.html.haml b/app/assets/javascripts/templates/registration/images/promo.html.haml index 61a382ecaa..342db5c08d 100644 --- a/app/assets/javascripts/templates/registration/images/promo.html.haml +++ b/app/assets/javascripts/templates/registration/images/promo.html.haml @@ -2,42 +2,42 @@ .row .small-12.columns.center %h4 - {{t('select_promo_image')}} + {{'select_promo_image' | t}} .row .small-12.medium-12.large-5.columns.center .row .small-12.columns.center %span.small - {{t('promo_image_tip')}} + {{'promo_image_tip' | t}} .row.pad-top .small-12.columns .image-select.small-12.columns - %label.small-12.columns.button{ for: 'image-select' } {{t('promo_image_label')}} + %label.small-12.columns.button{ for: 'image-select' } {{'promo_image_label' | t}} %input#image-select{ type: 'file', hidden: true, 'nv-file-select' => true, uploader: "imageUploader", options: '{ alias: imageStep }' } .large-2.columns %span#or.horizontal.large-12.columns - {{t('action_or')}} + {{'action_or' | t}} .large-5.columns #image-over{ 'nv-file-over' => true, uploader: "imageUploader" } - {{t('promo_image_drag')}} + {{'promo_image_drag' | t}} .small-12.medium-12.large-12.columns.pad-top .row .small-12.columns.center %h4 - {{t('review_promo_image')}} + {{'review_promo_image' | t}} .row .small-12.columns.center .row .small-12.columns.center %span.small - {{t('review_promo_image_tip')}} + {{'review_promo_image_tip' | t}} .row.pad-top .small-12.columns.center #image-placeholder.promo %img{ ng: { show: "imageSrc() && !imageUploader.isUploading", src: '{{ imageSrc() }}' } } .message{ ng: { hide: "imageSrc() || imageUploader.isUploading" } } - {{t('promo_image_placeholder')}} + {{'promo_image_placeholder' | t}} .loading{ ng: { hide: "!imageUploader.isUploading" } } %img.spinner{ src: "/assets/spinning-circles.svg" } %br/ - {{t('uploading')}} + {{'uploading' | t}} diff --git a/app/assets/javascripts/templates/registration/introduction.html.haml b/app/assets/javascripts/templates/registration/introduction.html.haml index 6288c7aa4f..c0adb0c357 100644 --- a/app/assets/javascripts/templates/registration/introduction.html.haml +++ b/app/assets/javascripts/templates/registration/introduction.html.haml @@ -1,41 +1,41 @@ .row .small-12.columns %header - %h2 {{t('registration_greeting')}} + %h2 {{'registration_greeting' | t}} %h4 %small %i.ofn-i_040-hub - {{t('registration_intro')}} + {{'registration_intro' | t}} .hide-for-large-up %hr - %input.button.small.primary{ type: "button", value: "{{t('registration_action')}}", ng: { click: "select('details')" } } + %input.button.small.primary{ type: "button", value: "{{'registration_action' | t}}", ng: { click: "select('details')" } } %hr .row{ 'data-equalizer' => true } .small-12.medium-12.large-6.columns.pad-top{ 'data-equalizer-watch' => true } - %h5 {{t('registration_checklist')}}: + %h5 {{'registration_checklist' | t}}: %ul.check-list %li - {{t('registration_time')}} + {{'registration_time' | t}} %li - {{t('registration_enterprise_address')}} + {{'registration_enterprise_address' | t}} %li - {{t('registration_contact_details')}} + {{'registration_contact_details' | t}} %li - {{t('registration_logo')}} + {{'registration_logo' | t}} %li - {{t('registration_promo_image')}} + {{'registration_promo_image' | t}} %li - {{t('registration_about_us')}} + {{'registration_about_us' | t}} .small-9.medium-8.large-5.columns.pad-top.end{ 'data-equalizer-watch' => true} %h5 - {{t('registration_outcome_headline')}} + {{'registration_outcome_headline' | t}} %p{ "ng-bind-html" => "t('registration_outcome1_html')" } - %p {{t('registration_outcome2')}} - %p {{t('registration_outcome3')}} + %p {{'registration_outcome2' | t}} + %p {{'registration_outcome3' | t}} .row.show-for-large-up .small-12.columns %hr - %input.button.primary.right{ type: "button", value: "{{t('registration_action')}}", ng: { click: "select('details')" } } + %input.button.primary.right{ type: "button", value: "{{'registration_action' | t}}", ng: { click: "select('details')" } } diff --git a/app/assets/javascripts/templates/registration/limit_reached.html.haml b/app/assets/javascripts/templates/registration/limit_reached.html.haml index 776332b94c..09e9866fd9 100644 --- a/app/assets/javascripts/templates/registration/limit_reached.html.haml +++ b/app/assets/javascripts/templates/registration/limit_reached.html.haml @@ -1,16 +1,16 @@ .row .small-12.columns %header - %h2 {{t('limit_reached_headline')}} - %h4 {{t('limit_reached_message')}} + %h2 {{'limit_reached_headline' | t}} + %h4 {{'limit_reached_message' | t}} .row .small-12.medium-3.large-2.columns.text-right.hide-for-small-only %img{:src => "/assets/potatoes.png"} .small-12.medium-9.large-10.columns %p - {{t('limit_reached_text')}} + {{'limit_reached_text' | t}} %strong Open Food Network. .row .small-12.columns %hr - %input.button.primary{ type: "button", value: "{{t('limit_reached_action')}}", ng: { click: "close()" } } + %input.button.primary{ type: "button", value: "{{'limit_reached_action' | t}}", ng: { click: "close()" } } diff --git a/app/assets/javascripts/templates/registration/social.html.haml b/app/assets/javascripts/templates/registration/social.html.haml index 5225256eee..553c801b4e 100644 --- a/app/assets/javascripts/templates/registration/social.html.haml +++ b/app/assets/javascripts/templates/registration/social.html.haml @@ -4,7 +4,7 @@ .row .small-12.columns %header - %h2 {{t('enterprise_final_step')}} + %h2 {{'enterprise_final_step' | t}} %h5 {{t('enterprise_social_text', {enterprise: enterprise.name})}} @@ -14,33 +14,33 @@ .row .small-12.columns .field - %label{ for: 'enterprise_website' } {{t('website')}}: - %input.chunky{ id: 'enterprise_website', placeholder: "{{t('website_placeholder')}}", ng: { model: 'enterprise.website' } } + %label{ for: 'enterprise_website' } {{'website' | t}}: + %input.chunky{ id: 'enterprise_website', placeholder: "{{'website_placeholder' | t}}", ng: { model: 'enterprise.website' } } .row .small-12.columns .field - %label{ for: 'enterprise_facebook' } {{t('facebook')}}: - %input.chunky{ id: 'enterprise_facebook', placeholder: "{{t('facebook_placeholder')}}", ng: { model: 'enterprise.facebook' } } + %label{ for: 'enterprise_facebook' } {{'facebook' | t}}: + %input.chunky{ id: 'enterprise_facebook', placeholder: "{{'facebook_placeholder' | t}}", ng: { model: 'enterprise.facebook' } } .row .small-12.columns .field - %label{ for: 'enterprise_linkedin' } {{t('linkedin')}}: - %input.chunky{ id: 'enterprise_linkedin', placeholder: "{{t('linkedin_placeholder')}}", ng: { model: 'enterprise.linkedin' } } + %label{ for: 'enterprise_linkedin' } {{'linkedin' | t}}: + %input.chunky{ id: 'enterprise_linkedin', placeholder: "{{'linkedin_placeholder' | t}}", ng: { model: 'enterprise.linkedin' } } .small-12.large-5.columns .row .small-12.columns .field - %label{ for: 'enterprise_twitter' } {{t('twitter')}}: - %input.chunky{ id: 'enterprise_twitter', placeholder: "{{t('twitter_placeholder')}}", ng: { model: 'enterprise.twitter' } } + %label{ for: 'enterprise_twitter' } {{'twitter' | t}}: + %input.chunky{ id: 'enterprise_twitter', placeholder: "{{'twitter_placeholder' | t}}", ng: { model: 'enterprise.twitter' } } .row .small-12.columns .field - %label{ for: 'enterprise_instagram' } {{t('instagram')}}: - %input.chunky{ id: 'enterprise_instagram', placeholder: "{{t('instagram_placeholder')}}", ng: { model: 'enterprise.instagram' } } + %label{ for: 'enterprise_instagram' } {{'instagram' | t}}: + %input.chunky{ id: 'enterprise_instagram', placeholder: "{{'instagram_placeholder' | t}}", ng: { model: 'enterprise.instagram' } } .row.buttons .small-12.columns - %input.button.secondary{ type: "button", value: "{{t('back')}}", ng: { click: "select('images')" } } - %input.button.primary.right{ type: "submit", value: "{{t('continue')}}" } + %input.button.secondary{ type: "button", value: "{{'back' | t}}", ng: { click: "select('images')" } } + %input.button.primary.right{ type: "submit", value: "{{'continue' | t}}" } diff --git a/app/assets/javascripts/templates/registration/type.html.haml b/app/assets/javascripts/templates/registration/type.html.haml index e1a5e09376..f7b580e64c 100644 --- a/app/assets/javascripts/templates/registration/type.html.haml +++ b/app/assets/javascripts/templates/registration/type.html.haml @@ -8,7 +8,7 @@ %h2 {{t('registration_type_headline', {enterprise: enterprise.name})}} %h4 - {{t('registration_type_question')}} + {{'registration_type_question' | t}} %form{ name: 'type', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "create(type)" } } .row#enterprise-types{ 'data-equalizer' => true, bo: { if: "enterprise.type != 'own'" } } @@ -17,32 +17,32 @@ .small-12.medium-6.large-6.columns{ 'data-equalizer-watch' => true } %a.btnpanel#producer-panel{ href: "#", ng: { click: "enterprise.is_primary_producer = true", class: "{selected: enterprise.is_primary_producer}" } } %i.ofn-i_059-producer - %h4 {{t('registration_type_producer')}} + %h4 {{'registration_type_producer' | t}} .small-12.medium-6.large-6.columns{ 'data-equalizer-watch' => true } %a.btnpanel#hub-panel{ href: "#", ng: { click: "enterprise.is_primary_producer = false", class: "{selected: enterprise.is_primary_producer == false}" } } %i.ofn-i_063-hub - %h4 {{t('registration_type_no_producer')}} + %h4 {{'registration_type_no_producer' | t}} .row .small-12.columns %input.chunky{ id: 'enterprise_is_primary_producer', name: 'is_primary_producer', hidden: true, required: true, ng: { model: 'enterprise.is_primary_producer' } } %span.error{ ng: { show: "type.is_primary_producer.$error.required && submitted" } } - {{t('registration_type_error')}} + {{'registration_type_error' | t}} .row .small-12.columns .panel.callout .left %i.ofn-i_013-help   - %p {{t('registration_type_producer_help')}} + %p {{'registration_type_producer_help' | t}} .panel.callout .left %i.ofn-i_013-help   - %p {{t('registration_type_no_producer_help')}} + %p {{'registration_type_no_producer_help' | t}} .row.buttons .small-12.columns - %input.button.secondary{ type: "button", value: "{{t('back')}}", ng: { click: "select('contact')" } } - %input.button.primary.right{ type: "submit", value: "{{t('create_profile')}}" } + %input.button.secondary{ type: "button", value: "{{'back' | t}}", ng: { click: "select('contact')" } } + %input.button.primary.right{ type: "submit", value: "{{'create_profile' | t}}" } diff --git a/app/assets/javascripts/templates/registration_authentication.html.haml b/app/assets/javascripts/templates/registration_authentication.html.haml index 05e1d45154..f277c50abc 100644 --- a/app/assets/javascripts/templates/registration_authentication.html.haml +++ b/app/assets/javascripts/templates/registration_authentication.html.haml @@ -1,7 +1,7 @@ .container .row.modal-centered - %h2 {{t('welcome_to_ofn')}} - %h5 {{t('signup_or_login')}}: + %h2 {{'welcome_to_ofn' | t}} + %h5 {{'signup_or_login' | t}}: %div{"ng-controller" => "AuthenticationCtrl"} %tabset %ng-include{src: "'signup.html'"} @@ -9,9 +9,9 @@ %ng-include{src: "'forgot.html'"} %div{ ng: { show: "active('/signup')"} } %hr - {{t('have_an_account')}} + {{'have_an_account' | t}} %a{ href: "", ng: { click: "select('/login')"}} - {{t('action_login')}} + {{'action_login' | t}} %a.close-reveal-modal{"ng-click" => "$close()"} %i.ofn-i_009-close diff --git a/app/assets/javascripts/templates/shop_variant.html.haml b/app/assets/javascripts/templates/shop_variant.html.haml index 1d6a090935..00e4f70d7c 100644 --- a/app/assets/javascripts/templates/shop_variant.html.haml +++ b/app/assets/javascripts/templates/shop_variant.html.haml @@ -5,7 +5,7 @@ .bulk-buy.inline{"bo-if" => "variant.product.group_buy"} %i.ofn-i_056-bulk>< %em>< - \ {{t('bulk')}} + \ {{'bulk' | t}} -# WITHOUT GROUP BUY .small-5.medium-3.large-3.columns.text-right{"bo-if" => "!variant.product.group_buy"} @@ -30,7 +30,7 @@ integer: true, min: 0, "ng-model" => "variant.line_item.quantity", - placeholder: "{{t('shop_variant_quantity_min')}}", + placeholder: "{{'shop_variant_quantity_min' | t}}", "ofn-disable-scroll" => true, max: "{{variant.on_demand && 9999 || variant.count_on_hand }}", name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}"} @@ -40,7 +40,7 @@ integer: true, min: 0, "ng-model" => "variant.line_item.max_quantity", - placeholder: "{{t('shop_variant_quantity_max')}}", + placeholder: "{{'shop_variant_quantity_max' | t}}", "ofn-disable-scroll" => true, max: "{{variant.on_demand && 9999 || variant.count_on_hand }}", name: "variant_attributes[{{variant.id}}][max_quantity]"} diff --git a/app/assets/javascripts/templates/signup.html.haml b/app/assets/javascripts/templates/signup.html.haml index 48f75e1a44..2e780aabb5 100644 --- a/app/assets/javascripts/templates/signup.html.haml +++ b/app/assets/javascripts/templates/signup.html.haml @@ -1,11 +1,11 @@ %tab#sign-up-content{"ng-controller" => "SignupCtrl", - heading: "{{t('label_signup')}}", + heading: "{{'label_signup' | t}}", active: "active(path)", select: "select(path)"} %form{"ng-submit" => "submit()"} .row .large-12.columns - %label{for: "email"} {{t('signup_email')}} + %label{for: "email"} {{'signup_email' | t}} %input.title.input-text{name: "email", type: "email", id: "email", @@ -15,7 +15,7 @@ {{ errors.email.join(' ') }} .row .large-12.columns - %label{for: "password"} {{t('choose_password')}} + %label{for: "password"} {{'choose_password' | t}} %input.title.input-text{name: "password", type: "password", id: "password", @@ -26,7 +26,7 @@ {{ errors.password.join(' ') }} .row .large-12.columns - %label{for: "password_confirmation"} {{t('confirm_password')}} + %label{for: "password_confirmation"} {{'confirm_password' | t}} %input.title.input-text{name: "password_confirmation", type: "password", id: "password_confirmation", @@ -38,4 +38,4 @@ %input.button.primary{name: "commit", tabindex: "3", type: "submit", - value: "{{t('action_signup')}}"} + value: "{{'action_signup' | t}}"}