Sha256: 518150b15f33faa78840650795a3f8fa6f50c9a6daa01d82d359f53c4c3e1db0

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

def gem_path(path='')
  # TODO : Perhaps a better way to do it ...
  # regarder Rubygems pour avoir le path direct ..
  table_map = Gem.location_of_caller.first.split('/')
  2.times do 
    table_map.pop
  end
  table_map.push path unless path.empty? 
  path_prefix = table_map.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

1 entries across 1 versions & 1 rubygems

Version Path
UG_RRobots-2.0 lib/misc.rb