Sha256: cd2dafd0447815c86a670266fa5c63275d657acaeea8131b8323c39aa5c747a1
Contents?: true
Size: 805 Bytes
Versions: 2
Compression:
Stored size: 805 Bytes
Contents
def gem_path(path='') # TODO : Perhaps a better way to do it ... # regarder Rubygems pour avoir le path direct .. res = Array::new table_map = Gem.location_of_caller.first.split('/') table_map.each do |item| res.push item break if item =~ /UG_RRobots/ end res.push path unless path.empty? path_prefix = res.join('/') return false unless File::exist?(path_prefix) return path_prefix end def init_I18n(locales) I18n.default_locale = locales locales_path = gem_path('config').concat("/locales") I18n.load_path << Dir["#{locales_path}/*.yml"] end def get_locale_from_env if not ENV['LANGUAGE'].empty? then locale = ENV['LANGUAGE'].split('_').first elsif not ENV['LANG'].empty? then locale = ENV['LANG'].split('_').first else locale = 'en' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
UG_RRobots-2.2 | lib/misc.rb |
UG_RRobots-2.1 | lib/misc.rb |