function _l10n_client_string_list in Localization client 5
Same name and namespace in other branches
- 6.2 l10n_client.module \_l10n_client_string_list()
- 6 l10n_client.module \_l10n_client_string_list()
- 7 l10n_client.module \_l10n_client_string_list()
String selection has been moved to a jquery-based list. Todo: make this a themeable function.
1 call to _l10n_client_string_list()
- l10n_client_footer in ./
l10n_client.module - Implementation of hook_footer().
File
- ./
l10n_client.module, line 196 - Localization client. Provides on-page translation editing.
Code
function _l10n_client_string_list($strings) {
// Build a list of short string excerpts for a selectable list.
foreach ($strings as $values) {
// Add a class to help identify translated strings
if ($values[1] === TRUE) {
$str_class = 'untranslated';
}
else {
$str_class = 'translated';
}
// TRUE means we don't have translation, so we use the original string,
// so we always have the string displayed on the page in the dropdown.
$original = $values[1] === TRUE ? $values[0] : $values[1];
// Remove html tags, at least for display
$original = htmlentities($original);
// Truncate and add ellipsis if too long.
$string = strip_tags(truncate_utf8($values[1] === TRUE ? $values[0] : $values[1], 78, TRUE));
$select_list[] = "<li class='{$str_class}'>" . $string . ($original == $string ? '' : '...') . "</li>";
}
$output = implode("\n", $select_list);
return "<ul class='string-list'>{$output}</ul>";
}