diff --git a/app/controllers/concerns/book_keeping.rb b/app/controllers/concerns/book_keeping.rb index 41cd4646e..f50393822 100644 --- a/app/controllers/concerns/book_keeping.rb +++ b/app/controllers/concerns/book_keeping.rb @@ -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) diff --git a/app/jobs/directo_invoice_forward_job.rb b/app/jobs/directo_invoice_forward_job.rb index 768c7db0b..a423ffc2e 100644 --- a/app/jobs/directo_invoice_forward_job.rb +++ b/app/jobs/directo_invoice_forward_job.rb @@ -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 diff --git a/config/locales/registrars.en.yml b/config/locales/registrars.en.yml index 609f9f94a..c5071c3f8 100644 --- a/config/locales/registrars.en.yml +++ b/config/locales/registrars.en.yml @@ -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 \ No newline at end of file + must be blank when a registrar is VAT-registered in the same country as registry diff --git a/config/locales/registrars.et.yml b/config/locales/registrars.et.yml new file mode 100644 index 000000000..4151183ea --- /dev/null +++ b/config/locales/registrars.et.yml @@ -0,0 +1,4 @@ +et: + registrars: + invoice_yearly_product_description: '%{tld} registration: %{length} year(s)' + invoice_monthly_product_description: '%{tld} registration: %{length} month(s)'