Open kiamlaluno opened 1 week ago
In French, the translation for version: 3 is version : 3 (with a space before the semicolon). Only when a complete string is passed to t()
, translators are able to give a correct translation.
(I need to avoid editing code when somebody keeps interrupting me.)
Since $editor['label']
is added to the translated string, I changed the code to the following one.
foreach ($text_formats as $format_info) {
if (!empty($format_info->editor)) {
$editor = $text_editors[$format_info->editor];
if (!empty($editor['library_version'])) {
$editor_version = $editor['library_version'];
}
elseif (isset($modules[$editor['module']]->info['version'])) {
$editor_version = $modules[$editor['module']]->info['version'];
}
$editor_label = t('@editor_label version: @editor_version', array(
'@editor_label' => $editor['label'],
'@editor_version' => $editor_version,
));
$text_editor_usage[$editor_label][] = $format_info->name;
}
}
In this way, translators have a better context, to understand how the text should be translated.
system_get_debug_info()
uses the following code.That code has these "issues":
Instead, the output string should be a single string passed to
t()
, which uses placeholders, similarly to the other string used by the same function.If the version does not really need to be sanitized/escaped, the following code should be used.
Otherwise, a different placeholder needs to be used.