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

Commit9448c5d

Browse files
cacrespocmaureir
andauthored
Workaround to fix code snippets issues on pospell (#3346)
Related to#3324.Co-authored-by: Cristián Maureira-Fredes <cmaureir@users.noreply.github.com>
1 parent3754a90 commit9448c5d

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

‎scripts/check_spell.py‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
importsys
88
importtempfile
99

10+
importpolib
1011
importpospell
1112

1213

@@ -44,7 +45,29 @@ def check_spell(po_files=None):
4445
ifnotpo_files:
4546
po_files=Path(".").glob("*/*.po")
4647

47-
detected_errors=pospell.spell_check(po_files,personal_dict=output_filename,language="es_ES")
48+
# Workaround issue #3324 FIXME
49+
# It seems that all code snippets have line breaks '\n'. This causes the
50+
# currently indentation issues.
51+
52+
# Create temporary copies of the original files.
53+
po_files_tmp= []
54+
forpo_fileinpo_files:
55+
withopen(tempfile.mktemp(),"w")astemp_file:
56+
# Copy content of the .po file
57+
withopen(po_file,"r",encoding="utf-8")asf:
58+
temp_file.write(f.read())
59+
po_files_tmp.append(temp_file.name)
60+
61+
# Don't translate probably code entries
62+
polib_temp_file=polib.pofile(temp_file.name)
63+
forentryinpolib_temp_file:
64+
if"\n"inentry.msgid:
65+
entry.msgstr=""
66+
polib_temp_file.save()
67+
68+
detected_errors=pospell.spell_check(po_files_tmp,personal_dict=output_filename,language="es_ES")
69+
fortmp,originzip(po_files_tmp,po_files):
70+
print(tmp," == ",orig)
4871
returndetected_errors
4972

5073

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp