Add quotes around gettext string

This should prevent occurrences of the search string from being found in other
locations (e.g. in a comment).

The whole approach of string extraction from Rust sources is sketchy,
but this at least prevents producing garbage when the content of a string
appears somewhere else unquoted.
This commit is contained in:
Daniel Rainer
2025-04-18 16:59:08 +02:00
parent d31dc9ffd8
commit dd5864ce13

View File

@@ -30,7 +30,7 @@ for str in $strs
# grep -P needed for string escape to be compatible (PCRE-style),
# -H gives the filename, -n the line number.
# If you want to run this on non-GNU grep: Don't.
echo "#:" (grep -PHn -r -- (string escape --style=regex -- $str) src/ |
echo "#:" (grep -PHn -r -- \"(string escape --style=regex -- $str)\" src/ |
head -n1 | string replace -r ':\s.*' '')
echo "msgid \"$str\""
echo 'msgstr ""'