Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve I18n pluralization to avoid errors with some calculators #1191

Merged
merged 3 commits into from
May 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= render 'spree/admin/shared/settings_checkout_tabs' %>

<% content_for :page_title do %>
<%= Spree::AdjustmentReason.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::AdjustmentReason) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<% end %>

<fieldset data-hook="reimbursements" class="no-border-bottom align-center">
<legend align="center"><%= Spree::Reimbursement.model_name.human(count: :other) %></legend>
<legend align="center"><%= plural_resource_name(Spree::Reimbursement) %></legend>
<% if @customer_return.reimbursements.any? %>
<%= render partial: 'reimbursements_table', locals: {reimbursements: @customer_return.reimbursements} %>
<% else %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<% end %>

<% content_for :page_title do %>
<i class="fa fa-arrow-right"></i> <%= Spree::CustomerReturn.model_name.human(count: :other) %>
<i class="fa fa-arrow-right"></i> <%= plural_resource_name(Spree::CustomerReturn) %>
<% end %>

<% if @customer_returns.any? %>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/log_entries/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<i class="fa fa-arrow-right"></i>
<%= Spree::Payment.model_name.human %>
<i class="fa fa-arrow-right"></i>
<%= Spree::LogEntry.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::LogEntry) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/option_types/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</fieldset>

<fieldset>
<legend><%= Spree::OptionValue.model_name.human(count: :other) %></legend>
<legend><%= plural_resource_name(Spree::OptionValue) %></legend>
<table class="index sortable" data-hook data-sortable-link="<%= update_values_positions_admin_option_types_url %>">
<thead data-hook="option_header">
<tr>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/option_types/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= Spree::OptionType.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::OptionType) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<fieldset class="no-border-bottom">
<legend><%= Spree::Payment.model_name.human(count: :other) %></legend>
<legend><%= plural_resource_name(Spree::Payment) %></legend>
<table class="index">
<thead>
<tr data-hook="payments_header">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= render 'spree/admin/shared/payments_tabs' %>

<% content_for :page_title do %>
<%= Spree::PaymentMethod.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::PaymentMethod) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if @payment.capture_events.exists? %>
<h3><%= Spree::PaymentCaptureEvent.model_name.human(count: :other) %></h3>
<h3><%= plural_resource_name(Spree::PaymentCaptureEvent) %></h3>
<table class="index" id="capture_events">
<thead>
<tr data-hook="payments_header">
Expand Down
6 changes: 3 additions & 3 deletions backend/app/views/spree/admin/payments/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<% end %>

<% content_for :page_title do %>
<i class="fa fa-arrow-right"></i> <%= Spree::Payment.model_name.human(count: :other) %>
<i class="fa fa-arrow-right"></i> <%= plural_resource_name(Spree::Payment) %>
<% end %>

<% if @order.outstanding_balance? %>
Expand All @@ -20,13 +20,13 @@
<% if @payments.any? %>

<fieldset data-hook="payment_list" class="no-border-bottom">
<legend align="center"><%= Spree::Payment.model_name.human(count: :other) %></legend>
<legend align="center"><%= plural_resource_name(Spree::Payment) %></legend>
<%= render :partial => 'list', :locals => { :payments => @payments } %>
</fieldset>

<% if @refunds.any? %>
<fieldset data-hook="payment_list" class="no-border-bottom">
<legend align="center"><%= Spree::Refund.model_name.human(count: :other) %></legend>
<legend align="center"><%= plural_resource_name(Spree::Refund) %></legend>
<%= render :partial => 'spree/admin/shared/refunds', :locals => { :refunds => @refunds, show_actions: true } %>
</fieldset>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<%= form_for @product, :url => admin_product_url(@product), :method => :put do |f| %>
<fieldset>
<legend align="center"><%= Spree::ProductProperty.model_name.human(count: :other) %></legend>
<legend align="center"><%= plural_resource_name(Spree::ProductProperty) %></legend>
<div class="add_product_properties" data-hook="add_product_properties"></div>

<div id="prototypes" data-hook></div>
Expand Down
4 changes: 2 additions & 2 deletions backend/app/views/spree/admin/products/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@
<div class="twelve columns alpha omega">
<div data-hook="admin_product_form_taxons">
<%= f.field_container :taxons do %>
<%= f.label :taxon_ids, Spree::Taxon.model_name.human(count: :other) %><br />
<%= f.label :taxon_ids, plural_resource_name(Spree::Taxon) %><br />
<%= f.hidden_field :taxon_ids, :value => @product.taxon_ids.join(',') %>
<% end %>
</div>

