| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /tmp/ispconfig3_install/helper_scripts/ |
Upload File : |
#!/bin/bash
# Adding a new translation string to the files for all languages.
# If you already added the string to your current language, be sure to deduplicate.
new=$(cat << 'EOD'
$wb['foo_txt'] = 'Some translation';
EOD
)
if [ -z "$1" ]; then
echo "Usage: $0 [seek_pattern] <files>"
echo
echo "Add a hard coded set of new lines to a number of language files."
echo "When the first argument is not a file it's treated as a string to search for, adding the new lines directly below it. This only supports adding a single new line though."
exit 1
fi
if [ ! -f "$1" ]; then
seek_pattern=$1;
shift;
fi
for f in $*; do
if [ "$(grep --fixed-strings "$new" $f)" ]; then
echo "Skipping file[$f] already matches"
continue
fi
if [ -n "$seek_pattern" ]; then
# Add inplace, only a single line is supported.
sed -i "/$seek_pattern/a\
$new" $f
else
# Add at the end
# Preserve a php close tag as the last line.
close='?>'
if [ "$(tail -n 1 $f)" == "$close" ]; then
(
head -n -1 $f;
echo "$new";
echo "?>";
) > ${f}.new
mv ${f}.new $f
else
echo "$new" >> $f
fi
fi
done