Sha256: 54e78a6d65d707a36823cb721ba2522b5833698cece409356f18f6637c159adb

Contents?: true

Size: 836 Bytes

Versions: 20

Compression:

Stored size: 836 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", "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

    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" && ret.include?("%")
        ret = "&#x61c;#{ret}&#x61c;"
      end
      ret
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
relaton-render-0.9.1 lib/isodoc/i18n.rb
relaton-render-0.9.0 lib/isodoc/i18n.rb
relaton-render-0.8.2 lib/isodoc/i18n.rb
relaton-render-0.8.1 lib/isodoc/i18n.rb
relaton-render-0.8.0 lib/isodoc/i18n.rb
relaton-render-0.7.10 lib/isodoc/i18n.rb
relaton-render-0.7.9 lib/isodoc/i18n.rb
relaton-render-0.7.7 lib/isodoc/i18n.rb
relaton-render-0.7.6 lib/isodoc/i18n.rb
relaton-render-0.7.5 lib/isodoc/i18n.rb
relaton-render-0.7.4 lib/isodoc/i18n.rb
relaton-render-0.7.3 lib/isodoc/i18n.rb
relaton-render-0.7.2 lib/isodoc/i18n.rb
relaton-render-0.7.1 lib/isodoc/i18n.rb
relaton-render-0.7.0 lib/isodoc/i18n.rb
relaton-render-0.6.3 lib/isodoc/i18n.rb
relaton-render-0.6.2 lib/isodoc/i18n.rb
relaton-render-0.6.1 lib/isodoc/i18n.rb
relaton-render-0.6.0 lib/isodoc/i18n.rb
relaton-render-0.5.15 lib/isodoc/i18n.rb