Skip to content

Commit

Permalink
Follow-up cffdc2c - Fixes #4875 - Translation Management Improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikklein committed Mar 25, 2024
1 parent f469434 commit 6e066c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
8 changes: 2 additions & 6 deletions app/assets/javascripts/app/controllers/translation.coffee
Expand Up @@ -329,18 +329,14 @@ class TranslationModal extends App.ControllerModal
url: "#{@apiPath}/translations/upsert",
data: JSON.stringify(params),
processData: true,
success: =>
success: (data) =>
@close()
@successCallback()

# Show toast if neeeded (means that in string inside the current user language was changed).
# Later we should add real subscription handling for this situation in the new tech stack.
currentLocale = App.i18n.get()
if params.locale == currentLocale
@notify(
type: 'success'
msg: App.i18n.translateContent('To see the updated translation, please reload your browser.')
)
App.i18n.setMap(data.source, data.target)

})

Expand Down
3 changes: 2 additions & 1 deletion app/services/service/translation/upsert.rb
Expand Up @@ -15,7 +15,8 @@ def execute
translation = Translation.find_source(locale, source)

if translation
return translation.update!(target: target)
translation.update!(target: target)
return translation
end

Translation.create!(locale: locale, source: source, target: target, is_synchronized_from_codebase: false)
Expand Down
4 changes: 0 additions & 4 deletions i18n/zammad.pot
Expand Up @@ -13887,10 +13887,6 @@ msgstr ""
msgid "To revert back to the default payload, simply turn off the \"Custom Payload\" switch above."
msgstr ""

#: app/assets/javascripts/app/controllers/translation.coffee
msgid "To see the updated translation, please reload your browser."
msgstr ""

#: app/assets/javascripts/app/models/text_module.coffee
msgid "To select placeholders from a list, just enter \"::\"."
msgstr ""
Expand Down

0 comments on commit 6e066c4

Please sign in to comment.