|
5 | 5 | # Convert translation files zh-cn to zh_Hans |
6 | 6 | # The script is still in testing, welcome to report bugs. |
7 | 7 |
|
8 | | -po_file="$({ find |grep -E "[a-z0-9]+\.zh\-cn.+po"; } 2>"/dev/null")" |
| 8 | +po_file="$({ find -type f |grep -E "[a-z0-9]+\.zh\-cn.+po"; } 2>"/dev/null")" |
9 | 9 | for a in ${po_file} |
10 | 10 | do |
11 | 11 | [ -n "$(grep "Language: zh_CN" "$a")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$a" |
12 | 12 | po_new_file="$(echo -e "$a"|sed "s/zh-cn/zh_Hans/g")" |
13 | 13 | mv "$a" "${po_new_file}" 2>"/dev/null" |
14 | 14 | done |
15 | 15 |
|
16 | | -po_file2="$({ find |grep "/zh-cn/" |grep "\.po"; } 2>"/dev/null")" |
| 16 | +po_file2="$({ find -type f |grep "/zh-cn/" |grep "\.po"; } 2>"/dev/null")" |
17 | 17 | for b in ${po_file2} |
18 | 18 | do |
19 | 19 | [ -n "$(grep "Language: zh_CN" "$b")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$b" |
20 | 20 | po_new_file2="$(echo -e "$b"|sed "s/zh-cn/zh_Hans/g")" |
21 | 21 | mv "$b" "${po_new_file2}" 2>"/dev/null" |
22 | 22 | done |
23 | 23 |
|
24 | | -lmo_file="$({ find |grep -E "[a-z0-9]+\.zh_Hans.+lmo"; } 2>"/dev/null")" |
| 24 | +lmo_file="$({ find -type f |grep -E "[a-z0-9]+\.zh_Hans.+lmo"; } 2>"/dev/null")" |
25 | 25 | for c in ${lmo_file} |
26 | 26 | do |
27 | 27 | lmo_new_file="$(echo -e "$c"|sed "s/zh_Hans/zh-cn/g")" |
28 | 28 | mv "$c" "${lmo_new_file}" 2>"/dev/null" |
29 | 29 | done |
30 | 30 |
|
31 | | -lmo_file2="$({ find |grep "/zh_Hans/" |grep "\.lmo"; } 2>"/dev/null")" |
| 31 | +lmo_file2="$({ find -type f |grep "/zh_Hans/" |grep "\.lmo"; } 2>"/dev/null")" |
32 | 32 | for d in ${lmo_file2} |
33 | 33 | do |
34 | 34 | lmo_new_file2="$(echo -e "$d"|sed "s/zh_Hans/zh-cn/g")" |
35 | 35 | mv "$d" "${lmo_new_file2}" 2>"/dev/null" |
36 | 36 | done |
37 | 37 |
|
38 | | -po_dir="$({ find |grep "/zh-cn" |sed "/\.po/d" |sed "/\.lmo/d"; } 2>"/dev/null")" |
| 38 | +po_dir="$({ find -type d |grep "/zh-cn" |sed "/\.po/d" |sed "/\.lmo/d"; } 2>"/dev/null")" |
39 | 39 | for e in ${po_dir} |
40 | 40 | do |
41 | 41 | po_new_dir="$(echo -e "$e"|sed "s/zh-cn/zh_Hans/g")" |
42 | 42 | mv "$e" "${po_new_dir}" 2>"/dev/null" |
43 | 43 | done |
44 | 44 |
|
45 | | -makefile_file="$({ find|grep Makefile |sed "/Makefile./d"; } 2>"/dev/null")" |
| 45 | +makefile_file="$({ find -type f |grep Makefile |sed "/Makefile./d"; } 2>"/dev/null")" |
46 | 46 | for f in ${makefile_file} |
47 | 47 | do |
48 | 48 | [ -n "$(grep "zh-cn" "$f")" ] && sed -i "s/zh-cn/zh_Hans/g" "$f" |
|
0 commit comments