diff --git a/check_strings.py b/check_strings.py index 76713810..6addc898 100755 --- a/check_strings.py +++ b/check_strings.py @@ -40,7 +40,7 @@ def check_duplicate_values(strings): seen[v] = k -def check_prefixes(k, v, s_max_words, s_max_len): +def check_prefixes(k, v, s_max_words, s_max_len, punctuation, q_endings): errs = [] if k.startswith("s_"): if len(v) > s_max_len: @@ -53,11 +53,11 @@ def check_prefixes(k, v, s_max_words, s_max_len): if ". " in v: errs.append("Spans multiple sentences") elif k.startswith("p_"): - if v[-1] not in ".!": + if punctuation and not any(v.endswith(p) for p in punctuation): errs.append("Doesn't end in punctuation") elif k.startswith("q_"): - if not v.endswith("?"): - errs.append("Doesn't end in '?'") + if q_endings and not any(v.endswith(q) for q in q_endings): + errs.append("Doesn't end in question mark.") return errs @@ -79,6 +79,8 @@ def lint_strings(strings, rules): v, rules.get("s_max_words", 4), rules.get("s_max_len", 32), + rules.get("punctuation", [".", "!"]), + rules.get("q_endings", ["?"]), ) ) errs.extend(check_misc(k, v)) diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 967772d8..42c0d697 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -16,6 +16,8 @@ }, "@_lint_rules": { + "punctuation": ["。", "!"], + "q_endings": ["?", "?"], "s_max_words": 4, "s_max_length": 32 },