<div data-hook="admin_product_form_option_types">
<%= f.field_container :option_types do %>
<%= f.label :option_type_ids, Spree::OptionType.model_name.human(count: :other) %>
<%= f.label :option_type_ids, plural_resource_name(Spree::OptionType) %>
<%= f.hidden_field :option_type_ids, :value => @product.option_type_ids.join(',') %>
<% end %>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= Spree::Property.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::Property) %>
<% end %>

<% f.fields_for :product_properties do |properties_form| %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= Spree::PromotionCategory.model_name.human(count: :many) %>
<%= plural_resource_name(Spree::PromotionCategory) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/promotions/_actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= form_tag spree.admin_promotion_promotion_actions_path(@promotion), :remote => true, :id => 'new_promotion_action_form' do %>
<% options = options_for_select( Rails.application.config.spree.promotions.actions.map(&:name).map {|name| [ Spree.t("promotion_action_types.#{name.demodulize.underscore}.name"), name] } ) %>
<fieldset>
<legend align="center"><%= Spree::PromotionAction.model_name.human(count: :other) %></legend>
<legend align="center"><%= plural_resource_name(Spree::PromotionAction) %></legend>
<% if can?(:update, @promotion) %>
<div class="field">
<%= label_tag :action_type, Spree.t(:add_action_of_type)%>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/promotions/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= Spree::Promotion.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::Promotion) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="field alpha omega eight columns promo-rule-option-values">
<div class="param-prefix hidden" data-param-prefix="<%= param_prefix %>"></div>
<div class="four columns alpha"><%= label_tag nil, Spree::Product.model_name.human %></div>
<div class="three columns omega"><%= label_tag nil, Spree::OptionValue.model_name.human(count: :other) %></div>
<div class="three columns omega"><%= label_tag nil, plural_resource_name(Spree::OptionValue) %></div>
<div class="clear"></div>

<div class="js-promo-rule-option-values"></div>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/properties/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= Spree::Property.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::Property) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
6 changes: 3 additions & 3 deletions backend/app/views/spree/admin/prototypes/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="four columns">
<div id='properties' data-hook>
<%= f.field_container :property_ids do %>
<%= f.label :property_ids, Spree::Property.model_name.human(count: :other) %><br>
<%= f.label :property_ids, plural_resource_name(Spree::Property) %><br>
<%= f.select :property_ids, Spree::Property.all.map { |p| ["#{p.presentation} (#{p.name})", p.id] }, {}, { multiple: true, class: "select2 fullwidth" } %>
<% end %>
</div>
Expand All @@ -19,7 +19,7 @@
<div class="four columns">
<div id="option_types" data-hook>
<%= f.field_container :option_type_ids do %>
<%= f.label :option_type_ids, Spree::OptionType.model_name.human(count: :other) %><br>
<%= f.label :option_type_ids, plural_resource_name(Spree::OptionType) %><br>
<%= f.select :option_type_ids, Spree::OptionType.all.map { |ot| ["#{ot.presentation} (#{ot.name})", ot.id] }, {}, { multiple: true, class: "select2 fullwidth" } %>
<% end %>
</div>
Expand All @@ -28,7 +28,7 @@
<div class="four columns omega">
<div id='taxons' data-hook>
<%= f.field_container :taxon_ids do %>
<%= f.label :taxon_ids, Spree::Taxon.model_name.human(count: :other) %><br>
<%= f.label :taxon_ids, plural_resource_name(Spree::Taxon) %><br>
<%= f.select :taxon_ids, Spree::Taxon.all.map { |t| [t.name, t.id] }, {}, { multiple: true, class: "select2 fullwidth" } %>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/prototypes/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= Spree::Prototype.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::Prototype) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
4 changes: 2 additions & 2 deletions backend/app/views/spree/admin/prototypes/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<% if @prototype.option_types.present? %>
<h2><%= Spree::Variant.model_name.human(count: :other) %></h2>
<h2><%= plural_resource_name(Spree::Variant) %></h2>

<ul class="product-prototype-options">
<% @prototype.option_types.each do |ot| %>
<li class="option-type-field">
<b>
<%= check_box_tag "option_types[]", ot.id, (params[:option_types] || []).include?(ot.id.to_s), :id => "option_type_#{ot.id}", :class => "option-type" %>
<%= label_tag "option_type_#{ot.id}", ot.presentation %>
</b>
</b>
<ul class="option-type-values">
<% ot.option_values.each do |ov| %>
<li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= render 'spree/admin/shared/settings_checkout_tabs' %>

<% content_for :page_title do %>
<%= Spree::RefundReason.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::RefundReason) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= render 'spree/admin/shared/settings_checkout_tabs' %>

<% content_for :page_title do %>
<%= Spree::ReimbursementType.model_name.human(count: :other) %>
<%= plural_resource_name(Spree::ReimbursementType) %>
<% end %>

<table class="index" id='listing_reimbursement_types' data-hook>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Reimbursements' } %>

<% content_for :page_title do %>
<i class="fa fa-arrow-right"></i> <%= Spree::Reimbursement.model_name.human(count: :other) %>
<i class="fa fa-arrow-right"></i> <%= plural_resource_name(Spree::Reimbursement) %>
<% end %>

<% content_for :page_actions do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<% end %>

<% content_for :page_title do %>
<i class="fa fa-arrow-right"></i> <%= Spree::ReturnAuthorization.model_name.human(count: :other) %>
<i class="fa fa-arrow-right"></i> <%= plural_resource_name(Spree::ReturnAuthorization) %>
<% end %>

<% if @order.shipments.any?(&:shipped?) || @order.return_authorizations.any? %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render partial: 'spree/admin/shared/named_types/index', locals: {
page_title: Spree::ReturnReason.model_name.human(count: :other),
page_title: plural_resource_name(Spree::ReturnReason),
new_button_text: Spree.t(:new_rma_reason),
resource: Spree::ReturnReason
} %>
6 changes: 3 additions & 3 deletions backend/app/views/spree/admin/shared/_areas_tabs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<nav>
<ul class="tabs" data-hook="admin_settings_areas_tabs">
<% if can? :display, Spree::Zone %>
<%= settings_tab_item Spree::Zone.model_name.human(count: :other), spree.admin_zones_path %>
<%= settings_tab_item plural_resource_name(Spree::Zone), spree.admin_zones_path %>
<% end %>

<% if can? :display, Spree::Country %>
<%= settings_tab_item Spree::Country.model_name.human(count: :other), spree.admin_countries_path %>
<%= settings_tab_item plural_resource_name(Spree::Country), spree.admin_countries_path %>
<% end %>

<% if can?(:display, Spree::State) %>
<% if country = Spree::Country.find_by(iso: Spree::Config[:default_country_iso]) || Spree::Country.first %>
<%= settings_tab_item Spree::State.model_name.human(count: :other), spree.admin_country_states_path(country) %>
<%= settings_tab_item plural_resource_name(Spree::State), spree.admin_country_states_path(country) %>
<% end %>
<% end %>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= Spree.t(:no_resource, resource: resource.model_name.human(count: :other)) %>
<%= Spree.t(:no_resource, resource: plural_resource_name(resource)) %>
<% if can? :create, resource %>
<%= link_to Spree.t(:create_one), new_resource_url %>
<% end %>
8 changes: 4 additions & 4 deletions backend/app/views/spree/admin/shared/_order_submenu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
<% end %>

<li class="<%= "active" if current == "Shipments" %>" data-hook='admin_order_tabs_order_details'>
<%= link_to_with_icon 'edit', Spree::Shipment.model_name.human(count: :other), edit_admin_order_url(@order) %>
<%= link_to_with_icon 'edit', plural_resource_name(Spree::Shipment), edit_admin_order_url(@order) %>
</li>

<% if can? :display, Spree::Adjustment %>
<li class="<%= "active" if current == "Adjustments" %>" data-hook='admin_order_tabs_adjustments'>
<%= link_to_with_icon 'cogs', Spree::Adjustment.model_name.human(count: :other), admin_order_adjustments_url(@order) %>
<%= link_to_with_icon 'cogs', plural_resource_name(Spree::Adjustment), admin_order_adjustments_url(@order) %>
</li>
<% end %>

<% if can?(:display, Spree::Payment) %>
<li class="<%= "active" if current == "Payments" %>" data-hook='admin_order_tabs_payments'>
<%= link_to_with_icon 'credit-card', Spree::Payment.model_name.human(count: :other), admin_order_payments_url(@order) %>
<%= link_to_with_icon 'credit-card', plural_resource_name(Spree::Payment), admin_order_payments_url(@order) %>
</li>
<% end %>

Expand All @@ -49,7 +49,7 @@
<% if can? :display, Spree::CustomerReturn %>
<% if @order.completed? %>
<li class="<%= "active" if current == "Customer Returns" %>">
<%= link_to_with_icon 'download', Spree::CustomerReturn.model_name.human(count: :other), admin_order_customer_returns_url(@order) %>
<%= link_to_with_icon 'download', plural_resource_name(Spree::CustomerReturn), admin_order_customer_returns_url(@order) %>
</li>
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<nav>
<ul class="tabs" data-hook="admin_settings_payments_tabs">
<% if can?(:display, Spree::PaymentMethod) %>
<%= settings_tab_item Spree::PaymentMethod.model_name.human(count: :other), spree.admin_payment_methods_path %>
<%= settings_tab_item plural_resource_name(Spree::PaymentMethod), spree.admin_payment_methods_path %>
<% end %>
</ul>
</nav>
Expand Down
8 changes: 4 additions & 4 deletions backend/app/views/spree/admin/shared/_product_tabs.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= Spree::Product.model_name.human(count: :other) %> &#x2f; <%= @product.name %>
<%= plural_resource_name(Spree::Product) %> &#x2f; <%= @product.name %>
<% end %>

