Skip to content

Commit 61e9ced

Browse files
author
Till Brehm
committed
Merge branch 'lng-script' into 'develop'
Add script to add a new string to multiple translation files See merge request ispconfig/ispconfig3!1721
2 parents 4a599a8 + d7478f1 commit 61e9ced

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

helper_scripts/multifile_add

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Adding a new translation string to the files for all languages.
4+
# If you already added the string to your current language, be sure to deduplicate.
5+
6+
new=$(cat << 'EOD'
7+
$wb['foo_txt'] = 'Some translation';
8+
EOD
9+
)
10+
11+
if [ -z "$1" ]; then
12+
echo "Usage: $0 <files>"
13+
exit 1
14+
fi
15+
16+
for f in $*; do
17+
# Preserve a php close tag as the last line.
18+
close='?>'
19+
if [ "$(tail -n 1 $f)" == "$close" ]; then
20+
(
21+
head -n -1 $f;
22+
echo "$new";
23+
echo "?>";
24+
) > ${f}.new
25+
26+
mv ${f}.new $f
27+
28+
29+
else
30+
echo "$new" >> $f
31+
fi
32+
done

0 commit comments

Comments
 (0)