class TranslationKey

Public Class Methods

available_locales() click to toggle source
# File lib/fast_gettext/translation_repository/db_models/translation_key.rb, line 19
def self.available_locales
  @@available_locales ||= TranslationText.count(:group=>:locale).keys.sort
end
translation(key, locale) click to toggle source
# File lib/fast_gettext/translation_repository/db_models/translation_key.rb, line 13
def self.translation(key, locale)
  return unless translation_key = find_by_key(newline_normalize(key))
  return unless translation_text = translation_key.translations.find_by_locale(locale)
  translation_text.text
end

Protected Class Methods

newline_normalize(s) click to toggle source
# File lib/fast_gettext/translation_repository/db_models/translation_key.rb, line 25
def self.newline_normalize(s)
  s.to_s.gsub("\r\n", "\n")
end

Protected Instance Methods

normalize_newlines() click to toggle source
# File lib/fast_gettext/translation_repository/db_models/translation_key.rb, line 29
def normalize_newlines
  self.key = self.class.newline_normalize(key)
end