浏览代码

chore: Fix translation syntax check

version-14
Suraj Shetty 4 年前
父节点
当前提交
da166c3db9
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      .github/helper/translation.py

+ 2
- 2
.github/helper/translation.py 查看文件

@@ -2,7 +2,7 @@ import re
import sys import sys


errors_encounter = 0 errors_encounter = 0
pattern = re.compile(r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,\s*(.)*?\s*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)")
pattern = re.compile(r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,(\s*?.*?\n*?)*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)")
words_pattern = re.compile(r"_{1,2}\([\"'`]{1,3}.*?[a-zA-Z]") words_pattern = re.compile(r"_{1,2}\([\"'`]{1,3}.*?[a-zA-Z]")
start_pattern = re.compile(r"_{1,2}\([f\"'`]{1,3}") start_pattern = re.compile(r"_{1,2}\([f\"'`]{1,3}")
f_string_pattern = re.compile(r"_\(f[\"']") f_string_pattern = re.compile(r"_\(f[\"']")
@@ -36,7 +36,7 @@ for _file in files_to_scan:
match = pattern.search(line) match = pattern.search(line)
error_found = False error_found = False


if not match and line.endswith((',\n', '[')):
if not match and line.endswith((',\n', '[\n')):
# concat remaining text to validate multiline pattern # concat remaining text to validate multiline pattern
line = "".join(file_lines[line_number - 1:]) line = "".join(file_lines[line_number - 1:])
line = line[start_matches.start() + 1:] line = line[start_matches.start() + 1:]


正在加载...
取消
保存