Sha256: cf605d456f597078ec7d3cb12ff8da19118e9b7d1bbddf7a6198f4af6bde1ca2
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
module LatoCore # This module contains functions used to get languages info. module Interface::Languages # This function return a boolean value to tells if applications has # languages set to config file. def core_applicationHasLanguages return (CORE_APPLANGUAGES.length > 1) if defined? CORE_APPLANGUAGES languages = core_getApplicationLanguages return languages.length > 1 end # This function return an array of languages used by application. def core_getApplicationLanguages return CORE_APPLANGUAGES if defined? CORE_APPLANGUAGES languages = false if File.exist? "#{Rails.root}/config/lato/config.yml" config = YAML.load( File.read(File.expand_path("#{Rails.root}/config/lato/config.yml", __FILE__)) ) if config['languages'] languages = config['languages'].split(',') languages.each do |language| language.downcase.delete(' ') end end end # return result return languages end # This function load and return the languages for a lato module. def core_loadModuleLanguages(module_name) module_root = module_name.camelize.constantize::Engine.root application_lang = Rails.application.config.i18n.default_locale if File.exist? "#{module_root}/lang/#{application_lang}.yml" return YAML.load( File.read(File.expand_path("#{module_root}/lang/#{application_lang}.yml", __FILE__)) ) else return YAML.load( File.read(File.expand_path("#{module_root}/lang/default.yml", __FILE__)) ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lato_core-1.1.5 | lib/lato_core/interface/languages.rb |
lato_core-1.1.4 | lib/lato_core/interface/languages.rb |
lato_core-1.1.3 | lib/lato_core/interface/languages.rb |