   resetItem: (e) ->
     e.preventDefault()
     @hasChanges = true
-    field       = $(e.target).closest('tr').find('.js-Item')
-    id          = field.data('id')
-    source      = field.data('source')
-    initial     = field.data('initial')
-    format      = field.data('format')
-
-    # update runtime if same language is used
-    if App.i18n.get() is @locale
-      App.i18n.setMap(source, initial, format)
-
-    # locale reset
-    field.val(initial)
-    @updateRow(id)
+    params = @getAttributes(e)
 
     # remote reset
-    params =
-      id:     id
-      target: initial
-
-    @ajax(
-      id:          'translations'
-      type:        'PUT'
-      url:         "#{@apiPath}/translations/#{id}"
-      data:        JSON.stringify(params)
-      processData: false
-      success: (data, status, xhr) ->
-        App.Event.trigger('i18n:translation_update')
-    )
+    params.target = params.initial
+    @updateOnServer(params, 'i18n:translation_update')
 
   updateItem: (e) ->
     e.preventDefault()
     @hasChanges = true
-    field  = $(e.target).closest('tr').find('.js-Item')
-    id     = field.data('id')
-    source = field.data('source')
-    format = field.data('format')
-    target = field.val()
-    return if !target
+    params = @getAttributes(e)
+    return if !params.target
 
     # local update
-    @updateRow(id)
-
-    # update runtime if same language is used
-    if App.i18n.get() is @locale
-      App.i18n.setMap(source, target, format)
+    @updateRow(params.id)
 
     # remote update
-    params =
-      id:     id
-      target: target
-
-    @ajax(
-      id:          'translations'
-      type:        'PUT'
-      url:         "#{@apiPath}/translations/#{id}"
-      data:        JSON.stringify(params)
-      processData: false
-      success: (data, status, xhr) ->
-        App.Event.trigger('i18n:translation_update')
-    )
+    @updateOnServer(params)
 
   updateRow: (id) =>
     field   = @$("[data-id=#{id}]")

      data:        JSON.stringify(params)
      processData: false
      success: (data, status, xhr) ->
        App.Event.trigger('i18n:translation_update')
    )

  same: (e) =>
    e.preventDefault()
    @hasChanges = true
    field  = $(e.target).closest('tr').find('.js-Item')
    source = field.data('source')

    # remove from not translated list
    $(e.target).closest('tr').remove()

    # local update
    App.i18n.removeNotTranslated(@locale, source)

    # update runtime if same language is used
    if App.i18n.get() is @locale
      App.i18n.setMap(source, source, 'string')

    # remote update
    params =
      locale:         @locale
      source:         source
      target:         source
      target_initial: ''

    @ajax(
      id:          'translations'
      type:        'POST'
      url:         @apiPath + '/translations'
      data:        JSON.stringify(params)
      processData: false
      success: (data, status, xhr) ->
        App.Event.trigger('i18n:translation_update')
    )

class TranslationList extends App.Controller
  hasChanges: false
  events:
    'blur .js-translated input':          'updateItem'
    'click .js-translated .js-Reset':     'resetItem'

  constructor: ->
    super

      message:   'Pushing translations to i18n.zammad.com'
      container: @el.closest('.content')
    )
    @ajax(
      id:          'translations'
      type:        'PUT'
