File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232po_update <- function (dir = " ." , lazy = TRUE , verbose = ! is_testing()) {
3333 meta <- get_po_metadata(dir )
3434 if (lazy ) {
35- meta <- meta [is_outdated(meta $ pot , meta $ po )]
35+ is_old <- is_outdated(meta $ pot , meta $ po )
36+ if (verbose ) {
37+ for (ii in which(! is_old )) {
38+ row_ii <- meta [ii ]
39+ catf(" Skipping '%s' %s translation (up-to-date)\n " , row_ii $ language , row_ii $ type )
40+ }
41+ }
42+ meta <- meta [is_old ]
3643 }
3744
3845 for (ii in seq_len(nrow(meta ))) {
Original file line number Diff line number Diff line change @@ -26,3 +26,26 @@ test_that("user is told what's happening", {
2626
2727 expect_false(file.exists(file.path(temp , " po/R-fr.po~" )))
2828})
29+
30+ test_that(" lazy=TRUE, verbose=TRUE skips up-to-date files and messages" , {
31+ temp <- local_test_package(" R/test.r" = " message('Hello')" )
32+ withr :: local_dir(temp )
33+
34+ po_extract()
35+ po_create(" ja" )
36+
37+ # run once to make sure it's "up-to-date"
38+ po_update()
39+
40+ # Ensure mtime is different.
41+ Sys.sleep(1.25 )
42+
43+ expect_silent(
44+ po_update(lazy = TRUE , verbose = FALSE )
45+ )
46+ expect_output(
47+ po_update(lazy = TRUE , verbose = TRUE ),
48+ " Skipping 'ja' R translation (up-to-date)" ,
49+ fixed = TRUE
50+ )
51+ })
You can’t perform that action at this time.
0 commit comments