<% content_for :tabs do %>
Expand All @@ -12,13 +12,13 @@
<%= link_to_with_icon 'picture-o', Spree.t(:images), spree.admin_product_images_url(@product) %>
<% end if can?(:admin, Spree::Image) %>
<%= content_tag :li, :class => ('active' if current == 'Variants') do %>
<%= link_to_with_icon 'th-large', Spree::Variant.model_name.human(count: :other), spree.admin_product_variants_url(@product) %>
<%= link_to_with_icon 'th-large', plural_resource_name(Spree::Variant), spree.admin_product_variants_url(@product) %>
<% end if can?(:admin, Spree::Variant) %>
<%= content_tag :li, :class => ('active' if current == 'Prices') do %>
<%= link_to_with_icon 'money', Spree::Price.model_name.human(count: :other), spree.admin_product_prices_url(@product) %>
<%= link_to_with_icon 'money', plural_resource_name(Spree::Price), spree.admin_product_prices_url(@product) %>
<% end if can?(:admin, Spree::Price) %>
<%= content_tag :li, :class => ('active' if current == 'Product Properties') do %>
<%= link_to_with_icon 'tasks', Spree::ProductProperty.model_name.human(count: :other), spree.admin_product_product_properties_url(@product) %>
<%= link_to_with_icon 'tasks', plural_resource_name(Spree::ProductProperty), spree.admin_product_product_properties_url(@product) %>
<% end if can?(:admin, Spree::ProductProperty) %>
<%= content_tag :li, :class => ('active' if current == 'Stock Management') do %>
<%= link_to_with_icon 'cubes', Spree.t(:stock_management), spree.admin_product_stock_url(@product) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<nav>
<ul class="tabs" data-hook="admin_settings_checkout_tabs">
<% if can?(:display, Spree::RefundReason) %>
<%= settings_tab_item Spree::RefundReason.model_name.human(count: :other), spree.admin_refund_reasons_path %>
<%= settings_tab_item plural_resource_name(Spree::RefundReason), spree.admin_refund_reasons_path %>
<% end %>

<% if can?(:display, Spree::ReimbursementType) %>
<%= settings_tab_item Spree::ReimbursementType.model_name.human(count: :other), spree.admin_reimbursement_types_path %>
<%= settings_tab_item plural_resource_name(Spree::ReimbursementType), spree.admin_reimbursement_types_path %>
<% end %>

<% if can?(:display, Spree::ReturnReason) %>
<%= settings_tab_item Spree::ReturnReason.model_name.human(count: :other), spree.admin_return_reasons_path %>
<%= settings_tab_item plural_resource_name(Spree::ReturnReason), spree.admin_return_reasons_path %>
<% end %>

<% if can?(:display, Spree::AdjustmentReason) %>
<%= settings_tab_item Spree::AdjustmentReason.model_name.human(count: :other), spree.admin_adjustment_reasons_path %>
<%= settings_tab_item plural_resource_name(Spree::AdjustmentReason), spree.admin_adjustment_reasons_path %>
<% end %>
</ul>
</nav>
Expand Down
6 changes: 3 additions & 3 deletions backend/app/views/spree/admin/shared/_shipping_tabs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<nav>
<ul class="tabs" data-hook="admin_settings_shipping_tabs">
<% if can?(:display, Spree::ShippingMethod) %>
<%= settings_tab_item Spree::ShippingMethod.model_name.human(count: :other), spree.admin_shipping_methods_path %>
<%= settings_tab_item plural_resource_name(Spree::ShippingMethod), spree.admin_shipping_methods_path %>
<% end %>

<% if can?(:display, Spree::ShippingCategory) %>
<%= settings_tab_item Spree::ShippingCategory.model_name.human(count: :other), spree.admin_shipping_categories_path %>
<%= settings_tab_item plural_resource_name(Spree::ShippingCategory), spree.admin_shipping_categories_path %>
<% end %>

<% if can?(:display, Spree::StockLocation) %>
<%= settings_tab_item Spree::StockLocation.model_name.human(count: :other), spree.admin_stock_locations_path %>
<%= settings_tab_item plural_resource_name(Spree::StockLocation), spree.admin_stock_locations_path %>
<% end %>
</ul>
</nav>
Expand Down
Loading