You are here

function i18nstrings_text in Internationalization 6

Get filtered translation.

This function is intended to return translations for strings that have an input format

Parameters

$name: Full string id

$default: Default string to return if not found, already filtered

$langcode: Optional language code if different from current request language.

1 call to i18nstrings_text()
i18nblocks_translate_block in i18nblocks/i18nblocks.module
Translate block.

File

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

Code

function i18nstrings_text($name, $default, $langcode = NULL) {
  global $language;
  $langcode = $langcode ? $langcode : $language->language;
  $context = i18nstrings_context($name, $default);

  // If language is default or we don't have translation, just return default string
  if (i18nstrings_translate_langcode($langcode) && ($translation = i18nstrings_get_translation($name, $langcode))) {
    $translated = check_markup($translation->translation, $translation->format, FALSE);

    // Add for l10n client if available, we pass translation object that contains the format
    i18nstrings_add_l10n_client($langcode, $default, $translated, $context, $translation);
  }
  else {
    $translated = $default;

    // Add for l10n client if available
    i18nstrings_add_l10n_client($langcode, $default, $translated, $context);
  }
  return $translated;
}