[Rd] [patch] Fix automatic domain in ngettext(), Bug 14605

Mikko Korpela mikko.korpela at aalto.fi
Mon Dec 14 18:45:35 CET 2015


A short overview of the problem: Automatic domain in ngettext() does not
work when used inside a package.

How to test:
1. Download the small test package "minimal_1.0-0.tar.gz" attached to
the bug report.
2. As the package contains Finnish translations, start R with Finnish
language settings. Prepending "LANGUAGE=fi " to the command line that
starts R works for me on Linux, if there are no conflicting settings in
the R startup files.
3. Run the following commands:
   library(minimal)
   test.with.domain()
   test.without.domain()
4. If all the text you see is in English, the language setting was not
applied correctly. Otherwise, if the test functions produced different
output, the problem has been demonstrated.

After applying the change in the attached file, the test functions
produce identical output, which means that ngettext() uses the package
translation domain if no other domain is specified.

I also think that ‘ngettext’ should probably be mentioned in this
paragraph of the ?gettext manual:

>     If ‘domain’ is ‘NULL’ or ‘""’, and ‘gettext’ is called from a
>     function in the namespace of package ‘pkg’ the domain is set to
>     ‘"R-pkg"’.  Otherwise there is no default domain.

At least "1.8.2 R messages" in R-exts implies that automatic domain
applies to ngettext(), too.

Tested on "R Under development (unstable) (2015-12-14 r69773)",
Platform: x86_64-pc-linux-gnu (64-bit).

-- 
Mikko Korpela
Aalto University School of Science
Department of Computer Science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: errors.diff
Type: text/x-patch
Size: 375 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20151214/88ef03d3/attachment.bin>


More information about the R-devel mailing list