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

Commitf497c72

Browse files
authored
Script to find format differences (#1011)
1 parent2db02b4 commitf497c72

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

‎distutils/setupscript.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ msgid ""
12251225
"The ``long_description`` field is used by PyPI when you publish a package, "
12261226
"to build its project page."
12271227
msgstr""
1228-
"PyPI utiliza el campo ``descripción larga`` cuando publica un paquete para "
1228+
"PyPI utiliza el campo ``long_description`` cuando publica un paquete para "
12291229
"construir su página de proyecto."
12301230

12311231
#:../Doc/distutils/setupscript.rst:621

‎scripts/format_differences.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
importcollections
2+
importos
3+
importglob
4+
5+
frompprintimportpprint
6+
7+
importpolib# fades
8+
9+
PO_DIR=os.path.abspath(
10+
os.path.join(
11+
os.path.dirname(__file__),
12+
'..',
13+
))
14+
15+
16+
17+
DELIMITERS= ("``","*")
18+
19+
defhas_delimiters(x):
20+
fordinDELIMITERS:
21+
ifdinx:
22+
returnTrue
23+
returnFalse
24+
25+
defmain():
26+
files_with_differences=collections.defaultdict(list)
27+
28+
fori,pofilenameinenumerate(glob.glob(PO_DIR+'**/**/*.po')):
29+
po=polib.pofile(pofilename)
30+
ifpo.percent_translated()<85:
31+
continue
32+
33+
forentryinpo:
34+
words= []
35+
wordsid=wordsstr=list()
36+
37+
ifhas_delimiters(entry.msgid):
38+
wordsid= [wordforwordinentry.msgid.split()ifhas_delimiter(word)]
39+
40+
ifhas_delimiters(entry.msgstr):
41+
wordsstr= [wordforwordinentry.msgstr.split()ifhas_delimiter(word)]
42+
43+
iflen(wordsid)!=len(wordsstr):
44+
key=pofilename.replace(PO_DIR,'')
45+
files_with_differences[key].append({
46+
'occurrences':entry.occurrences,
47+
'words': {
48+
'original':wordsid,
49+
'translated':wordsstr,
50+
},
51+
})
52+
53+
returnfiles_with_differences
54+
55+
56+
pprint(main())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp