Class: Idiom::Yrb

Inherits:
Base
  • Object
show all
Defined in:
lib/idiom/yrb.rb

Overview

Usage:

Translator::Yrb.new(:source => "./translations/en-US.pres", :destination => "./translations",
:use_dirs => false).translate

Constant Summary

Constants included from Locales

Locales::CONFIG, Locales::LOCALES

Instance Attribute Summary

Attributes inherited from Base

#destination, #languages, #pass_through_vars, #source, #substitution_vars, #use_dirs

Instance Method Summary collapse

Methods inherited from Base

#after_translation, #all_keys, #before_translation, #clear_all_keys, #comment?, #copy_and_translate_line, #do_translate, #each_line, #generate, #initialize, #key_is_new?, #new_translation_message, #translate, #translate_new_key, #write_content

Methods included from ClassMethods

#find_and_translate_all, #source_files, #translate, #translate_file

Methods included from Processing

#post_process, #pre_process

Methods included from Locales

#locales, #non_us_locales

Methods included from Directories

#destination_file_or_directory, #destination_path, #ensure_destination_path_exists, #use_directories?

Constructor Details

This class inherits a constructor from Idiom::Base

Instance Method Details

#extensionObject



9
10
11
# File 'lib/idiom/yrb.rb', line 9

def extension
  "pres"
end

#format(key, value) ⇒ Object



17
18
19
# File 'lib/idiom/yrb.rb', line 17

def format(key, value)
  "#{key}=#{value}"
end

#key_and_value_from_line(line) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/idiom/yrb.rb', line 21

def key_and_value_from_line(line)
  if line =~ /^([^\=]+)=(.+)/
    return $1, $2
  else
    return nil, nil
  end
end

#parse(p) ⇒ Object



13
14
15
# File 'lib/idiom/yrb.rb', line 13

def parse(p)
  YRB.load_file(p)
end