potools icon indicating copy to clipboard operation
potools copied to clipboard

es_AR or es-AR?

Open hadley opened this issue 4 years ago • 5 comments

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

hadley avatar Nov 01 '21 18:11 hadley

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 avatar Nov 06 '21 19:11 MichaelChirico

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 avatar Nov 06 '21 19:11 MichaelChirico

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.

MichaelChirico avatar Nov 06 '21 19:11 MichaelChirico

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

hadley avatar Nov 06 '21 20:11 hadley

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

MichaelChirico avatar Nov 06 '21 23:11 MichaelChirico