Skip to content

Commit

Permalink
Fix variable checks for installer properties (dashes)
Browse files Browse the repository at this point in the history
  • Loading branch information
flodolo committed Jun 19, 2024
1 parent 7ec77e2 commit 8a889bf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/classes/Transvision/AnalyseStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]|\{\s|\{)(\$[A-Za-z0-9\._-]+)\b/',
'properties' => '/(?<!%[0-9]|\{\s|\{)(\$[A-Za-z0-9\.]+)\b/',
// %1$s or %s. %d
'xml_android' => '/(%(?:[0-9]+\$){0,1}([sd]))/',
// %1, %2, etc.
Expand Down
24 changes: 24 additions & 0 deletions tests/units/Transvision/AnalyseStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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$@'],
Expand Down

0 comments on commit 8a889bf

Please sign in to comment.