module Nls
Constants
- CONTINENTS
Public Instance Methods
nls(message_key, options = {})
click to toggle source
default scope the msg lookup to the current theme
# File lib/dm_core/nls.rb, line 9 def nls(message_key, options = {}) #--- look up message in the scope of current theme, fallback to parent theme key = "#{Account.current.current_theme}.#{message_key.to_s}" fallback = Account.current.parent_theme ? "#{Account.current.parent_theme}.#{message_key.to_s}" : "translation missing: #{key}" I18n.t(key, options.merge(default: fallback.to_sym)) end
nls?(message_key)
click to toggle source
Check if the message exists
# File lib/dm_core/nls.rb, line 18 def nls?(message_key) key = "#{Account.current.current_theme}.#{message_key.to_s}" I18n.t key, :raise => true rescue false end
nls_flag_image(lang = nil)
click to toggle source
Helper to generate the image_tag for a language flag.
nls_flag_image(:en)
# File lib/dm_core/nls.rb, line 26 def nls_flag_image(lang = nil) image_tag(DmCore::Language.flag_image(lang)) end