-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·58 lines (48 loc) · 1.01 KB
/
build.sh
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
#!/bin/bash
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$DIR"
SRC_DIR='src'
TARGET_DIR='target'
function copy_to_target()
{
echo "Copying files to target..."
mkdir -p "$TARGET_DIR"
dirs_to_copy=(
blog
css
files
img
js
lib
pages
)
cd "$SRC_DIR"
for FILE in *.php; do
cp "$FILE" "../$TARGET_DIR"
done
for FILE in "${dirs_to_copy[@]}"; do
cp -r "$FILE" "../$TARGET_DIR"
done
cd - >/dev/null
}
function build_translations()
{
echo "Generating translation files..."
cd "$SRC_DIR"
for FILE in locale/*/LC_MESSAGES/*.po; do
FILENAME=${FILE##*/}
FILENAME_WITHOUT_EXTENSION=${FILENAME%%.*}
DIRNAME=$(dirname "$FILE")
mkdir -p "../$TARGET_DIR/$DIRNAME"
msgfmt "$FILE" -o "../$TARGET_DIR/$DIRNAME/$FILENAME_WITHOUT_EXTENSION.mo"
done
cd - >/dev/null
}
function main()
{
copy_to_target
build_translations
echo "Done!"
}
main "$@"