You are here

function i18nstrings_translate_string in Internationalization 6

Get translation for user defined string.

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

Parameters

$name: Textgroup and location glued with ':'

$string: String in default language

$langcode: Language code to get translation for

3 calls to i18nstrings_translate_string()
i18nstrings in i18nstrings/i18nstrings.module
Translate user defined string.
i18nstrings_translate_object in i18nstrings/i18nstrings.module
Translate object properties.
i18nstrings_ts in i18nstrings/i18nstrings.module
Get configurable string.

File

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

Code

function i18nstrings_translate_string($name, $string, $langcode) {
  global $language;
  $context = i18nstrings_context($name, $string);

  // Search for existing translation (result will be cached in this function call)
  $translation = i18nstrings_get_string($context, $langcode);

  // Add for l10n client if available
  i18nstrings_add_l10n_client($langcode, $string, $translation, $context, FALSE);
  return $translation ? $translation : $string;
}