Improve bin/trans-lint.py

pull/8984/head
Benedikt Werner 2021-05-20 14:31:15 +02:00
parent 46d4a7d01a
commit beed1f8654
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB
1 changed files with 6 additions and 3 deletions

View File

@ -26,7 +26,7 @@ class Report:
def short_lang(lang):
if lang in ["ne-NP", "la-LA", "nn-NO", "zh-CN", "ur-PK", "zh-TW", "tlh-AA"]:
if lang in ["ne-NP", "la-LA", "nn-NO", "zh-CN", "ur-PK", "zh-TW", "tlh-AA", "ml-IN", "pt-BR", "tt-RU"]:
return lang.replace("-", "").lower()
elif lang == "kab-DZ":
return "kaby"
@ -48,7 +48,7 @@ def ends_with_punctuation(text):
def crowdin_q(text):
return urllib.parse.quote((text or "").replace("\\\"", "\""))
return urllib.parse.quote(text or "")
class ReportContext:
@ -57,7 +57,7 @@ class ReportContext:
self.path = path
self.el = el
self.name = name
self.text = text
self.text = text.replace("\\\"", "\"").replace("\\'", "'")
def lang(self):
return self.path.stem
@ -109,6 +109,9 @@ def lint(report, path):
def lint_string(ctx, dest, source, allow_missing=0):
dest = dest.replace("\\\"", "\"").replace("\\'", "'")
source = source.replace("\\\"", "\"").replace("\\'", "'")
if not dest:
ctx.error("empty translation")
return