Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add Supported Locales in Admin Panel UI

Damian Legawiec4280bc63073f
diff --git a/backend/app/views/spree/admin/stores/_form.html.erb b/backend/app/views/spree/admin/stores/_form.html.erb
index 753c1e106c..b885d8f938 100644
--- a/backend/app/views/spree/admin/stores/_form.html.erb
+++ b/backend/app/views/spree/admin/stores/_form.html.erb
@@ -132,7 +132,7 @@
</div>
<div class="card-body">
<%= f.field_container :default_currency, class: ['form-group'] do %>
- <%= f.label :default_currency, Spree.t(:currency) %>
+ <%= f.label :default_currency %>
<%= f.select :default_currency, currency_options(@store.default_currency), {}, { class: 'select2' } %>
<%= f.error_message_on :default_currency %>
<% end %>
@@ -150,15 +150,20 @@
<%= f.error_message_on :checkout_zone_id %>
<% end %>
<%= f.field_container :default_locale, class: ['form-group'] do %>
- <%= f.label :default_locale, Spree.t('i18n.language') %>
+ <%= f.label :default_locale %>
<%= f.select :default_locale, options_from_collection_for_select(all_locales_options, :last, :first, @store.default_locale || I18n.locale), {}, { class: 'select2' } %>
<%= f.error_message_on :default_locale %>
<% unless defined?(SpreeI18n) %>
<small class="form-text text-muted">
- <%= raw(Spree.t('store_form.languages_help')) %>
+ <%= raw(Spree.t('store_form.locales_help')) %>
</small>
<% end %>
<% end %>
+ <%= f.field_container :supported_locales, class: ['form-group'] do %>
+ <%= f.label :supported_locales, Spree.t(:supported_locales) %>
+ <%= f.select :supported_locales, options_from_collection_for_select(all_locales_options, :last, :first, @store.supported_locales&.split(',')), {}, { multiple: true, class: 'select2' } %>
+ <%= f.error_message_on :supported_locales %>
+ <% end %>
<%= f.field_container :default_country_id, class: ['form-group'] do %>
<%= f.label :default_country_id, Spree.t('i18n.default_country') %>
<%= f.select :default_country_id, options_from_collection_for_select(@countries, :id, :name, @store.default_country_id || Spree::Config[:default_country_id]), {}, { class: 'select2' } %>
diff --git a/backend/app/views/spree/admin/stores/index.html.erb b/backend/app/views/spree/admin/stores/index.html.erb
index d66abc45d9..2f5d885333 100644
--- a/backend/app/views/spree/admin/stores/index.html.erb
+++ b/backend/app/views/spree/admin/stores/index.html.erb
@@ -12,7 +12,8 @@
<thead>
<th><%= Spree.t(:name) %></th>
<th><%= Spree.t(:url) %></th>
- <th><%= Spree.t(:currency) %></th>
+ <th><%= Spree.t(:supported_currencies) %></th>
+ <th><%= Spree.t(:supported_locales) %></th>
<th><%= Spree.t(:default) %>?</th>
<th data-hook="admin_stores_index_header_actions" class="actions"></th>
<thead>
@@ -21,7 +22,8 @@
<tr>
<td><%= store.unique_name %></td>
<td><%= link_to store.url, store.formatted_url, target: :blank %></td>
- <td><%= store.default_currency %></td>
+ <td><%= store.supported_currencies_list.map(&:iso_code).join(', ') %></td>
+ <td><%= store.supported_locales_list.map {|l| locale_presentation(l).first }.join(', ') %></td>
<td><%= active_badge(store.default) %></td>
<td class="actions actions-2 text-right" data-hook="admin_stores_index_row_actions">
<%= link_to_edit_url spree.edit_admin_store_path(store), no_text: true if can?(:edit, store) %>
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index 99886d9eb6..7c32b095ae 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -1613,9 +1613,9 @@ en:
unable_to_delete: Unable to delete store.
store_form:
code_help: "Store unique identifier, which is an abbreviated version of the store’s name (used as the layout directory name, and also helpful for separating templates by store)"
- checkout_zone_help: "Selecting a Zone will limit customers on Checkout to Addresses in Countries or States in that Zone.
+ checkout_zone_help: "Selecting zone will limit to which Countries or States products are shipped.
For more information <a href='https://guides.spreecommerce.org/user/configuration/configuring_geography.html#zones' target='_blank' class='alert-link'>please see documentation</a>"
- languages_help: "Install <a href='https://github.com/spree-contrib/spree_i18n target='_blank' class='alert-link'>Spree I18n extension</a> to add more languages"
+ locales_help: "Install <a href='https://github.com/spree-contrib/spree_i18n target='_blank' class='alert-link'>Spree I18n extension</a> to add more locales"
social_help: "If you want to link to your social accounts in the footer part of your website please fill below fields"
default_country_help: "This is the Country that will be pre-selected on the Checkout Address form"
footer_help: "This content is visible in the footer section of your Store"
@@ -1672,6 +1672,7 @@ en:
summary: Summary
supported_currencies: Supported Currencies
supported_currencies_long: A comma separated list of supported currencies
+ supported_locales: Supported Locales
tax: Tax
tax_included: "Tax (incl.)"
tax_categories: Tax Categories