Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/services/discourse_translator/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ def self.access_token
end

def self.save_translation(translatable, target_locale_sym = I18n.locale)
translation = yield
begin
translation = yield
rescue Timeout::Error
raise TranslatorError.new(I18n.t("translator.api_timeout"))
end
translatable.set_translation(target_locale_sym, translation)
translation
end
Expand Down
1 change: 1 addition & 0 deletions config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ en:
not_supported: "This language is not supported by the translator."
too_long: "This post is too long to be translated by the translator."
not_available: "The translator service is currently not available."
api_timeout: "The translator service took too long to respond. Please try again later."
amazon:
invalid_credentials: "The provided credentials for AWS translate are invalid."

Expand Down
Loading