You are here

function l10n_client_save_string in Localization client 5

Same name and namespace in other branches
  1. 6.2 l10n_client.module \l10n_client_save_string()
  2. 6 l10n_client.module \l10n_client_save_string()
  3. 7 l10n_client.module \l10n_client_save_string()

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

Extended: it can now save strings by lid or source, preferred the first one.

1 string reference to 'l10n_client_save_string'
l10n_client_menu in ./l10n_client.module
Implementation of hook_menu().

File

./l10n_client.module, line 328
Localization client. Provides on-page translation editing.

Code

function l10n_client_save_string() {
  global $locale;
  if (user_access('use on-page translation')) {
    if (isset($_POST['source']) && isset($_POST['target']) && !empty($_POST['form_token']) && drupal_valid_token($_POST['form_token'], 'l10n_client_form')) {
      include_once 'includes/locale.inc';
      $report = array(
        0,
        0,
        0,
      );
      _l10n_client_import_one_string_db($report, $locale, $_POST['lid'], $_POST['source'], $_POST['target'], $_POST['location']);
      locale_refresh_cache();
    }
  }
}