lib/tools.rb in manabu-desktop-0.0.2 vs lib/tools.rb in manabu-desktop-0.0.3
- old
+ new
@@ -1,12 +1,35 @@
require 'i18n'
+require 'emojidex-rasters'
+require 'emojidex/data/utf'
-I18n.load_path = Dir["#{__dir__}/../locales/*.yml"]
+module ManabuDesktop
+ class Tools
+ @@_initialized = false
+ @@_emojidex = nil
-# TODO there must be a better way to determine language
-@lang = (ENV['LANG'][0..1]).to_sym
-if I18n.available_locales.include? @lang
- I18n.locale = @lang
-else
- I18n.locale = :en
- @lang = :en
+ def self.init()
+ return if @@_initialized
+
+ I18n.load_path = Dir["#{__dir__}/../locales/*.yml"]
+
+ # TODO there must be a better way to determine language
+ @lang = (ENV['LANG'][0..1]).to_sym
+ if I18n.available_locales.include? @lang
+ I18n.locale = @lang
+ else
+ I18n.locale = :en
+ @lang = :en
+ end
+
+ @@_initialized = true
+ end
+
+ def self.emojidex()
+ return @@_emojidex if @@_emojidex
+ @@_emojidex = Emojidex::Data::UTF.new
+ @@_emojidex
+ end
+ end
end
+
+ManabuDesktop::Tools.init()