MichaelChirico / potools

Tools for working with translations in R
https://michaelchirico.github.io/potools/
58 stars 3 forks source link

es_AR or es-AR? #236

Open hadley opened 2 years ago

hadley commented 2 years ago

https://github.com/MichaelChirico/potools#picking-a-domain-for-diasporic-languages uses _, but BCP 47 uses -

MichaelChirico commented 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 by gettext. This almost always takes the form of (1) an ISO 639 2-letter language code; or (2) ll_CC, where ll is an ISO 639 2-letter language code and CC is an ISO 3166 2-letter country code... See Sys.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 -...

MichaelChirico commented 2 years ago

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

MichaelChirico commented 2 years ago

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.

hadley commented 2 years ago

I like the idea of taking either - or _ and then always generating _ on disk. Maybe withr::set_language() should also be agnostic to this.

MichaelChirico commented 2 years ago

that makes sense. and would play better with users mixing package and webpage translations