-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize .po linters for extensibility, similarity to other checks
- Loading branch information
1 parent
8476fdd
commit 635f953
Showing
4 changed files
with
22 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tools_check_linter = function(po_file) { | ||
res = tools::checkPoFile(po_file, strictPlural=TRUE) | ||
if (NROW(res)) { | ||
print(res) | ||
stop("Fix the above .po file issues.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
utf8_linter <- function(po_file) { | ||
if (!any(grepl("charset=UTF-8", readLines(po_file), fixed=TRUE))) | ||
stop("In ", po_file, ", please use charset=UTF-8.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters