Class: IsoDoc::Plateau::I18n

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

Instance Method Summary collapse

Instance Method Details

#japanese_year(time) ⇒ Object

Numeric regnal year



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

def japanese_year(time)
  era_yr = time.era_year.to_i
  "#{time.strftime('%JN')}#{era_yr}"
rescue StandardError
  time.year.to_s
end

#load_file(fname) ⇒ Object



7
8
9
10
# File 'lib/isodoc/plateau/i18n.rb', line 7

def load_file(fname)
  f = File.join(File.dirname(__FILE__), fname)
  File.exist?(f) ? YAML.load_file(f) : {}
end

#load_yaml1(lang, script) ⇒ Object



12
13
14
15
# File 'lib/isodoc/plateau/i18n.rb', line 12

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