Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit164f4b9

Browse files
committed
Add Linux support and dependency checkings for txpull command
1 parent02839b7 commit164f4b9

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

‎txpull

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,49 @@
11
#!/bin/sh
22

3-
if [ x"$1"== x ];
4-
then
3+
if [-z"$1" ];then
54
echo"Usage: ./txpull <po file path> [<options or arguments for tx pull>]"
65
exit 1
76
fi
87

9-
if [!-f"$1" ];
10-
then
8+
if [!-f"$1" ];then
119
echo"File$1 does not exist"
1210
exit 1
1311
fi
1412

1513
file="$1"
1614
shift
1715

18-
resource_slug="$(cat .tx/config| grep -B 1$file| head -n 1| sed's/\[\(.*\)\]/\1/')"
19-
if [ x"$resource_slug"== x ];
20-
then
16+
resource_slug="$(cat .tx/config| grep -B 3$file| grep"python-36-tw"| head -n 1| sed's/\[\(.*\)\]/\1/')"
17+
if [-z"$resource_slug" ];then
2118
echo"Resource of file$file not found"
2219
exit 1
2320
fi
2421

22+
if [-z"$(which tx)" ];then
23+
echo"Dependency transifex-client not installed, install with the following command:"
24+
echo"$ pip3 install transifex-client"
25+
exit 1
26+
fi
27+
28+
if [-z"$(which poindent)" ];then
29+
echo"Dependency poindent not installed, install with the following command:"
30+
echo"$ pip3 install poindent"
31+
exit 1
32+
fi
33+
34+
if [-z"$(which gettext)" ];then
35+
echo"Dependency gettext not installed, please install with your package manager."
36+
exit 1
37+
fi
38+
39+
if [-z"$(which tac)" ];then
40+
echo"Dependency tac not found, please install with your package manager."
41+
if ["$(uname -s)"=="Darwin" ];then
42+
echo"https://unix.stackexchange.com/questions/114041/how-can-i-get-the-tac-command-on-os-x/114042 may be useful for Mac users."
43+
fi
44+
exit 1
45+
fi
46+
2547
echo"Pulling translations of$file from Transifex...\n"
2648
echo"$ tx pull$@ -r$resource_slug"
2749
tx pull$@ -r$resource_slug
@@ -30,7 +52,9 @@ echo "\nFixing format consistency in $file...\n"
3052
echo"$ poindent$file"
3153
poindent$file
3254

33-
echo"sed -i '' -e 's/\"Language: zh-Hant\\\\n\"/\"Language: zh_TW\\\\n\"/'$file"
34-
sed -i'' -e's/"Language: zh-Hant\\n"/"Language: zh_TW\\n"/'$file
55+
echo"$ sed -i.bak 's/\"Language: zh-Hant\\\\n\"/\"Language: zh_TW\\\\n\"/'$file"
56+
sed -i.bak's/"Language: zh-Hant\\n"/"Language: zh_TW\\n"/'"$file"
57+
echo"$ rm$file.bak"
58+
rm"$file".bak
3559

3660
echo"Done."

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp