Module: Babylonia::HelperMethods
- Defined in:
- lib/babylonia/class_methods.rb
Overview
Helper Methods for locales
Instance Method Summary collapse
-
#available_locales ⇒ Array
Return all the available locales.
-
#default_locale ⇒ Symbol
Return the default locale for the object.
-
#has_available_locale?(locale) ⇒ Boolean
Return if a locale is theoretically available in all translated fields.
-
#has_locale?(locale) ⇒ Boolean
Return if a translation in the language is stored in all translated fields.
-
#locale ⇒ Symbol
Return the currently active locale for the object.
-
#locale_fallback? ⇒ Boolean
Return if the object falls back on translations.
-
#missing_translation_placeholder(field) ⇒ String
Return the missing translation placeholder.
Instance Method Details
#available_locales ⇒ Array
Return all the available locales
55 56 57 |
# File 'lib/babylonia/class_methods.rb', line 55 def available_locales evaluate_localization_option!(:available_locales) end |
#default_locale ⇒ Symbol
Return the default locale for the object
27 28 29 |
# File 'lib/babylonia/class_methods.rb', line 27 def default_locale evaluate_localization_option!(:default_locale) end |
#has_available_locale?(locale) ⇒ Boolean
Return if a locale is theoretically available in all translated fields
62 63 64 |
# File 'lib/babylonia/class_methods.rb', line 62 def has_available_locale? locale available_locales.include?(locale.to_sym) end |
#has_locale?(locale) ⇒ Boolean
Return if a translation in the language is stored in all translated fields
48 49 50 |
# File 'lib/babylonia/class_methods.rb', line 48 def has_locale? locale locales.include?(locale.to_sym) end |
#locale ⇒ Symbol
Return the currently active locale for the object
20 21 22 |
# File 'lib/babylonia/class_methods.rb', line 20 def locale evaluate_localization_option!(:locale) end |
#locale_fallback? ⇒ Boolean
Return if the object falls back on translations
34 35 36 |
# File 'lib/babylonia/class_methods.rb', line 34 def locale_fallback? evaluate_localization_option!(:fallback) end |
#missing_translation_placeholder(field) ⇒ String
Return the missing translation placeholder
41 42 43 |
# File 'lib/babylonia/class_methods.rb', line 41 def missing_translation_placeholder field evaluate_localization_option!(:placeholder, field) end |