Sha256: 91c7812c9b88e354b49bb09587564504def67c43c0b8c65f0933ac35100d833e

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

require "yaml"

module Asciidoctor
  module Standoc
    module I18n
        def load_yaml(lang, script)
          if @i18nyaml then YAML.load_file(@i18nyaml)
          elsif lang == "en"
            YAML.load_file(File.join(File.dirname(__FILE__),
                                     "../../asciidoctor-yaml/i18n-en.yaml"))
          elsif lang == "fr"
            YAML.load_file(File.join(File.dirname(__FILE__),
                                     "../../asciidoctor-yaml/i18n-fr.yaml"))
          elsif lang == "zh" && script == "Hans"
            YAML.load_file(File.join(File.dirname(__FILE__),
                                     "../../asciidoctor-yaml/i18n-zh-Hans.yaml"))
          else
            YAML.load_file(File.join(File.dirname(__FILE__),
                                     "../../asciidoctor-yaml/i18n-en.yaml"))
          end
        end

        def i18n_init(lang, script)
          @lang = lang
          @script = script
          y = load_yaml(lang, script)
          @term_def_boilerplate = y["term_def_boilerplate"] || ""
          @no_terms_boilerplate = y["no_terms_boilerplate"] || ""
          @internal_terms_boilerplate = y["internal_terms_boilerplate"] || ""
          @norm_with_refs_pref = y["norm_with_refs_pref"] || ""
          @norm_empty_pref = y["norm_empty_pref"] || ""
          @external_terms_boilerplate = y["external_terms_boilerplate"] || ""
          @internal_external_terms_boilerplate =
            y["internal_external_terms_boilerplate"] || ""
        end
      end
    end
  end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metanorma-standoc-1.3.4 lib/asciidoctor/standoc/i18n.rb
metanorma-standoc-1.3.3 lib/asciidoctor/standoc/i18n.rb
metanorma-standoc-1.3.2 lib/asciidoctor/standoc/i18n.rb
metanorma-standoc-1.3.1 lib/asciidoctor/standoc/i18n.rb