Class: Goldencobra::Api::V2::LocalesController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/goldencobra/api/v2/locales_controller.rb

Instance Method Summary collapse

Instance Method Details

#get_stringObject

/api/v2/locale_string




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/goldencobra/api/v2/locales_controller.rb', line 12

def get_string
  # check if we have the argument
  unless params[:locale_key]
    render status: 200, text: ""
    return
  end

  # check if the locale_key contains something
  if params[:locale_key].length == 0
    render status: 200, text: ""
  else
    # get the translation for locale_key and return the locale value
    render status: 200, text: t(params[:locale_key])
  end
end