Skip to content
Snippets Groups Projects
Verified Commit d7478f19 authored by Helmo's avatar Helmo
Browse files

Add script to add a new string to multiple translation files

parent 4a599a8d
No related branches found
No related tags found
1 merge request!1721Add script to add a new string to multiple translation files
#!/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 <files>"
exit 1
fi
for f in $*; do
# 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
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment