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

Commitb3bb7cb

Browse files
committed
Script to find format differences
There is a lot of work to do here, but this is the initial of the idea.
1 parentad7bc7d commitb3bb7cb

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

‎scripts/format_differences.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
defmain():
17+
files_with_differences=collections.defaultdict(list)
18+
19+
fori,pofilenameinenumerate(glob.glob(PO_DIR+'**/**/*.po')):
20+
po=polib.pofile(pofilename)
21+
ifpo.percent_translated()<85:
22+
continue
23+
24+
forentryinpo:
25+
words= []
26+
wordsid=wordsstr=list()
27+
28+
if'*'inentry.msgidor'``'inentry.msgid:
29+
wordsid= [wordforwordinentry.msgid.split()if'*'inwordor'``'inword]
30+
31+
if'*'inentry.msgstror'``'inentry.msgstr:
32+
wordsstr= [wordforwordinentry.msgstr.split()if'*'inwordor'``'inword]
33+
34+
iflen(wordsid)!=len(wordsstr):
35+
key=pofilename.replace(PO_DIR,'')
36+
files_with_differences[key].append({
37+
'occurrences':entry.occurrences,
38+
'words': {
39+
'original':wordsid,
40+
'translated':wordsstr,
41+
},
42+
})
43+
44+
returnfiles_with_differences
45+
46+
47+
pprint(main())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp