Commit ae1487a8 authored by Martin Wortschack's avatar Martin Wortschack Committed by Kamil Trzciński

Externalize strings in app/workers

- email_receiver_worker
- object_storage/migrate_uploads_worker
- Update PO file
parent 37581695
...@@ -53,7 +53,7 @@ module ApplicationWorker ...@@ -53,7 +53,7 @@ module ApplicationWorker
schedule = now + delay.to_i schedule = now + delay.to_i
if schedule <= now if schedule <= now
raise ArgumentError, 'The schedule time must be in the future!' raise ArgumentError, _('The schedule time must be in the future!')
end end
Sidekiq::Client.push_bulk('class' => self, 'args' => args_list, 'at' => schedule) Sidekiq::Client.push_bulk('class' => self, 'args' => args_list, 'at' => schedule)
......
...@@ -24,22 +24,22 @@ class EmailReceiverWorker ...@@ -24,22 +24,22 @@ class EmailReceiverWorker
reason = reason =
case error case error
when Gitlab::Email::UnknownIncomingEmail when Gitlab::Email::UnknownIncomingEmail
"We couldn't figure out what the email is for. Please create your issue or comment through the web interface." s_("EmailError|We couldn't figure out what the email is for. Please create your issue or comment through the web interface.")
when Gitlab::Email::SentNotificationNotFoundError when Gitlab::Email::SentNotificationNotFoundError
"We couldn't figure out what the email is in reply to. Please create your comment through the web interface." s_("EmailError|We couldn't figure out what the email is in reply to. Please create your comment through the web interface.")
when Gitlab::Email::ProjectNotFound when Gitlab::Email::ProjectNotFound
"We couldn't find the project. Please check if there's any typo." s_("EmailError|We couldn't find the project. Please check if there's any typo.")
when Gitlab::Email::EmptyEmailError when Gitlab::Email::EmptyEmailError
can_retry = true can_retry = true
"It appears that the email is blank. Make sure your reply is at the top of the email, we can't process inline replies." s_("EmailError|It appears that the email is blank. Make sure your reply is at the top of the email, we can't process inline replies.")
when Gitlab::Email::UserNotFoundError when Gitlab::Email::UserNotFoundError
"We couldn't figure out what user corresponds to the email. Please create your comment through the web interface." s_("EmailError|We couldn't figure out what user corresponds to the email. Please create your comment through the web interface.")
when Gitlab::Email::UserBlockedError when Gitlab::Email::UserBlockedError
"Your account has been blocked. If you believe this is in error, contact a staff member." s_("EmailError|Your account has been blocked. If you believe this is in error, contact a staff member.")
when Gitlab::Email::UserNotAuthorizedError when Gitlab::Email::UserNotAuthorizedError
"You are not allowed to perform this action. If you believe this is in error, contact a staff member." s_("EmailError|You are not allowed to perform this action. If you believe this is in error, contact a staff member.")
when Gitlab::Email::NoteableNotFoundError when Gitlab::Email::NoteableNotFoundError
"The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member." s_("EmailError|The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member.")
when Gitlab::Email::InvalidAttachment when Gitlab::Email::InvalidAttachment
error.message error.message
when Gitlab::Email::InvalidRecordError when Gitlab::Email::InvalidRecordError
......
...@@ -20,7 +20,7 @@ module ObjectStorage ...@@ -20,7 +20,7 @@ module ObjectStorage
end end
def to_s def to_s
success? ? "Migration successful." : "Error while migrating #{upload.id}: #{error.message}" success? ? _("Migration successful.") : _("Error while migrating %{upload_id}: %{error_message}") % { upload_id: upload.id, error_message: error.message }
end end
end end
...@@ -47,7 +47,7 @@ module ObjectStorage ...@@ -47,7 +47,7 @@ module ObjectStorage
end end
def header(success, failures) def header(success, failures)
"Migrated #{success.count}/#{success.count + failures.count} files." _("Migrated %{success_count}/%{total_count} files.") % { success_count: success.count, total_count: success.count + failures.count }
end end
def failures(failures) def failures(failures)
...@@ -75,9 +75,9 @@ module ObjectStorage ...@@ -75,9 +75,9 @@ module ObjectStorage
model_types = uploads.map(&:model_type).uniq model_types = uploads.map(&:model_type).uniq
model_has_mount = mounted_as.nil? || model_class.uploaders[mounted_as] == uploader_class model_has_mount = mounted_as.nil? || model_class.uploaders[mounted_as] == uploader_class
raise(SanityCheckError, "Multiple uploaders found: #{uploader_types}") unless uploader_types.count == 1 raise(SanityCheckError, _("Multiple uploaders found: %{uploader_types}") % { uploader_types: uploader_types }) unless uploader_types.count == 1
raise(SanityCheckError, "Multiple model types found: #{model_types}") unless model_types.count == 1 raise(SanityCheckError, _("Multiple model types found: %{model_types}") % { model_types: model_types }) unless model_types.count == 1
raise(SanityCheckError, "Mount point #{mounted_as} not found in #{model_class}.") unless model_has_mount raise(SanityCheckError, _("Mount point %{mounted_as} not found in %{model_class}.") % { mounted_as: mounted_as, model_class: model_class }) unless model_has_mount
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
...@@ -110,9 +110,9 @@ module ObjectStorage ...@@ -110,9 +110,9 @@ module ObjectStorage
return if args.count == 4 return if args.count == 4
case args.count case args.count
when 3 then raise SanityCheckError, "Job is missing the `model_type` argument." when 3 then raise SanityCheckError, _("Job is missing the `model_type` argument.")
else else
raise SanityCheckError, "Job has wrong arguments format." raise SanityCheckError, _("Job has wrong arguments format.")
end end
end end
......
...@@ -3184,6 +3184,30 @@ msgstr "" ...@@ -3184,6 +3184,30 @@ msgstr ""
msgid "Email patch" msgid "Email patch"
msgstr "" msgstr ""
msgid "EmailError|It appears that the email is blank. Make sure your reply is at the top of the email, we can't process inline replies."
msgstr ""
msgid "EmailError|The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member."
msgstr ""
msgid "EmailError|We couldn't figure out what the email is for. Please create your issue or comment through the web interface."
msgstr ""
msgid "EmailError|We couldn't figure out what the email is in reply to. Please create your comment through the web interface."
msgstr ""
msgid "EmailError|We couldn't figure out what user corresponds to the email. Please create your comment through the web interface."
msgstr ""
msgid "EmailError|We couldn't find the project. Please check if there's any typo."
msgstr ""
msgid "EmailError|You are not allowed to perform this action. If you believe this is in error, contact a staff member."
msgstr ""
msgid "EmailError|Your account has been blocked. If you believe this is in error, contact a staff member."
msgstr ""
msgid "Emails" msgid "Emails"
msgstr "" msgstr ""
...@@ -3508,6 +3532,9 @@ msgstr "" ...@@ -3508,6 +3532,9 @@ msgstr ""
msgid "Error while loading the merge request. Please try again." msgid "Error while loading the merge request. Please try again."
msgstr "" msgstr ""
msgid "Error while migrating %{upload_id}: %{error_message}"
msgstr ""
msgid "Error with Akismet. Please check the logs for more info." msgid "Error with Akismet. Please check the logs for more info."
msgstr "" msgstr ""
...@@ -4679,6 +4706,12 @@ msgstr "" ...@@ -4679,6 +4706,12 @@ msgstr ""
msgid "Job has been successfully erased!" msgid "Job has been successfully erased!"
msgstr "" msgstr ""
msgid "Job has wrong arguments format."
msgstr ""
msgid "Job is missing the `model_type` argument."
msgstr ""
msgid "Job is stuck. Check runners." msgid "Job is stuck. Check runners."
msgstr "" msgstr ""
...@@ -5262,6 +5295,12 @@ msgstr "" ...@@ -5262,6 +5295,12 @@ msgstr ""
msgid "Metrics|Unexpected metrics data response from prometheus endpoint" msgid "Metrics|Unexpected metrics data response from prometheus endpoint"
msgstr "" msgstr ""
msgid "Migrated %{success_count}/%{total_count} files."
msgstr ""
msgid "Migration successful."
msgstr ""
msgid "Milestone" msgid "Milestone"
msgstr "" msgstr ""
...@@ -5355,12 +5394,21 @@ msgstr "" ...@@ -5355,12 +5394,21 @@ msgstr ""
msgid "Most stars" msgid "Most stars"
msgstr "" msgstr ""
msgid "Mount point %{mounted_as} not found in %{model_class}."
msgstr ""
msgid "Move" msgid "Move"
msgstr "" msgstr ""
msgid "Move issue" msgid "Move issue"
msgstr "" msgstr ""
msgid "Multiple model types found: %{model_types}"
msgstr ""
msgid "Multiple uploaders found: %{uploader_types}"
msgstr ""
msgid "Name" msgid "Name"
msgstr "" msgstr ""
...@@ -8307,6 +8355,9 @@ msgstr "" ...@@ -8307,6 +8355,9 @@ msgstr ""
msgid "The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request." msgid "The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request."
msgstr "" msgstr ""
msgid "The schedule time must be in the future!"
msgstr ""
msgid "The snippet can be accessed without any authentication." msgid "The snippet can be accessed without any authentication."
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment