Permalink
Browse files

add utility to make a translations package, update notes

git-svn-id: https://svn.r-project.org/R/trunk@59858 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information...
ripley
ripley committed Jul 17, 2012
1 parent 96fa6ee commit 5f4f30f51fa6ddabd1a2964ae2f64f3cc1dfcd2f
View
@@ -1,5 +1,9 @@
NB: These instructions are only for R >= 2.16.0, and are under development.
+There is only support for preparing translations on a Unix-alike as a
+UTF-8 locale has to be used. (Apart from the RGui translations: see
+below.)
+
If you convert a C file for use with gettext, add it to POTFILES in
this directory.
@@ -11,23 +15,27 @@ updates the message catalogs for the C and R code in the interpreter
and standard packages. To update just one package, see
?tools::update-pkg-po .
-If you add a package with translations (hence not datasets), add it to
-R_PKGS_PO in po/Makefile.in. R-level template catalogs (R-pkg.pot)
-are produced automatically by 'make update-pkg-po' but for a C-level
-template catalog you need to touch src/library/pkg/po/pkg.pot: only do
-so once some messages have been marked for translation.
+If you add a package with messages that should be translated (hence
+not 'datasets'), add it to R_PKGS_PO in po/Makefile.in. R-level
+template catalogs (R-pkg.pot) are produced automatically by 'make
+update-pkg-po' but for a C-level template catalog you need to touch
+src/library/pkg/po/pkg.pot: only do so once some messages have been
+marked for translation.
For package translations, add the [R-]lang.po files to the package's
-po directory (and perhaps update THANKS). Note that translations for
-the interpreter itself are in src/library/base/po/R.pot.
+po directory (and perhaps update THANKS in this directory). Note that
+translations for the interpreter itself are in
+src/library/base/po/R.pot.
Note also tools::checkPoFiles().
R-core members: after updating translations, run
make update-pkg-po update-RGui
-and then commit the changes in the svn checkout.
+and then commit the changes in the svn checkout. See
+?tools::make_translations_pkg for how to distribute updated
+translations.
Windows RGui translations
@@ -49,7 +57,7 @@ See 'Writing R Extensions'.
Subversion note
===============
-If you need to add a en@auot directory, the current incantation appears to be
+If you need to add a en@quot directory, the current incantation appears to be
svn add .../en@quot@
View
@@ -1,6 +1,8 @@
## Static (i.e., not determined by configure) Make variables to be
## shared *and* grepped from m4/R.m4 and tools/*-recommended.
+## There is also 'translations', but that is not Priority: base
+## so it can be handled by update.packages() in due course.
R_PKGS_BASE = base tools utils grDevices graphics stats datasets methods grid splines stats4 tcltk compiler parallel
## Those which can be installed initially compiled (not base tools)
R_PKGS_BASE1 = utils grDevices graphics stats datasets methods grid splines stats4 tcltk parallel
@@ -6,23 +6,23 @@ export("Adobe_glyphs", "HTMLheader", "Rd2HTML", "Rd2ex", "Rd2latex",
"add_datalist", "bibstyle", "buildVignettes",
"charset_to_Unicode", "checkDocFiles", "checkDocStyle",
"checkFF", "checkMD5sums", "checkNEWS", "checkRd",
- "checkPoFile", "checkPoFiles", "checkRdaFiles", "checkReplaceFuns",
- "checkS3methods", "checkTnF", "checkVignettes", "codoc",
- "codocClasses", "codocData", "compactPDF", "delimMatch",
- "deparseLatex", "dependsOnPkgs", "encoded_text_to_latex",
- "file_ext", "file_path_as_absolute", "file_path_sans_ext",
- "findHTMLlinks", "getBibstyle", "getDepList",
- "installFoundDepends", "latexToUtf8", "list_files_with_exts",
- "list_files_with_type", "md5sum", "package.dependencies",
+ "checkPoFile", "checkPoFiles", "checkRdaFiles",
+ "checkReplaceFuns", "checkS3methods", "checkTnF",
+ "checkVignettes", "codoc", "codocClasses", "codocData",
+ "compactPDF", "delimMatch", "deparseLatex", "dependsOnPkgs",
+ "encoded_text_to_latex", "file_ext", "file_path_as_absolute",
+ "file_path_sans_ext", "findHTMLlinks", "getBibstyle",
+ "getDepList", "installFoundDepends", "latexToUtf8",
+ "list_files_with_exts", "list_files_with_type",
+ "make_translations_pkg", "md5sum", "package.dependencies",
"package_dependencies", "parseLatex", "parse_Rd", "pkgDepends",
"pkgVignettes", "pskill", "psnice", "read.00Index", "readNEWS",
"resaveRdaFiles", "showNonASCII", "showNonASCIIfile",
"startDynamicHelp", "testInstalledBasic",
"testInstalledPackage", "testInstalledPackages", "texi2dvi",
- "texi2pdf", "toHTML", "toRd", "undoc",
- "update_pkg_po",
- "vignetteDepends",
- "write_PACKAGES", "xgettext", "xgettext2pot", "xngettext")
+ "texi2pdf", "toHTML", "toRd", "undoc", "update_pkg_po",
+ "vignetteDepends", "write_PACKAGES", "xgettext",
+ "xgettext2pot", "xngettext")
exportPattern("^SIG.+")
@@ -313,3 +313,27 @@ update_RGui_po <- function(srcdir)
invisible()
}
+
+## make package out of current translations.
+make_translations_pkg <- function(srcdir, outDir = ".", append = "-1")
+{
+ src <- file.path(srcdir, "src/library/translations")
+ dest <- file.path(tempdir(), "translations")
+ dir.create(dest, FALSE)
+ file.copy(file.path(src, "inst"), dest, recursive = TRUE)
+ lines <- readLines(file.path(src, "DESCRIPTION.in"))
+ ver <- getRversion()
+ lines <- gsub("@VERSION@", ver, lines, fixed = TRUE)
+ lines[2] <- paste0(lines[2], append)
+ ver <- unclass(getRversion())[[1]]
+ deps <- sprintf("Depends: R (>= %s.%d.0), R (< %d.%d.0)",
+ ver[1], ver[2], ver[1], ver[2] + 1)
+ lines <- c(lines, deps)
+ writeLines(lines, file.path(dest, "DESCRIPTION"))
+ cmd <- file.path(R.home(), "bin", "R")
+ cmd <- paste(cmd, "CMD", "build", shQuote(dest))
+ if(system(cmd) != 0L) stop("R CMD build failed")
+ tarball <- Sys.glob(file.path(tempdir(), "translations_*.tar.gz"))
+ file.rename(tarball, file.path(outDir, basename(tarball)))
+ invisible()
+}
@@ -0,0 +1,35 @@
+% File src/library/tools/man/make_translations_pkg.Rd
+% Part of the R package, http://www.R-project.org
+% Copyright 2012 R Core Team
+% Distributed under GPL 2 or later
+
+\name{make_translations_pkg}
+\alias{make_translations_pkg}
+\title{
+ Package the Current Translations in the \R sources
+}
+\description{
+ A utility for R Core members to prepare a package of updated translations.
+}
+\usage{
+make_translations_pkg(srcdir, outDir = ".", append = "-1")
+}
+\arguments{
+ \item{srcdir}{The \R source directory.}
+ \item{outDir}{The directory into which to place the prepared package.}
+ \item{append}{The suffix for the package version number,
+ e.g. \code{2.16.0-1} will be the default in \R 2.16.0.}
+}
+\details{
+ This extracts the translations in a current \R source distribution and
+ packages them as a source package called \pkg{translations} which can
+ be distributed on CRAN and installed by
+ \code{\link{update.packages}}. This allows e.g. the translations
+ shipped in \R 2.16.0 to be updated to those currently in
+ \samp{R-patched}, even by a user without administrative privileges.
+
+ The package has a \samp{Depends} field which restricts it to versions
+ \code{2.x.*} for a single \code{x}.
+}
+
+\keyword{utilities}
@@ -1,4 +1,4 @@
-% File src/library/tools/man/xgettext.Rd
+% File src/library/tools/man/update_pkg_po.Rd
% Part of the R package, http://www.R-project.org
% Copyright 2012 R Core Team
% Distributed under GPL 2 or later

0 comments on commit 5f4f30f

Please sign in to comment.