Created
May 14, 2012 12:44
-
-
Save psy-q/2693734 to your computer and use it in GitHub Desktop.
I18n.locale = --> setting this is ignored
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: /home/rca/work/code/ror/leihs/app/controllers/application_controller.rb @ line 65 ApplicationController#set_gettext_locale: | |
60: current_user.language = language # language is a protected attribute, it can't be mass-asigned via update_attributes | |
61: current_user.save | |
62: current_user.reload | |
63: end | |
64: locale_symbol = current_user.language.locale_name.to_sym | |
=> 65: binding.pry | |
66: else | |
67: locale_symbol = Language.default_language.locale_name.to_sym | |
68: end | |
69: | |
70: I18n.locale = locale_symbol | |
[1] pry(#<Backend::InventoryPoolsController>)> locale_symbol | |
=> :"de-CH" | |
[2] pry(#<Backend::InventoryPoolsController>)> I18n.locale | |
=> :en_GB | |
[3] pry(#<Backend::InventoryPoolsController>)> I18n.locale = locale_symbol | |
From: /home/rca/.rvm/gems/ruby-1.9.2-p320/gems/fast_gettext-0.6.6/lib/fast_gettext/storage.rb @ line 187 FastGettext::Storage#format_locale: | |
187: def format_locale(locale) | |
188: #locale.sub(/^([a-zA-Z]{2})[-_]([a-zA-Z]{2})$/){$1.downcase+'_'+$2.upcase} | |
189: | |
190: #locale.sub(/^([a-zA-Z]{2})([-_])([a-zA-Z]{2})$/){$1.downcase+'$2'+$3.upcase} | |
191: | |
=> 192: binding.pry | |
193: locale.sub(/^([a-zA-Z]{2})[-_]([a-zA-Z]{2})$/){$1.downcase+'-'+$2.upcase} | |
194: end | |
[1] pry(FastGettext)> locale.sub(/^([a-zA-Z]{2})[-_]([a-zA-Z]{2})$/){$1.downcase+'-'+$2.upcase} | |
=> "de-CH" | |
[2] pry(FastGettext)> exit | |
=> :"de-CH" | |
[4] pry(#<Backend::InventoryPoolsController>)> I18n.locale | |
=> :en_GB | |
[5] pry(#<Backend::InventoryPoolsController>)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment