Module: I18nliner

Defined in:
lib/i18nliner/base.rb,
lib/i18nliner/scope.rb,
lib/i18nliner/errors.rb,
lib/i18nliner/erubis.rb,
lib/i18nliner/railtie.rb,
lib/i18nliner/processors.rb,
lib/i18nliner/call_helpers.rb,
lib/i18nliner/commands/dump.rb,
lib/i18nliner/commands/check.rb,
lib/i18nliner/commands/import.rb,
lib/i18nliner/extensions/core.rb,
lib/i18nliner/extensions/view.rb,
lib/i18nliner/controller_scope.rb,
lib/i18nliner/extensions/model.rb,
lib/i18nliner/extensions/controller.rb,
lib/i18nliner/extractors/sexp_helper.rb,
lib/i18nliner/commands/basic_formatter.rb,
lib/i18nliner/commands/color_formatter.rb,
lib/i18nliner/commands/generic_command.rb,
lib/i18nliner/extensions/inferpolation.rb,
lib/i18nliner/processors/erb_processor.rb,
lib/i18nliner/extractors/ruby_extractor.rb,
lib/i18nliner/extractors/translate_call.rb,
lib/i18nliner/processors/ruby_processor.rb,
lib/i18nliner/extractors/translation_hash.rb,
lib/i18nliner/processors/abstract_processor.rb,
lib/i18nliner/pre_processors/erb_pre_processor.rb

Defined Under Namespace

Modules: CallHelpers, Commands, Extensions, Extractors, PreProcessors, Processors Classes: AmbiguousKeyError, ControllerScope, Erubis, ExtractionError, InvalidBlockUsageError, InvalidOptionKeyError, InvalidOptionsError, InvalidPluralizationDefaultError, InvalidPluralizationKeyError, InvalidSignatureError, KeyAsScopeError, KeyInUseError, MalformedErbError, MissingCountValueError, MissingDefaultError, MissingInterpolationValueError, MissingPluralizationKeyError, Railtie, Scope, TBlockNestingError, UnwrappableContentError

Class Method Summary collapse

Class Method Details

.ignoreObject


4
5
6
7
8
9
10
11
# File 'lib/i18nliner/base.rb', line 4

def self.ignore
  @ignore ||= begin
    path = File.join(base_path, ".i18nignore")
    File.exist?(path) ?
      File.read(path).split(/\r?\n|\r/) :
      []
  end
end

.look_up(key) ⇒ Object


22
23
24
# File 'lib/i18nliner/base.rb', line 22

def self.look_up(key)
  I18n.exists?(I18n.locale, key)
end

.manual_translationsObject


16
17
18
19
20
# File 'lib/i18nliner/base.rb', line 16

def self.manual_translations
  I18n.t(:foo) # ensure backend is initialized
  # TODO: support additional backends
  I18n.backend.send(:translations)[I18n.default_locale]
end

.setting(key, value) ⇒ Object


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/i18nliner/base.rb', line 26

def self.setting(key, value)
  instance_eval <<-CODE
    def #{key}=(value)
      @#{key} = value
    end

    def #{key}(value = nil)
      if value && block_given?
        begin
          value_was = @#{key}
          @#{key} = value
          yield
        ensure
          @#{key} = value_was
        end
      else
        @#{key} = #{value.inspect} if @#{key}.nil?
        @#{key}
      end
    end
  CODE
end

.translationsObject


13
14
# File 'lib/i18nliner/base.rb', line 13

def self.translations
end