I attached a proposed bug fix which solves the problems reported above. I believe that the patch does not break anything. The affected file is src/library/tools/R/xgettext.R
I found and fixed a related bug in the extraction of arguments "msg1" and "msg2" of ngettext() by xgettext2pot(). Let's call this bug 2. It was marked with a "FIXME" comment in xgettext.R.
Also, a duplicate entry with an empty msgid would be produced if "ordinary translations", i.e. not due to ngettext(), were not found. Let's call this bug 3. The patch also corrects this.
A combined example of bugs 2 and 3, in the style of the previously attached minimal example packages, is in the attached package "Foo6". Results of running "make pkg-update PKG=Foo6 PKGDIR=/path/to/pkg":
Actual Results:
msgid ""
msgstr ""
Expected Results:
msgid "message 1"
msgid_plural "message 2"
In addition to the unexpected results in the .pot file, the following error message was produced by a non-patched R:
creating R-Foo6.pot and translations
en@quot:/usr/bin/msgfmt: R-en@quot.po: warning: PO file header missing or invalid
warning: charset conversion will not work
/usr/bin/msgfmt: found 1 fatal error
done.
After applying the bug fix, the error is eliminated.
Build Date & Platform (relevant parts of R were unchanged between r59485 and r59517):
> R.version
_
platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status Patched
major 2
minor 15.0
year 2012
month 06
day 04
svn rev 59517
language R
version.string R version 2.15.0 Patched (2012-06-04 r59517)
nickname Easter Beagle

Thanks for the patches.
BTW, we generally apply patches to the trunk version (R-devel), and then port them to the branches. There were several changes to that file in the trunk since the version you were working from, but they didn't affect the patch.

Thanks for fixing this!
Good that you noticed an error in my patch: when arguments 'msg1' and 'msg2' are correctly identified, of course it is still necessary to check that they have character values. Sorry. This would have introduced more spurious strings to the translation template.
I noticed that no changes were made to find_strings2(), up to and including snapshot R-devel_2012-06-14, svn revision 59564. Therefore, the bugs demonstrated in packages "Foo2" and "Foo4" still remain. I am just trying to make sure you did not miss that part of the patch. Thanks again!

On 12-06-15 10:29 AM, r-bugs@r-project.org wrote:
> https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14935
>
> --- Comment #9 from Mikko Korpela<mvkorpel@iki.fi> 2012-06-15 10:29:46 EDT ---
> Thanks for fixing this!
>
> Good that you noticed an error in my patch: when arguments 'msg1' and 'msg2'
> are correctly identified, of course it is still necessary to check that they
> have character values. Sorry. This would have introduced more spurious strings
> to the translation template.
>
> I noticed that no changes were made to find_strings2(), up to and including
> snapshot R-devel_2012-06-14, svn revision 59564. Therefore, the bugs
> demonstrated in packages "Foo2" and "Foo4" still remain. I am just trying to
> make sure you did not miss that part of the patch. Thanks again!
>
I thought that I applied the patch, but perhaps some of it was missed.
I'll take another look later.
Duncan Murdoch