Skip to content

Instantly share code, notes, and snippets.

@leeper
Last active August 29, 2015 14:17
Show Gist options
  • Save leeper/194118e9289477c407fe to your computer and use it in GitHub Desktop.
Save leeper/194118e9289477c407fe to your computer and use it in GitHub Desktop.
Package message translations
1. Install GNU gettext (on Windows, this can be obtained from the Rtools site: http://www.stats.ox.ac.uk/pub/Rtools/goodies/gettext-tools.zip)
2. Run `update_pkg_po()` (https://stat.ethz.ch/R-manual/R-devel/library/tools/html/update_pkg_po.html)
a. Create `/po` if it does not exist
b. Call `xgettext2pot()` to create/update `po/R-pkgname.pot` file
c. All `R-lang.po` files in `/po` are updated from `po/R-pkgname.pot` using `msgmerge`
d. `checkPoFiles()` is called on updated files
e. If check is successful, messages are compiled using `msgfmt` system call and installed in `/inst/po`.
f. In a UTF-8 locale, a ‘translation’ ‘[email protected]’ is created with UTF-8 directional quotes, compiled and installed under ‘inst/po’.
g. If `po/pkg.pot` exists:
i. `/src` is examined to create `/po/pkg.pot`
ii. All `po/lang.po` files are updated from `/po/pkg.pot`
iii. `checkPoFiles()` is called on updated files
iv. If check is successful, messages are compiled using `msgfmt` and installed in `/inst/po`.
v. In a UTF-8 locale, a ‘translation’ ‘[email protected]’ is created with UTF-8 directional quotes, compiled and installed under ‘inst/po’.
3. Edit `/po/R-pkg-lang.po` and `/po/pkg-lang.po` files by hand!
4. Rerun `update_pkg_po()`
References
- http://cran.r-project.org/doc/manuals/r-release/R-admin.html#Localization-of-messages
- http://developer.r-project.org/Translations30.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment