Class: FastGettext::TranslationRepository::Base

### Home Classes Methods

### In Files

- lib/fast_gettext/translation_repository/base.rb

### Parent

Object

### Methods

- ::new
- #[]
- #available_locales
- #current_translations
- #find_files_in_locale_folders
- #plural
- #pluralisation_rule
- #reload

### Class/Module Index

Quicksearch

- FastGettext
- FastGettext::GetText
- FastGettext::GetText::MOFile
- FastGettext::GetText::MOFile::HeaderRev1
- FastGettext::GetText::MOFile::InvalidFormat
- FastGettext::GetText::PoParser
- FastGettext::MoFile
- FastGettext::PoFile
- FastGettext::Storage
- FastGettext::Storage::NoTextDomainConfigured
- FastGettext::Translation
- FastGettext::TranslationMultidomain
- FastGettext::TranslationRepository
- FastGettext::TranslationRepository::Base
- FastGettext::TranslationRepository::Chain
- FastGettext::TranslationRepository::Db
- FastGettext::TranslationRepository::Logger
- FastGettext::TranslationRepository::Mo
- FastGettext::TranslationRepository::Po
- FastGettext::TranslationRepository::Yaml
- String
- TranslationKey
- TranslationText

No matching classes.

# FastGettext::TranslationRepository::Base

Responsibility:

    - base for all repositories
    - fallback as empty repository, that cannot translate anything but does not crash

### Public Class Methods

new(name,options={}) click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 7
    def initialize(name,options={})
      @name = name
      @options = options
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 20
    def [](key)
      current_translations[key]
    end

available_locales() click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 16
    def available_locales
      []
    end

plural(*keys) click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 24
    def plural(*keys)
      current_translations.plural(*keys)
    end

pluralisation_rule() click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 12
    def pluralisation_rule
      nil
    end

reload() click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 28
    def reload
      true
    end

### Protected Instance Methods

current_translations() click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 34
    def current_translations
      MoFile.empty
    end

find_files_in_locale_folders(relative_file_path,path) click to toggle source

    # File lib/fast_gettext/translation_repository/base.rb, line 38
    def find_files_in_locale_folders(relative_file_path,path)
      path ||= "locale"
      raise "path #{path} cound not be found!" unless File.exist?(path)

      @files = {}
      Dir[File.join(path,'*')].each do |locale_folder|
        next unless File.basename(locale_folder) =~ LOCALE_REX
        file = File.join(locale_folder,relative_file_path).untaint
        next unless File.exist? file
        locale = File.basename(locale_folder)
        @files[locale] = yield(locale,file)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.