Skip to content

Commit

Permalink
Merge pull request #318 from metanorma/fix/i18n-yaml-inheritance
Browse files Browse the repository at this point in the history
Fix/i18n yaml inheritance
  • Loading branch information
opoudjis authored Nov 29, 2023
2 parents 1233eb7 + 243fd0c commit 806552f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile.devel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "fix/recursive-prefix-container"
gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "fix/i18n-yaml-inheritance"
14 changes: 5 additions & 9 deletions lib/isodoc/ieee/i18n.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
module IsoDoc
module IEEE
class I18n < IsoDoc::I18n
def load_yaml2x(str)
::YAML.load_file(File.join(File.dirname(__FILE__),
"i18n-#{str}.yaml"))
def load_file(fname)
f = File.join(File.dirname(__FILE__), fname)
File.exist?(f) ? YAML.load_file(f) : {}
end

def load_yaml1(lang, script)
y = case lang
when "en"
load_yaml2x(lang)
else load_yaml2x("en")
end
super.deep_merge(y)
y = load_file("i18n-#{yaml_lang(lang, script)}.yaml")
y.empty? ? load_file("i18n-en.yaml").merge(super) : super.deep_merge(y)
end
end
end
Expand Down

0 comments on commit 806552f

Please sign in to comment.