forked from Eric-Brison/dynacase-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
whattext
executable file
·59 lines (49 loc) · 1.41 KB
/
whattext
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
DIRNAME=`dirname "$0"`
REAL_DIRNAME=`cd "$DIRNAME" 1> /dev/null 2>&1 && pwd`
if [ -z "$REAL_DIRNAME" ]; then
echo "Could not get real dir name from '$0'."
exit 1
fi
export wpub=$REAL_DIRNAME
shopt -s nullglob
function whattext ()
{
ntf="$wpub/locale/.gettextnumber"
if [ ! -f "$ntf" ]; then
echo "0" > "$ntf"
fi
numberone=`cat "$ntf"`
numbertwo=`expr "$numberone" + 1`
today=`date "+%F %T"`
for lang_dir in "$wpub"/locale/*; do
if [ ! -d "$lang_dir/LC_MESSAGES" ]; then
continue
fi
pushd "$lang_dir/LC_MESSAGES" >/dev/null
mv freedom-catalog.mo freedom-catalog.mo.old 1> /dev/null 2>&1
find . -type l -name "freedom-catalog[0-9]*.mo" -exec /bin/rm {} \;
if [ -h "freedom-catalog$numberone.mo" ]; then
\rm "freedom-catalog$numberone.mo"
fi
for mo in `ls *.mo` ; do
msgunfmt --force-po "$mo" -o "$mo.po"
done
msgcat --use-first *.po > freedom-catalog.po
msgfmt freedom-catalog.po -o freedom-catalog.mo
rm -f *.po *.old
if [ ! -a "freedom-catalog$numbertwo.mo" ]; then
\ln -s freedom-catalog.mo "freedom-catalog$numbertwo.mo" && echo "$numbertwo" > "$ntf"
fi
popd >/dev/null
if [ -d "$lang_dir/js" ]; then
pushd "$lang_dir/js" > /dev/null
echo '{"fdl:creationDate":"'$today'"}'> null-mo.js
php "$wpub/programs/json_concat" *mo.js > catalog.js
\rm null-mo.js
popd >/dev/null
fi
done
}
whattext
exit 0