Class: GetText::GladeParser
- Inherits:
-
Object
- Object
- GetText::GladeParser
- Extended by:
- GetText
- Defined in:
- lib/gettext/tools/parser/glade.rb
Constant Summary collapse
- XML_RE =
/<\?xml/
- GLADE_RE =
/glade-2.0.dtd/
- TARGET1 =
/<property.*translatable="yes">(.*)/
- TARGET2 =
/(.*)<\/property>/
Constants included from GetText
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ GladeParser
constructor
A new instance of GladeParser.
-
#parse ⇒ Object
:nodoc:.
Methods included from GetText
N_, Nn_, bindtextdomain, bindtextdomain_to, cgi, cgi=, gettext, included, locale, ngettext, npgettext, nsgettext, output_charset, pgettext, set_cgi, set_current_locale, set_locale, set_output_charset, sgettext, textdomain, textdomain_to
Constructor Details
#initialize(path, options = {}) ⇒ GladeParser
Returns a new instance of GladeParser.
47 48 49 50 |
# File 'lib/gettext/tools/parser/glade.rb', line 47 def initialize(path, ={}) @path = path @options = end |
Class Method Details
.parse(path, options = {}) ⇒ Object
38 39 40 41 |
# File 'lib/gettext/tools/parser/glade.rb', line 38 def parse(path, ={}) parser = new(path, ) parser.parse end |
.target?(file) ⇒ Boolean
:nodoc:
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gettext/tools/parser/glade.rb', line 26 def target?(file) # :nodoc: data = IO.readlines(file) if XML_RE =~ data[0] and GLADE_RE =~ data[1] true else if File.extname(file) == '.glade' raise _("`%{file}' is not glade-2.0 format.") % {:file => file} end false end end |
Instance Method Details
#parse ⇒ Object
:nodoc:
52 53 54 55 56 |
# File 'lib/gettext/tools/parser/glade.rb', line 52 def parse # :nodoc: File.open(@path) do |file| parse_source(file) end end |