From 64af81a4a2f68669831137b43824b7162d8b626f Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 4 Jun 2019 20:13:02 +0100 Subject: [PATCH 1/5] Make search_by_email text translatable in subscriptions list page --- app/views/admin/subscriptions/_filters.html.haml | 2 +- config/locales/en.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/subscriptions/_filters.html.haml b/app/views/admin/subscriptions/_filters.html.haml index f56136e53d..870b8ce43a 100644 --- a/app/views/admin/subscriptions/_filters.html.haml +++ b/app/views/admin/subscriptions/_filters.html.haml @@ -3,7 +3,7 @@ .filter_select.five.columns.alpha %label{ :for => 'query', ng: {class: '{disabled: !shop_id}'} }=t('admin.quick_search') %br - %input.fullwidth{ :type => "text", :id => 'query', ng: { model: 'query', disabled: '!shop_id'}, :placeholder => "Search by email..." } + %input.fullwidth{ :type => "text", :id => 'query', ng: { model: 'query', disabled: '!shop_id'}, :placeholder => "#{t('.query_placeholder')}" } .filter_select.four.columns %label{ :for => 'shop_id', ng: { bind: "shop_id ? '#{t('admin.shop')}' : '#{t('admin.variant_overrides.index.select_a_shop')}'" } } %br diff --git a/config/locales/en.yml b/config/locales/en.yml index bf914a13ea..da9a4c45ce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1013,6 +1013,8 @@ en: pause_subscription: Pause Subscription unpause_subscription: Unpause Subscription cancel_subscription: Cancel Subscription + filters: + query_placeholder: "Search by email..." setup_explanation: just_a_few_more_steps: 'Just a few more steps before you can begin:' enable_subscriptions: "Enable subscriptions for at least one of your shops" From eb42e81afc96f0d2d31bb4b0f2331f966a99bdee Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 4 Jun 2019 20:23:33 +0100 Subject: [PATCH 2/5] Make some text entries translatable in create subscription pages: title in step 1 details and 4 review and date placeholders in step 1 details --- app/views/admin/subscriptions/_details.html.haml | 6 +++--- app/views/admin/subscriptions/_review.html.haml | 2 +- config/locales/en.yml | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/admin/subscriptions/_details.html.haml b/app/views/admin/subscriptions/_details.html.haml index 7dedbf26f4..675c7671a9 100644 --- a/app/views/admin/subscriptions/_details.html.haml +++ b/app/views/admin/subscriptions/_details.html.haml @@ -1,5 +1,5 @@ %fieldset.no-border-bottom - %legend{ align: 'center'}= t("admin.subscriptions.form.details") + %legend{ align: 'center'}= t(".details") .row .seven.columns.alpha.field %label{ for: 'customer_id'}= t('admin.customer') @@ -34,11 +34,11 @@ .row .seven.columns.alpha.field %label{ for: 'begins_at'}= t('admin.begins_at') - %input.fullwidth#begins_at{ name: 'begins_at', type: 'text', placeholder: 'Select A Date', datepicker: 'subscription.begins_at', required: true, ng: { model: 'subscription.begins_at' } } + %input.fullwidth#begins_at{ name: 'begins_at', type: 'text', placeholder: "#{t('.begins_at_placeholder')}", datepicker: 'subscription.begins_at', required: true, ng: { model: 'subscription.begins_at' } } .error{ ng: { show: 'subscription_form.$submitted && subscription_details_form.begins_at.$error.required' } }= t(:error_required) .error{ ng: { repeat: 'error in errors.begins_at', show: 'subscription_details_form.begins_at.$pristine' } } {{ error }} .two.columns   .seven.columns.omega.field %label{ for: 'ends_at'}= t('admin.ends_at') - %input.fullwidth#ends_at{ name: 'ends_at', type: 'text', placeholder: 'Optional', datepicker: 'subscription.begins_at', ng: { model: 'subscription.ends_at' } } + %input.fullwidth#ends_at{ name: 'ends_at', type: 'text', placeholder: "#{t('.ends_at_placeholder')}", datepicker: 'subscription.begins_at', ng: { model: 'subscription.ends_at' } } .error{ ng: { repeat: 'error in errors.ends_at', show: 'subscription_details_form.ends_at.$pristine' } } {{ error }} diff --git a/app/views/admin/subscriptions/_review.html.haml b/app/views/admin/subscriptions/_review.html.haml index 4d06cb7859..0bcaf2eab2 100644 --- a/app/views/admin/subscriptions/_review.html.haml +++ b/app/views/admin/subscriptions/_review.html.haml @@ -1,5 +1,5 @@ %fieldset.no-border-bottom - %legend{ align: 'center'}= t("admin.subscriptions.form.review") + %legend{ align: 'center'}= t(".details") .row .eight.columns.alpha .row diff --git a/config/locales/en.yml b/config/locales/en.yml index da9a4c45ce..82bb5bca66 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1047,6 +1047,8 @@ en: charges_not_allowed: Charges are not allowed by this customer no_default_card: Customer has no cards available to charge card_ok: Customer has a card available to charge + begins_at_placeholder: "Select a Date" + ends_at_placeholder: "Optional" loading_flash: loading: LOADING SUBSCRIPTIONS review: From cfcf73b6a18b14481c9dbb4e4149b8d02200cefc Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 4 Jun 2019 20:39:32 +0100 Subject: [PATCH 3/5] Make save and saving messages translatable in subscriptions items panel --- .../controllers/products_panel_controller.js.coffee | 6 +++--- app/views/admin/subscriptions/_products_panel.html.haml | 6 +++--- config/locales/en.yml | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/admin/subscriptions/controllers/products_panel_controller.js.coffee b/app/assets/javascripts/admin/subscriptions/controllers/products_panel_controller.js.coffee index f9adbf8584..928654ace3 100644 --- a/app/assets/javascripts/admin/subscriptions/controllers/products_panel_controller.js.coffee +++ b/app/assets/javascripts/admin/subscriptions/controllers/products_panel_controller.js.coffee @@ -10,14 +10,14 @@ angular.module("admin.subscriptions").controller "ProductsPanelController", ($sc $scope.save = -> $scope.saving = true - StatusMessage.display 'progress', 'Saving...' + StatusMessage.display 'progress', t('js.saving') $scope.subscription.update().then (response) -> $scope.saving = false - StatusMessage.display 'success', 'Saved' + StatusMessage.display 'success', t('js.changes_saved') , (response) -> $scope.saving = false if response.data?.errors? keys = Object.keys(response.data.errors) StatusMessage.display 'failure', response.data.errors[keys[0]][0] else - StatusMessage.display 'success', 'Saved' + StatusMessage.display 'success', t('js.changes_saved') diff --git a/app/views/admin/subscriptions/_products_panel.html.haml b/app/views/admin/subscriptions/_products_panel.html.haml index 99ac81f984..330e2fe0c1 100644 --- a/app/views/admin/subscriptions/_products_panel.html.haml +++ b/app/views/admin/subscriptions/_products_panel.html.haml @@ -5,11 +5,11 @@ = render 'products' %a.button.update.fullwidth{ ng: { class: "{disabled: saved() && !saving, saving: saving}", click: "save()" } } %span{ ng: {hide: "saved() || saving" } } - SAVE + = t('.save') %i.icon-save %span{ ng: {show: "saved() && !saving" } } - SAVED + = t('.saved') %i.icon-ok-sign %span{ ng: {show: "saving" } } - SAVING + = t('.saving') %i.icon-refresh diff --git a/config/locales/en.yml b/config/locales/en.yml index 82bb5bca66..9d0d03ce01 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1056,6 +1056,10 @@ en: address: Address products: Products no_open_or_upcoming_order_cycle: "No Upcoming Order Cycle" + products_panel: + save: "SAVE" + saving: "SAVING" + saved: "SAVED" product_already_in_order: This product has already been added to the order. Please edit the quantity directly. orders: number: Number From 9944f3e1e6ca5eaf0d04634dcc6cb595805c0ef0 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 4 Jun 2019 20:48:56 +0100 Subject: [PATCH 4/5] Make translations of tooltips in subscriptions list page work again --- .../templates/admin/new_subscription_dialog.html.haml | 4 ++-- config/locales/en.yml | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/templates/admin/new_subscription_dialog.html.haml b/app/assets/javascripts/templates/admin/new_subscription_dialog.html.haml index dc96b67ac8..fa5ac82fd7 100644 --- a/app/assets/javascripts/templates/admin/new_subscription_dialog.html.haml +++ b/app/assets/javascripts/templates/admin/new_subscription_dialog.html.haml @@ -1,6 +1,6 @@ #new-subscription-dialog .text-normal.margin-bottom-30.text-center - = t('admin.subscriptions.index.please_select_a_shop') + = t('js.admin.subscriptions.new.please_select_a_shop') %form{ name: 'new_subscription_form', novalidate: true, ng: { submit: "newSubscription()" }} @@ -8,7 +8,7 @@ %input.ofn-select2.fullwidth#new_subscription_shop_id{ ng: { model: 'shop_id' }, required: true, name: 'shop_id', data: 'shops' } %div{ ng: { show: "submitted && new_subscription_form.$pristine" } } .error{ ng: { show: "new_subscription_form.shop_id.$error.required" } } - = t('admin.subscriptions.index.please_select_a_shop') + = t('js.admin.subscriptions.new.please_select_a_shop') .text-center %input.button.red.icon-plus{ type: 'submit', value: t('continue') } diff --git a/config/locales/en.yml b/config/locales/en.yml index 9d0d03ce01..ca46fb5fc5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1007,8 +1007,7 @@ en: new: New Subscription create: Create Subscription edit: Edit Subscription - index: - please_select_a_shop: Please select a shop + table: edit_subscription: Edit Subscription pause_subscription: Pause Subscription unpause_subscription: Unpause Subscription @@ -2563,6 +2562,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using add_a_new_customer_for: "Add a new customer for %{shop_name}" customer_placeholder: "customer@example.org" valid_email_error: "Please enter a valid email address" + subscriptions: + new: + please_select_a_shop: "Please select a shop" insufficient_stock: "Insufficient stock available, only %{on_hand} remaining" out_of_stock: reduced_stock_available: Reduced stock available From ff2901a9d1557f156820fbf7466f0dc0712aa91c Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 4 Jun 2019 20:52:32 +0100 Subject: [PATCH 5/5] Add address suburb translation key to fix edit subscription address page Keeping these in the root of the translations file so that they can be used in other places later --- config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index ca46fb5fc5..317b153b34 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1239,6 +1239,7 @@ en: state: State postcode: Postcode postcode_placeholder: eg. 3070 + suburb: Suburb state: State country: Country unauthorized: Unauthorized