diff options
author | Mark Chao <mchao@gitlab.com> | 2018-08-08 14:38:39 +0800 |
---|---|---|
committer | Mark Chao <mchao@gitlab.com> | 2018-08-14 17:30:51 +0800 |
commit | f8ee861cd42b35ff5d35c18dafbe4d1c425af926 (patch) | |
tree | a0cda839964f56f22ebad65b7d8bafc72f0b799f | |
parent | bf88e9afe70e6589dd0c1c089a5a73c8d2b687c6 (diff) | |
download | gitlab-ce-f8ee861cd42b35ff5d35c18dafbe4d1c425af926.tar.gz |
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
-rw-r--r-- | .rubocop.yml | 2 | ||||
-rw-r--r-- | app/helpers/notifications_helper.rb | 10 | ||||
-rw-r--r-- | app/models/notification_setting.rb | 1 | ||||
-rw-r--r-- | locale/unfound_translations.rb | 16 |
4 files changed, 19 insertions, 10 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index a586190319b..9858bbe0ddd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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: diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 7ff201a321b..a185f2916d4 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -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 diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index c5d49bd00ca..1600acfc575 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -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 diff --git a/locale/unfound_translations.rb b/locale/unfound_translations.rb new file mode 100644 index 00000000000..0826d64049b --- /dev/null +++ b/locale/unfound_translations.rb @@ -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') |