Class: ExpressTranslate::OptionsController

Inherits:
BaseController
  • Object
show all
Includes:
ExpressTranslate
Defined in:
app/controllers/express_translate/options_controller.rb

Instance Method Summary collapse

Methods included from ExpressTranslate

clear, config, #language, reset, root, seeds, setup

Methods inherited from BaseController

#check_authentication, #getCookie

Instance Method Details

#indexObject

Show all packages for client (html code) index page Get all packages



14
15
16
17
# File 'app/controllers/express_translate/options_controller.rb', line 14

def index
  @packages = Package.all
  render :action => :index, layout: 'express_translate/translate'
end

#language_detailObject

Show all codes for client (html code) index page Get all codes of package ID and language ID Get origin language Get language for show



42
43
44
45
46
47
48
# File 'app/controllers/express_translate/options_controller.rb', line 42

def language_detail
  @languages = Package.find(params[:package])['language']
  @origin_lang = Language.get_origin(params[:package])
  @LanguageDetail = LanguageDetail
  @lang = {'id'=> params[:id], 'packages'=> params[:package]}
  render :action => :language_detail, layout: 'express_translate/translate'
end

#languagesObject

Show all languages for client (html code) index page Get all languages of package ID Get origin languages Get max count of percent translate



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/express_translate/options_controller.rb', line 23

def languages
  @selects = YAML.load_file("#{ExpressTranslate.root}/config/languages.yml")
  @origin = Language.get_origin(params[:packages])
  @origin_keys = []
  LanguageDetail.info(@origin).all.each do |item|
    @origin_keys.push(item["code"])
  end
  @languages = Package.find(params[:packages])['language']
  @max = @origin.nil? ? 1 : LanguageDetail.info(@origin).all.count
  @LanguageDetail = LanguageDetail
  @Package = Package
  render :action => :languages, layout: 'express_translate/translate'
end