available_locales

256 views
Skip to first unread message

Sven Fuchs

unread,
Jan 8, 2009, 6:16:18 PM1/8/09
to rails-i18n
I've just added available_locales to I18n http://github.com/svenfuchs/i18n/commit/411f8fe7c8f3f89e9b6b921fa62ed66cb92f3af4

This has been a common request in the past already. Today David pinged me about it, too, because it's necessary for the translated views feature that's about to be added to Rails 2.3 (think index.en.html.erb vs index.de.html.erb).

I assume there are no objections anyway? Otherwise, speak up now :)

Iain Hecker

unread,
Jan 8, 2009, 6:30:10 PM1/8/09
to rails...@googlegroups.com
Sven,

Looks nice!

Iain

Chris Cruft

unread,
Jan 9, 2009, 8:17:46 AM1/9/09
to rails-i18n
Sven,
As a big proponent in the past, I'm glad to see it available in core.

-Chris
PS -nice to re-establish contact!

On Jan 8, 6:16 pm, Sven Fuchs <svenfu...@artweb-design.de> wrote:
> I've just added available_locales to I18nhttp://github.com/svenfuchs/i18n/commit/411f8fe7c8f3f89e9b6b921fa62ed...

Sven Fuchs

unread,
Jan 9, 2009, 9:41:43 AM1/9/09
to rails...@googlegroups.com
On 09.01.2009, at 14:17, Chris Cruft wrote:
> PS -nice to re-establish contact!

definitely :)

Iain Hecker

unread,
Jan 9, 2009, 10:51:16 AM1/9/09
to rails...@googlegroups.com
I was thinking: because of the localized views in Rails 2.3, shouldn't
I18n have a fallback mechanism like Globalize2?

Iain

Andreas Neuhaus

unread,
Jan 9, 2009, 3:03:10 PM1/9/09
to rails-i18n


On 9 Jan., 00:16, Sven Fuchs <svenfu...@artweb-design.de> wrote:
> I've just added available_locales to I18nhttp://github.com/svenfuchs/i18n/commit/411f8fe7c8f3f89e9b6b921fa62ed...
:
> I assume there are no objections anyway? Otherwise, speak up now :)

Nice. I'm glad that it got included in the end - I was about to
suggest something similar to list available locales :-). Not only for
upcoming translated views - I found a few other use cases where this
method becomes handy (posted a few in http://zargony.com/2009/01/09/selecting-the-locale-for-a-request).

How about another small method like the following:

def locale_exists? (locale)
available_locales.include?(locale.to_sym)
end

regards,
Andreas Neuhaus
http://zargony.com/

Karel Minarik

unread,
Jan 10, 2009, 11:43:33 AM1/10/09
to rails-i18n
> > I've just added available_locales to I18nhttp://github.com/svenfuchs/i18n/commit/411f8fe7c8f3f89e9b6b921fa62ed...

Many thanks for that, Sven!


> How about another small method like the following:
> def locale_exists? (locale)

In my eyes this is *precisely* the sort of thing which should be left
for i18n implementers to solve by their own logic/needs/
peculiarities :)

Karel
Reply all
Reply to author
Forward
0 new messages