From 8a889bfb3f9db9a9a6e5d43c26e77ce39fba6483 Mon Sep 17 00:00:00 2001 From: Francesco Lodolo Date: Wed, 19 Jun 2024 14:50:22 +0200 Subject: [PATCH] Fix variable checks for installer properties (dashes) --- app/classes/Transvision/AnalyseStrings.php | 2 +- tests/units/Transvision/AnalyseStrings.php | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/classes/Transvision/AnalyseStrings.php b/app/classes/Transvision/AnalyseStrings.php index a2fa8b8f..830691cb 100644 --- a/app/classes/Transvision/AnalyseStrings.php +++ b/app/classes/Transvision/AnalyseStrings.php @@ -57,7 +57,7 @@ public static function differences($tmx_source, $tmx_target, $repo, $ignored_str // %1$S or %S. %1$0.S and %0.S are valid too 'printf' => '/(%(?:[0-9]+\$){0,1}(?:[0-9].){0,1}([sS]))/', // $BrandShortName, but not "My%1$SFeeds-%2$S.opml" or "{ $brandShortName }" - 'properties' => '/(? '/(? '/(%(?:[0-9]+\$){0,1}([sd]))/', // %1, %2, etc. diff --git a/tests/units/Transvision/AnalyseStrings.php b/tests/units/Transvision/AnalyseStrings.php index 0d34d247..59e3eed4 100644 --- a/tests/units/Transvision/AnalyseStrings.php +++ b/tests/units/Transvision/AnalyseStrings.php @@ -259,6 +259,30 @@ public function differencesDP() [], [], ], + [ + // $brand variables in .properties + ['browser:foobar17' => 'Are you sure you want to quit $BrandFullName Setup?'], + ['browser:foobar17' => 'Da li ste sigurni da želite ugasiti $BrandFullName instalaciju?'], + 'gecko_strings', + [], + [], + ], + [ + // Missing $brand variables in .properties + ['browser:foobar17a' => 'Are you sure you want to quit $BrandFullName Setup?'], + ['browser:foobar17a' => 'Da li ste sigurni da želite ugasiti instalaciju?'], + 'gecko_strings', + [], + ['browser:foobar17a'], + ], + [ + // $brand variables in .properties with added text, not an error + ['browser:foobar17a' => 'Are you sure you want to quit $BrandFullName Setup?'], + ['browser:foobar17a' => 'Wil u definitief die $BrandFullName-opsteller afsluit?'], + 'gecko_strings', + [], + [], + ], [ // Mispelled variable ['iostest:foobar1' => 'Introductory slide %1$@ of %2$@'],