Sha256: 7ddf1696f11c7ed565c85f28ca81bdd64f35cbc0af7c0647cda0dbb399123a4c

Contents?: true

Size: 798 Bytes

Versions: 21

Compression:

Stored size: 798 Bytes

Contents

require "yaml"
require "isodoc-i18n"

module IsoDoc
  class RelatonRenderI18n < I18n
    def load_yaml1(lang, script)
      case lang
      when "en", "fr", "ru", "de", "es", "ar"
        load_yaml2(lang)
      when "zh"
        if script == "Hans" then load_yaml2("zh-Hans")
        else load_yaml2("en")
        end
      else load_yaml2("en")
      end
    end

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

    # force bidi for all i18n strings in Arabic,
    # because of the potential for script mixing
    def cleanup_entities(hash, is_xml: true)
      ret = super
      if @lang == "ar" && /%/.match?(ret)
        ret = "&#x61c;#{ret}&#x61c;"
      end
      ret
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
relaton-render-0.5.3 lib/isodoc/i18n.rb
relaton-render-0.5.2 lib/isodoc/i18n.rb
relaton-render-0.5.1 lib/isodoc/i18n.rb
relaton-render-0.5.0 lib/isodoc/i18n.rb
relaton-render-0.4.4 lib/isodoc/i18n.rb
relaton-render-0.4.3 lib/isodoc/i18n.rb
relaton-render-0.4.2 lib/isodoc/i18n.rb
relaton-render-0.4.1 lib/isodoc/i18n.rb
relaton-render-0.4.0 lib/isodoc/i18n.rb
relaton-render-0.3.10 lib/isodoc/i18n.rb
relaton-render-0.3.9 lib/isodoc/i18n.rb
relaton-render-0.3.8 lib/isodoc/i18n.rb
relaton-render-0.3.7 lib/isodoc/i18n.rb
relaton-render-0.3.6.1 lib/isodoc/i18n.rb
relaton-render-0.3.6 lib/isodoc/i18n.rb
relaton-render-0.3.5.1 lib/isodoc/i18n.rb
relaton-render-0.3.5 lib/isodoc/i18n.rb
relaton-render-0.3.4 lib/isodoc/i18n.rb
relaton-render-0.3.3 lib/isodoc/i18n.rb
relaton-render-0.3.2 lib/isodoc/i18n.rb