You are here

function i18nstrings_save_string in Internationalization 6

Same name and namespace in other branches
  1. 5.3 i18nstrings/i18nstrings.module \i18nstrings_save_string()
  2. 5 experimental/i18nstrings.module \i18nstrings_save_string()
  3. 5.2 experimental/i18nstrings.module \i18nstrings_save_string()

Menu callback. Saves a string translation coming as POST data.

1 string reference to 'i18nstrings_save_string'
i18nstrings_menu in i18nstrings/i18nstrings.module
Implementation of hook_menu().

File

i18nstrings/i18nstrings.module, line 1020
Internationalization (i18n) package - translatable strings.

Code

function i18nstrings_save_string() {
  global $user, $language;
  if (user_access('use on-page translation')) {
    $textgroup = !empty($_POST['textgroup']) ? $_POST['textgroup'] : 'default';

    // Default textgroup will be handled by l10n_client module
    if ($textgroup == 'default') {
      l10n_client_save_string();
    }
    elseif (isset($_POST['source']) && isset($_POST['target']) && !empty($_POST['form_token']) && drupal_valid_token($_POST['form_token'], 'l10n_client_form')) {
      i18nstrings_save_translation($language->language, $_POST['source'], $_POST['target'], $textgroup);
    }
  }
}