You are here

function facetapi_translate_string in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 facetapi.module \facetapi_translate_string()
  2. 7 facetapi.module \facetapi_translate_string()

Translates a string via the translator module.

Parameters

$name: The name of the string in "textgroup:object_type:object_key:property_name" format.

$string: The string being translated.

$langcode: The language code to translate to a language other than what is used to display the page. Defaults to NULL, which uses the current language.

Return value

The translated string.

3 calls to facetapi_translate_string()
CurrentSearchItem::translate in contrib/current_search/plugins/current_search/item.inc
Helper function for translating strings.
FacetapiApiFunctions::testTranslateString in tests/facetapi.test
Tests the facetapi_translate_string() functionality.
FacetapiEmptyBehavior::translate in plugins/facetapi/empty_behavior.inc
Helper function for translating strings.

File

./facetapi.module, line 885
An abstracted facet API that can be used by various search backends.

Code

function facetapi_translate_string($name, $string, $langcode = NULL) {
  if ($module = variable_get('facetapi:translator_module', NULL)) {
    $function = $module . '_facetapi_translate_string';
    if (function_exists($function)) {
      $string = $function($name, $string, $langcode);
    }
  }
  return $string;
}