|
7 | 7 | importsys |
8 | 8 | importtempfile |
9 | 9 |
|
| 10 | +importpolib |
10 | 11 | importpospell |
11 | 12 |
|
12 | 13 |
|
@@ -44,7 +45,29 @@ def check_spell(po_files=None): |
44 | 45 | ifnotpo_files: |
45 | 46 | po_files=Path(".").glob("*/*.po") |
46 | 47 |
|
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) |
48 | 71 | returndetected_errors |
49 | 72 |
|
50 | 73 |
|
|