Skip to content

Commit 2629bae

Browse files
Merge pull request #36 from r-devel/msgfmt-check
Run 'msgfmt' for patch files as a final check
2 parents 31961b2 + 134a849 commit 2629bae

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

web/Weblate-server.qmd

+16
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,22 @@ The basic idea is to compare the Weblate repo (which copies the R subversion rep
215215
216216
# REPLACE 'Report-Msgid-Bugs-To' metadata field pointing to #core-translation-po-bugs
217217
system2("sed", c("-i", "'s/[email protected]/bugs.r-project.org/'", po_summary$filename))
218+
219+
# CHECK msgfmt works -- 'make update*' commands run by R-core check this as well
220+
tmp <- tempfile()
221+
## NB: lapply() over for() to show all failures at once
222+
res <- suppressWarnings(lapply(
223+
po_summary$filename,
224+
\(po_file) system2("msgfmt", c("-c", "--statistics", "-o", tmp, po_file), stdout=TRUE, stderr=TRUE)
225+
))
226+
failed <- which(!sapply(res, \(r) is.null(attr(r, "status"))))
227+
if (length(failed)) {
228+
cat("'msgfmt' failed for some .po files:\n")
229+
for (idx in failed) {
230+
cat(sprintf(" %s:\n", red(po_summary$filename[idx])))
231+
writeLines(paste0(" ", res[[idx]]))
232+
}
233+
}
218234
```
219235

220236
1. Generate a patch file from the diff, going back to the most recent commit with translations merged, e.g.

0 commit comments

Comments
 (0)