I'm trying to add en_SG
translations to an R package, but I'm met with a gettext error and I haven't seen any source on what's the issue:
list.files('po')
# [1] "R-myPkg.pot"
# [2] "R-en_SG.po"
tools::update_pkg_po('.')
has output:
R-en_SG:. done.
msgfmt: po/R-en_SG.po: warning: PO file header missing or invalid
warning: charset conversion will not work
msgfmt: found 1 fatal error
Warning in tools::update_pkg_po(".") :
running msgfmt on R-en_SG.po failed
R-en@quot:
2 translated messages.
What exactly am I missing?
PO files should have a "header" which is really an entry with a translation for the empty string. It looks like this:
This header contains meta information for the catalog, for example the encoding of the PO file in the
Content-Type
header field. You are missing this header field.I don't know how you generate the file
po/R-en_SG.po
but you have to ensure that it contains at least a minimal PO header. In doubt, you have to add it manually.