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.
49 50 51 52 |
# File 'lib/gettext/tools/parser/glade.rb', line 49 def initialize(path, ={}) @path = path @options = end |
Class Method Details
.parse(path, options = {}) ⇒ Object
40 41 42 43 |
# File 'lib/gettext/tools/parser/glade.rb', line 40 def parse(path, ={}) parser = new(path, ) parser.parse end |
.target?(file) ⇒ Boolean
:nodoc:
32 33 34 35 36 37 38 |
# File 'lib/gettext/tools/parser/glade.rb', line 32 def target?(file) # :nodoc: return false unless File.extname(file) == ".glade" data = File.read(file) return false unless data.include?("<?xml") return false unless data.include?("glade-2.0.dtd") true end |
Instance Method Details
#parse ⇒ Object
:nodoc:
54 55 56 57 58 |
# File 'lib/gettext/tools/parser/glade.rb', line 54 def parse # :nodoc: File.open(@path) do |file| parse_source(file) end end |