R/po_directory.R

Defines functions make_po_dir template_path translation_path

make_po_dir <- function(pkg = ".", verbose = getOption("verbose")) {
    pkg <- as.package(pkg)
    po_dir <- file.path(pkg$path, "po")
    if (dir.exists(po_dir)) {
        return(po_dir)
    }
    if (isTRUE(verbose)) {
        message(sprintf("Creating the directory", "'po'"))
    }
    dir.create(po_dir, FALSE)
    return(po_dir)
}

template_path <- function(pkg = ".", domain = "R") {
    pkg <- as.package(pkg)
    file.path(pkg$path, "po", paste0(if(domain %in% c("r","R")) "R-" else NULL, pkg$package, ".pot"))
}

translation_path <- function(language, pkg = ".", domain = "R") {
    pkg <- as.package(pkg)
    file.path(pkg$path, "po", paste0(if(domain %in% c("R", "r")) "R-" else NULL, language, ".po"))
}

Try the msgtools package in your browser

Any scripts or data that you put into this service are public.

msgtools documentation built on May 30, 2017, 5:12 a.m.