MichaelChirico / potools

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

Don't create en@quot translation? #232

Open hadley opened 3 years ago

hadley commented 3 years ago

It doesn't seem useful. OTOH I can't understand what it's supposed to do, so maybe it is useful and I just don't know why.

MichaelChirico commented 3 years ago

My understanding is it's just about adding "pretty" directional quotes. See https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Localization-of-messages.

It could certainly be an option to turn off, but will need to be kept for translating R itself.

hadley commented 3 years ago

You mean like “” vs ""?

Is this a different system to options(useFancyQuotes) + shQuote()?

HenrikBengtsson commented 3 years ago

... shQuote() ...

Just in case others spot this, I think you meant sQuote() and dQuote().

MichaelChirico commented 3 years ago

Yes, e.g.

Sys.setenv(LANGUAGE='en@quot')
gettext("candidate point in 'optim' evaluated to length %d not %d", domain="R")
# [1] "candidate point in ‘optim’ evaluated to length %d not %d"

https://www.gnu.org/software/gettext/manual/html_node/po_002fRules_002d_002a.html

It's also unrelated to useFancyQuotes (from grep-ing the source, I only see this option mentioned in the signature of sQuote() and dQuote()):

options(useFancyQuotes = FALSE)
sQuote('hi')
Sys.setenv(LANGUAGE='en@quot')
gettext("candidate point in 'optim' evaluated to length %d not %d", domain="R")
# [1] "candidate point in 'optim' evaluated to length %d not %d"
hadley commented 3 years ago

I think your example got slightly mangled — your explanation is correctly but the code doesn't show it.

options(useFancyQuotes = FALSE)
sQuote('hi')
#> [1] "'hi'"
Sys.setenv(LANGUAGE='en@quot')
gettext("candidate point in 'optim' evaluated to length %d not %d", domain="R")
#> [1] "candidate point in ‘optim’ evaluated to length %d not %d"

Created on 2021-11-05 by the reprex package (v2.0.1)

MichaelChirico commented 3 years ago

Yep... copy/pasted from the wrong example, thanks