FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-docs-zh-tw/.scripts/from_cn.sh at library/string · python/python-docs-zh-tw · GitHub
python
python-docs-zh-tw
Repository navigation
Code
Issues
33
(33)
Pull requests
12
(12)
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-docs-zh-tw
/
.scripts
/
from_cn.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
44 lines (37 loc) · 1.33 KB
Breadcrumbs
python-docs-zh-tw
/
.scripts
/
from_cn.sh
Copy path
File metadata and controls
executable file
·
44 lines (37 loc) · 1.33 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!
/bin/sh
cd
.scripts
source
utils/install_poetry.sh
#
check if OpenCC is installed
if
[[
!
-x
"
`
which opencc
2>
/dev/null
`
"
]]
then
echo
"
You do not have OpenCC installed. Please install it first.
"
echo
"
Instruction: https://github.com/BYVoid/OpenCC/wiki/Download
"
exit
1
fi
#
clone pydoc zh_CN repo and pull from remote
CN_REPO=.python-docs-zh-cn
if
[[
!
-d
$CN_REPO
]]
then
read
-p
"
You do not have a clone of zh_CN repo. Clone now? (y/N)
"
choice
case
"
$choice
"
in
y|Y ) git clone --depth 1 --no-single-branch https://github.com/python/python-docs-zh-cn
$CN_REPO
;;
n|N|
*
)
echo
"
Aborted
"
;
exit
1 ;;
esac
fi
git -C
$CN_REPO
checkout 3.10
#
the current latest version of CN repo
git -C
$CN_REPO
pull
#
convert zh_CN po content and merge into zh_TW po
TARGET=
$1
CN_PATH=
$CN_REPO
/
$TARGET
TW_PATH=../
$TARGET
poetry lock
poetry install
poetry run bash -c
"
opencc -i
$CN_PATH
-c s2twp.json -o /tmp/tmp.po
pofilter --nonotes --excludefilter unchanged --excludefilter untranslated /tmp/tmp.po | msgattrib --set-fuzzy -o /tmp/tmp.po
pomerge -t
$CN_PATH
-i /tmp/tmp.po -o /tmp/tmp.po
pofilter --nonotes --excludefilter untranslated
$TW_PATH
/tmp/tmp2.po
pomerge -t /tmp/tmp.po -i /tmp/tmp2.po -o /tmp/tmp3.po
msgcat --lang zh_TW /tmp/tmp3.po -o
$TW_PATH
"
rm /tmp/tmp.po /tmp/tmp2.po /tmp/tmp3.po
Back
|
FazBrowse Home
|
New Git URL