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
|
end
|
||||||
|
|
||||||
def description_in_language(price:, yearly:)
|
def description_in_language(price:, yearly:)
|
||||||
en = language == 'en'
|
timeframe_string = yearly ? 'yearly' : 'monthly'
|
||||||
registration_length = if yearly
|
locale_string = ".registrars.invoice_#{timeframe_string}_product_description"
|
||||||
en ? 'year(s)' : 'aasta(t)'
|
|
||||||
else
|
|
||||||
en ? 'month(s)' : 'kuu(d)'
|
|
||||||
end
|
|
||||||
|
|
||||||
registration = en ? 'registration' : 'registreerimine'
|
I18n.with_locale(language == 'en' ? 'en' : 'et') do
|
||||||
".#{price.zone_name} #{registration}: #{price.duration.to_i} #{registration_length}"
|
I18n.t(locale_string, tld: ".#{price.zone_name}", length: price.duration.to_i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepayment_for_all(lines)
|
def prepayment_for_all(lines)
|
||||||
|
|
|
@ -118,10 +118,8 @@ class DirectoInvoiceForwardJob < Que::Job
|
||||||
last_directo = [Setting.directo_monthly_number_last.presence.try(:to_i),
|
last_directo = [Setting.directo_monthly_number_last.presence.try(:to_i),
|
||||||
min_directo].compact.max || 0
|
min_directo].compact.max || 0
|
||||||
|
|
||||||
if max_directo && max_directo < (last_directo + invoice_count)
|
return true if max_directo && max_directo < (last_directo + invoice_count)
|
||||||
true
|
|
||||||
else
|
false
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
en:
|
en:
|
||||||
|
registrars:
|
||||||
|
invoice_yearly_product_description: '%{tld} registration: %{length} year(s)'
|
||||||
|
invoice_monthly_product_description: '%{tld} registration: %{length} month(s)'
|
||||||
activerecord:
|
activerecord:
|
||||||
errors:
|
errors:
|
||||||
models:
|
models:
|
||||||
|
@ -8,4 +11,4 @@ en:
|
||||||
forbidden: is forbidden
|
forbidden: is forbidden
|
||||||
vat_rate:
|
vat_rate:
|
||||||
present: >-
|
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