generate_lang_file: ignore LSformat string with simple string substitution

This commit is contained in:
Benjamin Renard 2023-05-17 17:59:58 +02:00
parent 7b7ff7e629
commit 823006937a
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -377,6 +377,15 @@ function _cli_add_str_to_translate($msg, $context=null) {
if (!is_null($lang) && _($msg) != "$msg") if (!is_null($lang) && _($msg) != "$msg")
return; return;
// It is a LSformat string with a simple substitution (for instance: "%{test}")?
if (preg_match("/^%[{(][^{(]+[})]$/", $msg)) {
$LSlang_cli_logger -> trace(
"_cli_add_str_to_translate($msg, $context): LSformat string with a simple substitution, ".
"ignore it"
);
return;
}
// Message already exists ? // Message already exists ?
if (array_key_exists($msg, $data)) { if (array_key_exists($msg, $data)) {
if ($context && !in_array($context, $data[$msg]['contexts'])) if ($context && !in_array($context, $data[$msg]['contexts']))