Allow duplicate placeholders in engine strings
authorWuzzy <Wuzzy2@mail.ru>
Thu, 25 Oct 2018 16:44:00 +0200
changeset 13967 a04c86dc685f
parent 13966 c409af570f87
child 13968 9468efabd337
Allow duplicate placeholders in engine strings
hedgewars/uLocale.pas
tools/check_engine_locale_files.sh
--- a/hedgewars/uLocale.pas	Thu Oct 25 17:02:56 2018 +0300
+++ b/hedgewars/uLocale.pas	Thu Oct 25 16:44:00 2018 +0200
@@ -159,14 +159,14 @@
             8: curArg:= arg9;
         end;
 
+        repeat
         p:= Pos('%'+IntToStr(i+1), tempstr);
-        if (p = 0) then
-            break
-        else
+        if (p <> 0) then
             begin
             delete(tempstr, p, 2);
             insert(curArg, tempstr, p);
             end;
+        until (p = 0);
     end;
 Format:= tempstr;
 end;
@@ -191,14 +191,14 @@
             8: curArg:= arg9;
         end;
 
+        repeat
         p:= Pos('%'+IntToStr(i+1), tempstr);
-        if (p = 0) then
-            break
-        else
+        if (p <> 0) then
             begin
             delete(tempstr, p, 2);
             insert(curArg, tempstr, p);
             end;
+        until (p = 0);
     end;
 FormatA:= tempstr;
 end;
--- a/tools/check_engine_locale_files.sh	Thu Oct 25 17:02:56 2018 +0300
+++ b/tools/check_engine_locale_files.sh	Thu Oct 25 16:44:00 2018 +0200
@@ -88,18 +88,6 @@
 	MISSING_STRINGS=0;
 	HAS_PROBLEMS=0;
 
-	# Find duplicate placeholders
-	for i in 0 1 2 3 4 5 6 7 8 9
-	do
-		grep -G "%$i.*%$i" $CHECKED_LANG_FILE > $TEMP_CHECK;
-		if [ -s $TEMP_CHECK ]
-		then
-			echo "ERROR! Duplicate placeholders found:";
-			cat $TEMP_CHECK;
-			HAS_PROBLEMS=1;
-		fi
-	done;
-
 	if [ $CHECKED_LANG_FILE != en.txt ]
 	then
 		grep -o "^[0-9][0-9]:[0-9][0-9]=" $CHECKED_LANG_FILE | cut -c1-5 | sort | uniq > $TEMP_SYMBOLS;