FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-docs-es/scripts/format_differences.py at fix_create_issue_script · sofide/python-docs-es · GitHub
sofide
/
python-docs-es
Public
forked from
python/python-docs-es
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-docs-es
/
scripts
/
format_differences.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (40 loc) · 1.33 KB
Breadcrumbs
python-docs-es
/
scripts
/
format_differences.py
Copy path
File metadata and controls
56 lines (40 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
45
46
47
48
49
50
51
52
53
54
55
56
import
collections
import
os
import
glob
from
pprint
import
pprint
import
polib
# fades
PO_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
))
DELIMITERS
=
(
"``"
,
"*"
)
def
has_delimiters
(
x
):
for
d
in
DELIMITERS
:
if
d
in
x
:
return
True
return
False
def
main
():
files_with_differences
=
collections
.
defaultdict
(
list
)
for
i
,
pofilename
in
enumerate
(
glob
.
glob
(
PO_DIR
+
'**/**/*.po'
)):
po
=
polib
.
pofile
(
pofilename
)
if
po
.
percent_translated
()
<
85
:
continue
for
entry
in
po
:
words
=
[]
wordsid
=
wordsstr
=
list
()
if
has_delimiters
(
entry
.
msgid
):
wordsid
=
[
word
for
word
in
entry
.
msgid
.
split
()
if
has_delimiters
(
word
)]
if
has_delimiters
(
entry
.
msgstr
):
wordsstr
=
[
word
for
word
in
entry
.
msgstr
.
split
()
if
has_delimiters
(
word
)]
if
len
(
wordsid
)
!=
len
(
wordsstr
):
key
=
pofilename
.
replace
(
PO_DIR
,
''
)
files_with_differences
[
key
].
append
({
'occurrences'
:
entry
.
occurrences
,
'words'
: {
'original'
:
wordsid
,
'translated'
:
wordsstr
,
},
})
return
files_with_differences
pprint
(
main
())
Back
|
FazBrowse Home
|
New Git URL