8000 Add txpull utility for pulling translations from Transifex · python/python-docs-zh-tw@02839b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02839b7

Browse files
committed
Add txpull utility for pulling translations from Transifex
1 parent 5ab569c commit 02839b7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

txpull

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
if [ x"$1" == x ];
4+
then
5+
echo "Usage: ./txpull <po file path> [<options or arguments for tx pull>]"
6+
exit 1
7+
fi
8+
9+
if [ ! -f "$1" ];
10+
then
11+
echo "File $1 does not exist"
12+
exit 1
13+
fi
14+
15+
file="$1"
16+
shift
17+
18+
resource_slug="$(cat .tx/config | grep -B 1 $file | head -n 1 | sed 's/\[\(.*\)\]/\1/')"
19+
if [ x"$resource_slug" == x ];
20+
then
21+
echo "Resource of file $file not found"
22+
exit 1
23+
fi
24+
25+
echo "Pulling translations of $file from Transifex...\n"
26+
echo "$ tx pull $@ -r $resource_slug"
27+
tx pull $@ -r $resource_slug
28+
29+
echo "\nFixing format consistency in $file...\n"
30+
echo "$ poindent $file"
31+
poindent $file
32+
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
35+
36+
echo "Done."

0 commit comments

Comments
 (0)
0