protected function i18n_string_textgroup_default::multiple_translation_build in Internationalization 7
Get multiple translations with search conditions.
Parameters
$translations: Array of translation objects as loaded from the db.
$langcode: Language code, array of language codes or * to search all translations.
Return value
array Array of i18n string objects.
1 call to i18n_string_textgroup_default::multiple_translation_build()
- i18n_string_textgroup_default::multiple_translation_load in i18n_string/
i18n_string.inc - Load multiple translations from db
File
- i18n_string/
i18n_string.inc, line 850 - API for internationalization strings
Class
- i18n_string_textgroup_default
- Textgroup handler for i18n_string API
Code
protected function multiple_translation_build($translations, $langcode) {
$strings = array();
foreach ($translations as $translation) {
// The string object may be already in list
if (isset($strings[$translation->context])) {
$string = $strings[$translation->context];
}
else {
$string = $this
->build_string($translation->context);
$string
->set_properties($translation);
$strings[$string->context] = $string;
}
// If this is a translation we set it there too
if ($translation->language && $translation->translation) {
$string
->set_translation($translation);
}
elseif ($langcode) {
// This may only happen when we have a source string but not translation.
$string
->set_translation(FALSE, $langcode);
}
}
return $strings;
}