Class: Nitro::Localization

Inherits:
Object
  • Object
show all
Defined in:
lib/nitro/compiler/localization.rb

Class Method Summary collapse

Class Method Details

.transform(text, compiler = nil) ⇒ Object

Transform localization macros.



11
12
13
14
15
16
17
18
19
# File 'lib/nitro/compiler/localization.rb', line 11

def transform(text, compiler = nil)
  # handle symbols
  text.gsub!(/\[\[\:(.*?)\]\]/, '#{@lc[\1]}')

  # handle strings 
  text.gsub!(/\[\[(.*?)\]\]/, '#{@lc["\1"]}')

  return text
end