You are here

function i18n_string_l10n_client_add in Internationalization 7

Add string to l10n strings if enabled and allowed for this string

Parameters

$context: String object

2 calls to i18n_string_l10n_client_add()
i18n_string_translate in i18n_string/i18n_string.module
Get translation for user defined string.
i18n_string_translate_list in i18n_string/i18n_string.module
Translation for list of options

File

i18n_string/i18n_string.module, line 825
Internationalization (i18n) package - translatable strings.

Code

function i18n_string_l10n_client_add($string, $langcode) {

  // If current language add to l10n client list for later on page translation.
  // If langcode translation was disabled we are not supossed to reach here.
  if ($langcode == i18n_langcode() && function_exists('l10_client_add_string_to_page') && user_access('translate interface')) {
    if (!$string
      ->check_translate_access()) {
      $translation = $string
        ->get_translation($langcode);
      $source = !empty($string->source) ? $string->source : $string->string;
      l10_client_add_string_to_page($source, $translation ? $translation : TRUE, $string->textgroup, $string->context);
    }
  }
}