locales icon indicating copy to clipboard operation
locales copied to clipboard

Using runtime locale?

Open sharpner opened this issue 7 years ago • 3 comments

Is there a way to load locales based on a runtime variable?

I'd rather not import every package prior to knowing the locale. :)

sharpner avatar Dec 18 '17 08:12 sharpner

Hey @sharpner

I did use to have code generated that would accept the local string eg. en_US I did end up removing it however as having all the locales imported dramatically increases you're compile time and binary size; because the locale is found at runtime that means ALL locales will be compiled and included in your binary, even if you only use one.

however I have had a few people ask about it, so as long as the tradeoffs aren't a big deal I'll add it back next time I regenerate.

deankarn avatar Dec 18 '17 16:12 deankarn

I understand. Thanks for keeping it in mind :)

sharpner avatar Dec 19 '17 07:12 sharpner

https://github.com/bep/gotranslators

bep avatar Jul 26 '21 17:07 bep