ruby-gettext / gettext

Gettext gem is a pure Ruby Localization(L10n) library and tool which is modeled after the GNU gettext package.
https://ruby-gettext.github.io/
69 stars 28 forks source link

Question about detect_locales #50

Closed mcfilib closed 7 years ago

mcfilib commented 7 years ago

In the detect_locales method, there's a regex that is used to determine whether a directory looks like a valid locale name.

This is useful for detecting the common case i.e. when a locale is a primary code (cs) or a primary code followed by a secondary code (cs_CZ) but when you have the character encoding e.g. cs_CZ.UTF-8 it fails to detect the locale.

Is there a rationale behind this choice?

mcfilib commented 7 years ago

In addition to this, according to the gettext docs, it is not unreasonable to include further data after an @ symbol e.g. cs_CZ@corporate. I appreciate this is unlikely to be the common case but was curious whether you had considered these two cases.

mcfilib commented 7 years ago

I've been able to work around this by explicitly setting locales= myself. Seems reasonable.