forked from linuxdeepin/dde-control-center
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lupdate.sh
executable file
·52 lines (42 loc) · 1.29 KB
/
lupdate.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
#!/bin/bash
# 根据CMakeLists.txt更新ts文件
# 参数1 ts文件名,不带_en.ts
# 参数2 CMakeLists.txt相对路径
# 参数3 附加头文件路径,可无
function lupdateProject() {
local INC_FLAG=
local SRC_DIR=$2
local TS_FILE=$1_en.ts
echo 工程:$1
echo CMakeLists.txt路径:$2
if [ $# == 3 ]; then
echo 附加头文件路径:$3
INC_FLAG=-I\ $3
fi
cd ./translations
rm -f $TS_FILE
rm -f files.tmp
for i in $(grep "\.h" $SRC_DIR/CMakeLists.txt); do
echo $SRC_DIR/$i | grep -q -E "\.h$" && echo $SRC_DIR/$i >>files.tmp
done
for i in $(grep "\.cpp" $SRC_DIR/CMakeLists.txt); do
echo $SRC_DIR/$i | grep -q -E "\.cpp$" && echo $SRC_DIR/$i >>files.tmp
done
lupdate @files.tmp $INC_FLAG -ts -no-obsolete $TS_FILE
rm -f files.tmp
sed -e 's/DCC_NAMESPACE/dccV20/g' $TS_FILE >tmp.ts
mv tmp.ts $TS_FILE
cd ../
}
# dde-control-center_en.ts
lupdateProject dde-control-center ../src/frame ../include
# dialogs_en.ts
lupdateProject dialogs ../src/reboot-reminder-dialog
# desktop.ts 无源文件
# recovery_en.ts
lupdateProject recovery ../abrecovery
# keyboard_language_en.ts
# keyboard_language 无源文件,直接修改keyboard_language_en.ts
# reset-pasword-dialog
lupdateProject reset-password-dialog ../src/reset-password-dialog
tx push -s -b m20