sunlightlabs / scout

Government-wide search and notification website.
https://scout.sunlightfoundation.com
Other
50 stars 30 forks source link

Internationalization #445

Closed jpmckinney closed 10 years ago

jpmckinney commented 10 years ago

So, I will need to translate Scout to French, before the end of the year if things go according to schedule. Any opinions on libraries, or can I just use the I18n gem, as in the Sinatra docs? The I18n gem means there will be lots of symbols but little English in templates. If we prefer having English around, we can use a gettext library like fast_gettext.

konklone commented 10 years ago

Hmm. How does fast_gettext work, or rather - how does it work differently than i18n?

jpmckinney commented 10 years ago

fast_gettext looks like:

_("I'm in your templates, looking like English.")

I18n usually looks like:

t('a.nested.list.of.keys')

fast_gettext usually stores translations in PO files. I18n usually uses big hashes in YAML files. However, they each have a variety of backends, but their non-default backends are less well documented. fast_gettext is faster than I18n.

konklone commented 10 years ago

So with fast_gettext, you put your "default" text directly into the template, and it also acts as a key to access the other translations?

jpmckinney commented 10 years ago

Yeah, gettext is a very mature library, it can handle fuzzy matches, etc.

konklone commented 10 years ago

Cool - yeah, that's much more appealing to me.

jpmckinney commented 10 years ago

Sounds good, I'll use gettext when I get to that.