From 602f3093b587902cf29cc745e45692bbc37e4c45 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 19 Mar 2019 17:19:10 +0100 Subject: [PATCH] translate labels like "{something} {else}" --- admin/inc/class.admin_cmd.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/admin/inc/class.admin_cmd.inc.php b/admin/inc/class.admin_cmd.inc.php index 7882e529a4..e59186ae80 100644 --- a/admin/inc/class.admin_cmd.inc.php +++ b/admin/inc/class.admin_cmd.inc.php @@ -1396,7 +1396,16 @@ abstract class admin_cmd // config templates have options in the template case 'option': 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; default: $last_select = null;