You are here

function l10n_update_locale_translate_edit_form_submit in Localization update 7.2

Same name and namespace in other branches
  1. 6 l10n_update.module \l10n_update_locale_translate_edit_form_submit()
  2. 7 l10n_update.module \l10n_update_locale_translate_edit_form_submit()

Additional submit handler for locale and i18n_string translation edit form.

Mark locally edited translations as customized.

See also

l10n_update_form_alter()

1 string reference to 'l10n_update_locale_translate_edit_form_submit'
l10n_update_form_alter in ./l10n_update.module
Implements hook_form_alter().

File

./l10n_update.module, line 407
Download translations from remote localization server.

Code

function l10n_update_locale_translate_edit_form_submit($form, &$form_state) {
  $lid = $form_state['values']['lid'];
  $languages = $form_state['values']['translations'];
  $languages = array_intersect_key($languages, l10n_update_translatable_language_list());
  foreach ($languages as $langcode => $value) {
    if (!empty($value) && $value != $form_state['complete form']['translations'][$langcode]['#default_value']) {

      // An update has been made, mark the string as customized.
      db_update('locales_target')
        ->fields(array(
        'l10n_status' => L10N_UPDATE_STRING_CUSTOM,
      ))
        ->condition('lid', $lid)
        ->condition('language', $langcode)
        ->execute();
    }
  }
}