Module | ArkanisDevelopment::SimpleLocalization::LocalizedApplication::ContextSensetiveHelpers |
In: |
lib/features/localized_application.rb
|
This helper provides a short way to access nested language entries by automatically adding a scope to the specified keys. This scope depends on where you call this helper from. If called in the +users_controller.rb+ file it will add :users to it.
This is done by analysing the call stack of the method and there are a few more possibilities:
in app/controllers/users_controller.rb
lc(:test) # => will be the same as l(:users, :test)
in app/controllers/projects/tickets_controller.rb
lc(:test) # => will be the same as l(:projects, :tickets, :test)
in app/views/users/show.rhtml
lc(:test) # => will be the same as l(:users, :show, :test)
in app/views/users/_summary.rhtml
lc(:test) # => will be the same as l(:users, :summary, :test)
in app/models/user.rb
lc(:test) # => will be the same as l(:user, :test)
in app/models/user_observer.rb
lc(:test) # => will be the same as l(:user, :test)
# File lib/features/localized_application.rb, line 315 315: def lc(*args) 316: args.unshift *get_scope_of_context 317: ArkanisDevelopment::SimpleLocalization::Language.app_not_scoped *args 318: end