Skip to content

Commit

Permalink
Reorganize .po linters for extensibility, similarity to other checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Sep 30, 2024
1 parent a301276 commit 8d27fba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .ci/linters/po/incomplete_translation_linter.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
incomplete_translation_linter <- function(po_file) {
res = system2("msgfmt", c("--statistics", po_file, "-o", tempfile()), stdout=TRUE, stderr=TRUE)
if (any(grepl("untranslated message|fuzzy translation", res))) {
cat(sprintf("In %s, found incomplete translations:\n%s\n", po_file, paste(res, collapse="\n")))
stop("Please fix.")
}
}
7 changes: 0 additions & 7 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ jobs:
linter_env = new.env()
for (f in list.files('.ci/linters/po', full.names=TRUE)) sys.source(f, linter_env)
for (po_file in list.files(pattern = "[.]po$", full.names=TRUE)) {
# only pay attention to files edited in the current PR, otherwise we can get
# a situation like after #6424 where some untranslated messages were added
# as part of non-translation maintenance, but this GHA would go red repeatedly
# until a translation is added or the blank/fuzzy translations removed. We'd
# rather only have the failure on one PR, then ignore these files later.
diff_v_master = system2("git", c("diff", "master", po_file), stdout=TRUE)
if (!length(diff_v_master)) next
for (linter in ls(linter_env)) linter_env[[linter]](po_file)
}
shell: Rscript {0}
Expand Down

0 comments on commit 8d27fba

Please sign in to comment.