Class: I18nTyml::RubyI18nParser

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_tyml/ruby_i18n_parser.rb

Constant Summary collapse

I18N_DEFAULT_PATTERN =
/I18n\.t\(["']([\w\.]*?)["'][^"']*default[^"']*?["']([^"']*?)["']/

Class Method Summary collapse

Class Method Details

.get_locale_ref_array(file_content) ⇒ Object



6
7
8
# File 'lib/i18n_tyml/ruby_i18n_parser.rb', line 6

def self.get_locale_ref_array(file_content)
  file_content.scan(I18N_DEFAULT_PATTERN)
end

.remove_default(file_content) ⇒ Object



10
11
12
# File 'lib/i18n_tyml/ruby_i18n_parser.rb', line 10

def self.remove_default(file_content)
  file_content.gsub(I18N_DEFAULT_PATTERN, 'I18n.t("\1"')
end