Module: Amrita2::GetTextParser
- Includes:
- Amrita2, GetTextBridge
- Defined in:
- lib/amrita2/gettext.rb
Overview
:nodoc: all
Constant Summary
Constants included from Amrita2
FilterMethods, Hooki, SanitizedString
Class Method Summary collapse
Class Method Details
.parse(file, ary) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/amrita2/gettext.rb', line 103 def parse(file, ary) t = Template.new(File::open(file).read) do |e, src, filters| filters << Filters::GetTextFilter.new end src = t.compile_for_gettext RubyParser.parse_lines(file, [src], ary) src = t.get_erb_source_for_gettext erb = ERB.new(src).src.split(/$/) RubyParser.parse_lines(file, erb, ary) ary.collect do |msgid, fnameandline| [msgid, fnameandline.gsub(/\d+$/, "-")] end end |
.target?(file) ⇒ Boolean
99 100 101 |
# File 'lib/amrita2/gettext.rb', line 99 def target?(file) File.extname(file) == '.a2html' || File.extname(file) == '.a2' end |