Hi Don,

not sure, but here's a quick answer.

How about using with_options?

with_options :scope => :scope do |s|
   s.t(:key)
end

calls t(:key, :scope => :scope)


On 30.12.2008, at 13:14, Don Darone wrote:

>
> Hi,
>
> we recently switched to Rails 2.2 and with that, also from the
> simple_localization plugin to Rails core localization.
>
> Since the plugin had two nice features that I couldn't find yet in
> Rails core, I was wondering whether some of you already addressed
> them.
>
> In Rails localization you can add a scope to a single translation
> using t(:my_key, :scope => 'general.scope')
>
> 1. Scope blocks
> In simple_localization you could open a block and let every
> translation in there have the same scope, which was quite helpful
> sometimes:
> l_scope 'general_scope' do
>  t(:my_key)
>  t(:next_key)
>  t(:other_key)
> end
> (I omitted the Erb stuff to just give the idea).
>
> 2. Scope contexts
> In simple_localization you could use another method called lc to use
> the scope of the context you are in, which was determined by the file
> it was in. For example in a settings_controller, you could use lc
> (:heading) which would correspond to t(:heading, :scope => 'settings')
> for Rails core.
>
> In a views/settings/list.html.erb you could to lc(:heading) to
> automatically get a scope 'settings.list', like calling t
> (:heading, :scope => 'settings.list')
>
>
> I found these features very cool and was just wondering whether some
> of you would miss them, too ;-)
>
>
> Thanks for your comments!
>
> Don
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"rails-i18n" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rails-i18n?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to