You are here

function tt in Internationalization 5.3

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

Translate configurable string, and store for l10n client.

This is just a wrapper for backwards compatibility. For this function to do something useful you need to enable i18nstrings module, otherwise it's just a slightly improved t() for i18n. It works the same but forgets about English and translates when language != default and language == locale

Parameters

$strid: Textgroup and location glued with ':' I.e. profile:

$default: String in default language. Default language may or may not be English

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

$update: Whether to update/create the string

7 calls to tt()
i18ncontent_locale_refresh in experimental/i18ncontent.module
Refresh content type strings.
i18ncontent_node_info in experimental/i18ncontent.module
Implementation of hook_node_info()
i18nmenu_translate_all in contrib/i18nmenu.module
i18nstrings_admin_overview in i18nstrings/i18nstrings.module
List of strings
i18ntaxonomy_form_alter in contrib/i18ntaxonomy.module
Implementation of hook_form_alter().

... See full list

File

./i18n.module, line 1266
Internationalization (i18n) module

Code

function tt($strid, $default, $language = NULL, $update = FALSE) {
  global $locale;
  $language = $language ? $language : $locale;
  if (function_exists('i18nstrings_tt')) {
    return i18nstrings_tt($strid, $default, $language, $update);
  }
  elseif ($language == i18n_default_language() || $language != $locale) {

    // We just translate from default language, not to default language
    return $default;
  }
  else {

    // We cannot call t() here because it won't work for English when not default language
    return locale($default);
  }
}