mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Move directo translations from logic to I18n
This commit is contained in:
parent
6c328438e6
commit
035bb14d9f
4 changed files with 16 additions and 14 deletions
|
@ -92,15 +92,12 @@ module BookKeeping
|
|||
end
|
||||
|
||||
def description_in_language(price:, yearly:)
|
||||
en = language == 'en'
|
||||
registration_length = if yearly
|
||||
en ? 'year(s)' : 'aasta(t)'
|
||||
else
|
||||
en ? 'month(s)' : 'kuu(d)'
|
||||
end
|
||||
timeframe_string = yearly ? 'yearly' : 'monthly'
|
||||
locale_string = ".registrars.invoice_#{timeframe_string}_product_description"
|
||||
|
||||
registration = en ? 'registration' : 'registreerimine'
|
||||
".#{price.zone_name} #{registration}: #{price.duration.to_i} #{registration_length}"
|
||||
I18n.with_locale(language == 'en' ? 'en' : 'et') do
|
||||
I18n.t(locale_string, tld: ".#{price.zone_name}", length: price.duration.to_i)
|
||||
end
|
||||
end
|
||||
|
||||
def prepayment_for_all(lines)
|
||||
|
|
|
@ -118,10 +118,8 @@ class DirectoInvoiceForwardJob < Que::Job
|
|||
last_directo = [Setting.directo_monthly_number_last.presence.try(:to_i),
|
||||
min_directo].compact.max || 0
|
||||
|
||||
if max_directo && max_directo < (last_directo + invoice_count)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
return true if max_directo && max_directo < (last_directo + invoice_count)
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
en:
|
||||
registrars:
|
||||
invoice_yearly_product_description: '%{tld} registration: %{length} year(s)'
|
||||
invoice_monthly_product_description: '%{tld} registration: %{length} month(s)'
|
||||
activerecord:
|
||||
errors:
|
||||
models:
|
||||
|
@ -8,4 +11,4 @@ en:
|
|||
forbidden: is forbidden
|
||||
vat_rate:
|
||||
present: >-
|
||||
must be blank when a registrar is VAT-registered in the same country as registry
|
||||
must be blank when a registrar is VAT-registered in the same country as registry
|
||||
|
|
4
config/locales/registrars.et.yml
Normal file
4
config/locales/registrars.et.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
et:
|
||||
registrars:
|
||||
invoice_yearly_product_description: '%{tld} registration: %{length} year(s)'
|
||||
invoice_monthly_product_description: '%{tld} registration: %{length} month(s)'
|
Loading…
Add table
Add a link
Reference in a new issue