Extract translations from mailers and helpers

This commit is contained in:
Julius Pabrinkis
2017-05-11 12:17:08 +01:00
committed by Maikel Linke
parent 9971c9f923
commit 5caaec8ef3
7 changed files with 35 additions and 20 deletions

View File

@@ -48,7 +48,7 @@ module EnterprisesHelper
def enterprise_type_name(enterprise)
if enterprise.sells == 'none'
enterprise.producer_profile_only ? 'Profile' : 'Supplier Only'
enterprise.producer_profile_only ? I18n.t(:profile) : I18n.t(:supplier_only)
else
"Has Shopfront"
end
@@ -56,7 +56,7 @@ module EnterprisesHelper
def enterprise_confirm_delete_message(enterprise)
if enterprise.supplied_products.present?
"This will also delete the #{pluralize enterprise.supplied_products.count, 'product'} that this enterprise supplies. Are you sure you want to continue?"
I18n.t(:enterprise_confirm_delete_message, product: pluralize(enterprise.supplied_products.count, 'product'))
else
t(:are_you_sure)
end

View File

@@ -85,14 +85,14 @@ module OrderCyclesHelper
disabled_message = nil
if options[:shipping_and_payment_methods] && (e.shipping_methods.empty? || e.payment_methods.available.empty?)
if e.shipping_methods.empty? && e.payment_methods.available.empty?
disabled_message = 'no shipping or payment methods'
disabled_message = I18n.t(:no_shipping_or_payment)
elsif e.shipping_methods.empty?
disabled_message = 'no shipping methods'
disabled_message = I18n.t(:no_shipping)
elsif e.payment_methods.available.empty?
disabled_message = 'no payment methods'
disabled_message = I18n.t(:no_payment)
end
elsif options[:confirmed] && !e.confirmed?
disabled_message = 'unconfirmed'
disabled_message = I18n.t(:unconfirmed)
end
if disabled_message

View File

@@ -15,9 +15,9 @@ module Spree
end
def product_variant_unit_options
[['Weight', 'weight'],
['Volume', 'volume'],
['Items', 'items']]
[[I18n.t(:weight), 'weight'],
[I18n.t(:volume), 'volume'],
[I18n.t(:items), 'items']]
end
end
end

View File

@@ -25,8 +25,8 @@ module Spree
end
def xero_report_types
[['Summary', 'summary'],
['Detailed', 'detailed']]
[[I18n.t(:summary), 'summary'],
[I18n.t(:detailed), 'detailed']]
end
def currency_symbol

View File

@@ -10,7 +10,7 @@ class ProducerMailer < Spree::BaseMailer
@total = total_from_line_items(line_items)
@tax_total = tax_total_from_line_items(line_items)
subject = "[#{Spree::Config.site_name}] Order cycle report for #{producer.name}"
subject = "[#{Spree::Config.site_name}] #{I18n.t('producer_mailer.order_cycle.subject', producer: producer.name)}"
if has_orders? order_cycle, producer
mail(to: @producer.email,

View File

@@ -82,6 +82,9 @@ en:
subject: "Please confirm the email address for %{enterprise}"
welcome:
subject: "%{enterprise} is now on %{sitename}"
producer_mailer:
order_cycle:
subject: "Order cycle report for %{producer}"
home: "OFN"
title: Open Food Network
welcome_to: 'Welcome to '
@@ -143,6 +146,14 @@ en:
dashboard: Dashboard
undefined: undefined
unused: unused
admin_and_handling: Admin & Handling
profile: Profile
supplier_only: Supplier Only
weight: Weight
volume: Volume
items: Items
summary: Summary
detailed: Detailed
'yes': "Yes"
'no': "No"
'y': 'Y'
@@ -643,10 +654,6 @@ en:
enterprise_issues:
create_new: Create New
resend_email: Resend Email
no_shipping: no shipping methods
no_payment: no payment methods
no_shipping_or_payment: no shipping or payment methods
unconfirmed: unconfirmed
has_no_payment_methods: "%{enterprise} currently has no payment methods"
has_no_shipping_methods: "%{enterprise} currently has no shipping methods"
email_confirmation: "Email confirmation is pending. We've sent a confirmation email to #{email}."
@@ -798,7 +805,14 @@ en:
terms_of_service: "Terms of service"
on_demand: On demand
none: None
<<<<<<< HEAD
not_allowed: Not allowed
=======
no_shipping: no shipping methods
no_payment: no payment methods
no_shipping_or_payment: no shipping or payment methods
unconfirmed: unconfirmed
>>>>>>> Extract translations from mailers and helpers
label_shops: "Shops"
label_map: "Map"
@@ -1251,6 +1265,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
failed_to_create_enterprise: "Failed to create your enterprise."
failed_to_create_enterprise_unknown: "Failed to create your enterprise.\nPlease ensure all fields are completely filled out."
failed_to_update_enterprise_unknown: "Failed to update your enterprise.\nPlease ensure all fields are completely filled out."
enterprise_confirm_delete_message: "This will also delete the %{product} that this enterprise supplies. Are you sure you want to continue?"
order_not_saved_yet: "Your order hasn't been saved yet. Give us a few seconds to finish!"
filter_by: "Filter by"
hide_filters: "Hide filters"

View File

@@ -30,13 +30,13 @@ module OpenFoodNetwork
def issues_summary(opts={})
if !opts[:confirmation_only] && !shipping_methods_ok? && !payment_methods_ok?
I18n.t('admin.enterprise_issues.no_shipping_or_payment')
I18n.t(:no_shipping_or_payment)
elsif !opts[:confirmation_only] && !shipping_methods_ok?
I18n.t('admin.enterprise_issues.no_shipping')
I18n.t(:no_shipping)
elsif !opts[:confirmation_only] && !payment_methods_ok?
I18n.t('admin.enterprise_issues.no_payment')
I18n.t(:no_payment)
elsif !confirmed?
I18n.t('admin.enterprise_issues.unconfirmed')
I18n.t(:unconfirmed)
end
end