module TidyI18n
Constants
- TranslationKey
Public Class Methods
project_root()
click to toggle source
# File lib/tidy_i18n.rb, line 17 def self.project_root @project_root end
project_root=(path)
click to toggle source
# File lib/tidy_i18n.rb, line 13 def self.project_root=(path) @project_root = path end
raise_error_on_missing_translation=(raise_error)
click to toggle source
# File lib/tidy_i18n.rb, line 21 def self.raise_error_on_missing_translation=(raise_error) if raise_error I18n.exception_handler = RaiseAllErrors.new else I18n.exception_handler = I18n::ExceptionHandler.new end end
translate(key, options={})
click to toggle source
# File lib/tidy_i18n.rb, line 29 def self.translate(key, options={}) raise ProjectRootNotConfigured if project_root.nil? if key[0] == "." key_prefix = caller[0]. gsub("#{project_root}/", ""). split("."). first. gsub("/", ".") I18n.translate("#{key_prefix}.#{key}", options) else I18n.translate(key, options) end end
Also aliased as: t