i18nstrings_get_string($context, $langcode)
contributions/i18n/i18nstrings/i18nstrings.module, line 292
Get string for a language
$context Context string or object
$langcode Language code to retrieve string for
<?php
function i18nstrings_get_string($context, $langcode) {
$context = i18nstrings_context($context);
if ($translation = i18nstrings_cache($context, $langcode)) {
return $translation;
} else {
// Search translation and add it to the cache
list($where, $args) = i18nstrings_context_query($context);
$where[] = "t.language = '%s'";
$args[] = $langcode;
$text = db_fetch_object(db_query("SELECT s.*, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE ". implode(' AND ', $where), $args));
if ($text && $text->translation) {
i18nstrings_cache($context, $langcode, NULL, $text->translation);
return $text->translation;
} else {
i18nstrings_cache($context, $langcode, NULL, TRUE);
return $text ? NULL : FALSE ;
}
}
}
?>