Module: Aerogel::I18n
- Extended by:
- NumberHelper
- Defined in:
- lib/aerogel/core/i18n.rb,
lib/aerogel/core/i18n/number_helper.rb
Overview
Aerogel::I18n provides localization support for aerogel applications.
Defined Under Namespace
Modules: NumberHelper Classes: Chainable
Constant Summary
Constants included from NumberHelper
NumberHelper::DECIMAL_UNITS, NumberHelper::STORAGE_UNITS
Class Method Summary collapse
- .available_locales ⇒ Object
- .default_locale ⇒ Object
- .l(*args) ⇒ Object
- .locale(*args) ⇒ Object
- .locale=(*args) ⇒ Object
- .registered(app) ⇒ Object
-
.t(*args) ⇒ Object
Translation helper with chainable key access support.
Methods included from NumberHelper
number_to_human_size, number_with_delimiter, number_with_precision
Class Method Details
.available_locales ⇒ Object
60 61 62 |
# File 'lib/aerogel/core/i18n.rb', line 60 def self.available_locales ::I18n.available_locales end |
.default_locale ⇒ Object
57 58 59 |
# File 'lib/aerogel/core/i18n.rb', line 57 def self.default_locale ::I18n.default_locale end |
.l(*args) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/aerogel/core/i18n.rb', line 36 def self.l( *args ) if args.first.nil? && args.second.is_a?( Hash ) && args.second.key?(:default) default_value = args.second[:default] if default_value.is_a? Symbol ::I18n.t default_value else default_value end else ::I18n.l( *args ) end end |
.locale(*args) ⇒ Object
49 50 51 |
# File 'lib/aerogel/core/i18n.rb', line 49 def self.locale( *args ) ::I18n.locale( *args ) end |
.locale=(*args) ⇒ Object
53 54 55 |
# File 'lib/aerogel/core/i18n.rb', line 53 def self.locale=( *args ) ::I18n.send :'locale=', *args end |
.registered(app) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/aerogel/core/i18n.rb', line 8 def self.registered(app) # load locales reload! # register reloader setup_reloader(app) if Aerogel.config.aerogel.reloader? end |
.t(*args) ⇒ Object
Translation helper with chainable key access support. You can call #t using standard i18n way:
t 'aerogel.admin.welcome', username: 'John'
Or using aerogel syntactic sugar:
t.aerogel.admin.welcome username: 'John'
26 27 28 29 30 31 32 33 34 |
# File 'lib/aerogel/core/i18n.rb', line 26 def self.t( *args ) if args.size > 0 # puts "** I18n.t original t: #{args}" ::I18n.t( *args ) else # puts "** I18n.t chainable t: #{args}" Chainable.new( *args ) end end |