Open hadley opened 2 years ago
R is using _
:
https://github.com/wch/r-source/tree/trunk/src/library/base/po
I hadn't come across BCP 47, but noted this in ?translate_package
:
The input to
languages
conform to the valid languages accepted bygettext
. This almost always takes the form of (1) an ISO 639 2-letter language code; or (2)ll_CC
, wherell
is an ISO 639 2-letter language code andCC
is an ISO 3166 2-letter country code... SeeSys.getlocale
for some helpful tips... and see the References below for some web resources listing more locales.
?Sys.getlocale
mentions locale -a
, and man locale
eventually mentions those two ISO codes:
https://man7.org/linux/man-pages/man5/locale.5.html
This page for man setlocale
mentions the _
a bit more explicitly:
https://www.systutorials.com/docs/linux/man/3-setlocale/
But I still don't see anything about a standard governing _
vs -
...
Oh, actually just found this SO Q&A... seems inconclusive, but seems to reaffirm my own sense, namely that web uses tend to stick with -
:
https://stackoverflow.com/q/6152321/3576984
For potools
purposes I would try & match what base
is doing, absent any strong reason to switch
Leaving open for now -- it's not genuinely not the first (or second, or third) time I've tried to answer this rather pedantic question, so leaving around notes & references will be for the best.
I like the idea of taking either -
or _
and then always generating _
on disk. Maybe withr::set_language()
should also be agnostic to this.
that makes sense. and would play better with users mixing package and webpage translations
https://github.com/MichaelChirico/potools#picking-a-domain-for-diasporic-languages uses
_
, but BCP 47 uses-