translate labels like "{something} {else}"

This commit is contained in:
Ralf Becker 2019-03-19 17:19:10 +01:00
parent fa8ee606b3
commit 602f3093b5

View File

@ -1396,7 +1396,16 @@ abstract class admin_cmd
// config templates have options in the template // config templates have options in the template
case 'option': case 'option':
if (!is_array($widgets[$last_select])) $widgets[$last_select] = []; if (!is_array($widgets[$last_select])) $widgets[$last_select] = [];
$widgets[$last_select][(string)$widget->attrs['value']] = $widget->attrs['#text']; $label = (string)$widget->attrs['#text'];
// translate "{something} {else}" type options
if (strpos($label, '{') !== false)
{
$label = preg_replace_callback('/{([^}]+)}/', function($matches)
{
return lang($matches[1]);
}, $label);
}
$widgets[$last_select][(string)$widget->attrs['value']] = $label;
break; break;
default: default:
$last_select = null; $last_select = null;