Quoting Erwin <[email protected]>:
> 
> I also tried :
> 
>           AVAILABLE_LOCALES = ALL_LOCALES.dup
>          AVAILABLE_LOCALES.delete_if{|key, value| key == I18n.locale }
> 
> but get also an error ... dynamic constant assignment (SyntaxError)
> with the dup ...
> I don't understand as I can do it with irb ....
> 
> 
> On 9 fév, 23:06, Erwin <[email protected]> wrote:
> > I have a constant set up like that :
> > ALL_LOCALES
> > => {"it"=>"Italian", "fr"=>"Français", "de"=>"Deutsch", "en-
> > GB"=>"English (UK)", "es"=>"Español (España)", "pt-PT"=>"Português",
> > "pl"=>"Polski", "en-US"=>"English (US)", "pt-BR"=>"Português
> > (Brasil)"}
> >
> > my locale is set :  I18n.locale
> > => :"en-US"
> >
> > based on the current locale , dynamically changed, I would like to
> > define a new constant,   AVAILABLE_LOCALES which would be the
> > ALL_LOCALES minus the current locale...
> >
> > AVAILABLE_LOCALES
> > => {"it"=>"Italian", "fr"=>"Français", "de"=>"Deutsch", "en-
> > GB"=>"English (UK)", "es"=>"Español (España)", "pt-PT"=>"Português",
> > "pl"=>"Polski", "pt-BR"=>"Português (Brasil)"}
> >
> > I dont' see how todo that ?  any clue ?

What is constant about a variable that changes everytime the locale changes?
And if you have multiple users with different locales, potentially changes
with every request?  Given how changeable it is, why do you want to confuse
the future maintainer by implying it is constant when it isn't.

Or put another way, why can't the variable be named available_locales.

Shrug,
  Jeffrey

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to