We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4a599a8 + d7478f1 commit 61e9cedCopy full SHA for 61e9ced
helper_scripts/multifile_add
@@ -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