From 6af038e57a69834105c07cd08ce09ba3ccf10ed7 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 29 Oct 2023 22:14:23 -0700 Subject: [PATCH] tidy-up for CRAN submission --- .Rbuildignore | 1 + DESCRIPTION | 6 +++--- R/translate_package.R | 2 +- man/po_update.Rd | 6 ++++-- man/potools-package.Rd | 9 +++------ man/translate_package.Rd | 20 ++++++++++++++------ vignettes/translators.Rmd | 2 +- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index b1f38ab1..94ddea8c 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,5 +7,6 @@ ^\.sandbox$ ^codecov\.yml$ ^_pkgdown\.yml$ +^\.lintr$ ^docs$ ^pkgdown$ diff --git a/DESCRIPTION b/DESCRIPTION index 17c8aeb3..1c5ed458 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: potools Title: Tools for Internationalization and Portability in R Packages -Version: 0.2.3 +Version: 0.2.4 Authors@R: c( person("Michael", "Chirico", , "MichaelChirico4@gmail.com", role = c("cre", "aut")), person("Hadley", "Wickham", role = "aut") @@ -12,7 +12,7 @@ Description: Translating messages in R packages is managed using the po common validation & I/O tasks. License: GPL-3 URL: https://github.com/MichaelChirico/potools, - https://michaelchirico.github.io/potools + https://michaelchirico.github.io/potools/ BugReports: https://github.com/MichaelChirico/potools/issues Depends: R (>= 4.0.0) @@ -29,5 +29,5 @@ VignetteBuilder: Config/testthat/edition: 3 Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 SystemRequirements: gettext diff --git a/R/translate_package.R b/R/translate_package.R index d17b000c..19a39382 100644 --- a/R/translate_package.R +++ b/R/translate_package.R @@ -268,7 +268,7 @@ #' \cr #' #' \cr \cr -#' \cr +#' \cr #' \cr #' #' \cr diff --git a/man/po_update.Rd b/man/po_update.Rd index 5f6dc463..7b2132db 100644 --- a/man/po_update.Rd +++ b/man/po_update.Rd @@ -23,11 +23,13 @@ There are four cases: \item New messages: added with blank \code{msgstr}. \item Deleted messages: marked as deprecated and moved to the bottom of the file. \item Major changes to existing messages: appear as an addition and a deletion. -\item Minor changes to existing messages: will be flagged as fuzzy.\preformatted{#, fuzzy, c-format +\item Minor changes to existing messages: will be flagged as fuzzy. + +\if{html}{\out{
}}\preformatted{#, fuzzy, c-format #| msgid "Generating en@quot translations" msgid "Updating '\%s' \%s translation" msgstr "memperbarui terjemahan bahasa en@quot..." -} +}\if{html}{\out{
}} The previous message is given in comments starting with \verb{#|}. Translators need to update the actual (uncommented) \code{msgstr} manually, diff --git a/man/potools-package.Rd b/man/potools-package.Rd index 9b83519b..6831066a 100644 --- a/man/potools-package.Rd +++ b/man/potools-package.Rd @@ -6,18 +6,15 @@ \alias{potools-package} \title{potools: Tools for Internationalization and Portability in R Packages} \description{ -\if{html}{\figure{logo.png}{options: align='right' alt='logo' width='120'}} +\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} -Translating messages in R packages is managed using the po - top-level directory and the 'gettext' program. This package provides - some helper functions for building this support in R packages, e.g. - common validation & I/O tasks. +Translating messages in R packages is managed using the po top-level directory and the 'gettext' program. This package provides some helper functions for building this support in R packages, e.g. common validation & I/O tasks. } \seealso{ Useful links: \itemize{ \item \url{https://github.com/MichaelChirico/potools} - \item \url{https://michaelchirico.github.io/potools} + \item \url{https://michaelchirico.github.io/potools/} \item Report bugs at \url{https://github.com/MichaelChirico/potools/issues} } diff --git a/man/translate_package.Rd b/man/translate_package.Rd index c31ed826..ace013a9 100644 --- a/man/translate_package.Rd +++ b/man/translate_package.Rd @@ -6,7 +6,7 @@ \usage{ translate_package( dir = ".", - languages, + languages = NULL, diagnostics = list(check_cracked_messages, check_untranslated_cat, check_untranslated_src), custom_translation_functions = list(R = NULL, src = NULL), @@ -132,7 +132,9 @@ interface to continue building translations for your workflow. Suppose you wrote a function \code{stopf()} that is a wrapper of \code{stop(gettextf())} used to build templated error messages in R, which makes -translation easier for translators (see below), e.g.:\if{html}{\out{
}}\preformatted{stopf = function(fmt, ..., domain = NULL) \{ +translation easier for translators (see below), e.g.: + +\if{html}{\out{
}}\preformatted{stopf = function(fmt, ..., domain = NULL) \{ stop(gettextf(fmt, ...), domain = domain, call. = FALSE) \} }\if{html}{\out{
}} @@ -140,7 +142,9 @@ translation easier for translators (see below), e.g.:\if{html}{\out{
}}\preformatted{get_message_data( +\code{custom_translation_functions}: + +\if{html}{\out{
}}\preformatted{get_message_data( '/path/to/my_package', custom_translation_functions = list(R = 'stopf:fmt|1') ) @@ -198,7 +202,9 @@ the \code{\link[=check_untranslated_src]{check_untranslated_src()}} diagnostic, \subsection{Cracked messages}{ -A cracked message is one like:\if{html}{\out{
}}\preformatted{stop("There are ", n, " good things and ", m, " bad things.") +A cracked message is one like: + +\if{html}{\out{
}}\preformatted{stop("There are ", n, " good things and ", m, " bad things.") }\if{html}{\out{
}} In its current state, translators will be asked to translate three messages @@ -213,7 +219,9 @@ The message has been cracked; it might not be possible to translate a string as generic as "There are" into many languages -- context is key! To keep the context, the error message should instead be build with -\code{gettextf} like so:\if{html}{\out{
}}\preformatted{stop(domain=NA, gettextf("There are \%d good things and \%d bad things.")) +\code{gettextf} like so: + +\if{html}{\out{
}}\preformatted{stop(domain=NA, gettextf("There are \%d good things and \%d bad things.")) }\if{html}{\out{
}} Now there is only one string to translate! Note that this also allows the @@ -316,7 +324,7 @@ rm(pkg, tmp_pkg) \cr \url{https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Internationalization-in-the-R-sources} \cr \url{https://developer.r-project.org/Translations30.html} \cr -\url{https://www.isi-web.org/publications/glossary-of-statistical-terms} \cr +\url{https://web.archive.org/web/20230108213934/https://www.isi-web.org/resources/glossary-of-statistical-terms} \cr \url{https://www.gnu.org/software/gettext/} \cr \url{https://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html#Usual-Language-Codes} \cr diff --git a/vignettes/translators.Rmd b/vignettes/translators.Rmd index f708ef23..89e9860e 100644 --- a/vignettes/translators.Rmd +++ b/vignettes/translators.Rmd @@ -220,7 +220,7 @@ It's a little tricky to go from the C code to a human description of the cases, ## Other issues Technical terms are par for the course in R packages; showing users similar terms for the same concept might lead to needless confusion. -R recommends using the [ISI Multilingual Glossary of Statistical Terms](https://www.isi-web.org/publications/glossary-of-statistical-terms) to help overcome this issue. +R recommends using the [ISI Multilingual Glossary of Statistical Terms](https://web.archive.org/web/20230108213934/https://www.isi-web.org/resources/glossary-of-statistical-terms) to help overcome this issue. ## Trying out your work