Move N_ calls into separate files

These are dynamic translations, so has to be marked explicitly using `N_`,
but they are not used in runtime, so can exist in separate file.
https://github.com/grosser/gettext_i18n_rails#unfound-translations-with-rake-gettextfind
This commit is contained in:
Mark Chao 2018-08-08 14:38:39 +08:00
parent bf88e9afe7
commit f8ee861cd4
4 changed files with 19 additions and 10 deletions

View File

@ -48,6 +48,8 @@ Naming/FileName:
- 'qa/bin/*'
- 'config/**/*'
- 'lib/generators/**/*'
- 'locale/unfound_translations.rb'
- 'ee/locale/unfound_translations.rb'
- 'ee/lib/generators/**/*'
IgnoreExecutableScripts: true
AllowedAcronyms:

View File

@ -88,16 +88,6 @@ module NotificationsHelper
when :success_pipeline
s_('NotificationEvent|Successful pipeline')
else
N_('NotificationEvent|New note')
N_('NotificationEvent|New issue')
N_('NotificationEvent|Reopen issue')
N_('NotificationEvent|Close issue')
N_('NotificationEvent|Reassign issue')
N_('NotificationEvent|New merge request')
N_('NotificationEvent|Close merge request')
N_('NotificationEvent|Reassign merge request')
N_('NotificationEvent|Merge merge request')
N_('NotificationEvent|Failed pipeline')
s_(event.to_s.humanize)
end
end

View File

@ -45,6 +45,7 @@ class NotificationSetting < ActiveRecord::Base
:success_pipeline
].freeze
# Update unfound_translations.rb when events are changed
def self.email_events(source = nil)
EMAIL_EVENTS
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
# Dynamic translations which needs to be marked by `N_` so they can be found by `rake gettext:find`, see:
# https://github.com/grosser/gettext_i18n_rails#unfound-translations-with-rake-gettextfind
# NotificationSetting.email_events
N_('NotificationEvent|New note')
N_('NotificationEvent|New issue')
N_('NotificationEvent|Reopen issue')
N_('NotificationEvent|Close issue')
N_('NotificationEvent|Reassign issue')
N_('NotificationEvent|New merge request')
N_('NotificationEvent|Close merge request')
N_('NotificationEvent|Reassign merge request')
N_('NotificationEvent|Merge merge request')
N_('NotificationEvent|Failed pipeline')