Sha256: 084e279498bc74144d22e34e05511f8f6945729a1f54c8c958618a72d87f9899
Contents?: true
Size: 619 Bytes
Versions: 4
Compression:
Stored size: 619 Bytes
Contents
# -*- coding: utf-8 -*- require 'yaml' module ReVIEW class I18n def self.setup user_i18n = YAML.load_file(File.expand_path "locale.yaml", ENV["PWD"]) I18n.i18n user_i18n["locale"], user_i18n rescue I18n.i18n "ja" end def self.i18n(locale, user_i18n = {}) locale ||= "ja" i18n_yaml_path = File.expand_path "i18n.yaml", File.dirname(__FILE__) @i18n = YAML.load_file(i18n_yaml_path)[locale] if @i18n @i18n.merge!(user_i18n) end end def self.t(str, args = nil) @i18n[str] % args rescue str end end I18n.setup end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
review-1.2.0 | lib/review/i18n.rb |
review-1.1.0 | lib/review/i18n.rb |
tmtms-review-1.0.0 | lib/review/i18n.rb |
review-1.0.0 | lib/review/i18n.rb |