Class: IsoDoc::RelatonRenderI18n

Inherits:
I18n
  • Object
show all
Defined in:
lib/isodoc/i18n.rb

Instance Method Summary collapse

Instance Method Details

#cleanup_entities(hash, is_xml: true) ⇒ Object

force bidi for all i18n strings in Arabic, because of the potential for script mixing



26
27
28
29
30
31
32
# File 'lib/isodoc/i18n.rb', line 26

def cleanup_entities(hash, is_xml: true)
  ret = super
  if @lang == "ar" && ret.include?("%")
    ret = "؜#{ret}؜"
  end
  ret
end

#load_yaml1(lang, script) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/isodoc/i18n.rb', line 6

def load_yaml1(lang, script)
  case lang
  when "en", "fr", "ru", "de", "es", "ar", "ja"
    load_yaml2(lang)
  when "zh"
    case script
    when "Hans", "Hant" then load_yaml2("zh-#{script}")
    else load_yaml2("zh-Hans")
    end
  else load_yaml2("en")
  end
end

#load_yaml2(str) ⇒ Object



19
20
21
22
# File 'lib/isodoc/i18n.rb', line 19

def load_yaml2(str)
  YAML.load_file(File.join(File.dirname(__FILE__),
                           "../isodoc-yaml/i18n-#{str}.yaml"))
end