add localization

This commit is contained in:
Yan
2017-10-11 17:29:28 +06:30
parent 4ab89efaf2
commit 476aafa791
6 changed files with 34 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
# lookup domain for db from provision
before_action :lookup_domain
before_action :lookup_domain, :set_locale
helper_method :current_company,:current_login_employee,:current_user
# alias_method :current_user, :current_login_employee,:current_user
@@ -12,6 +12,15 @@ class ApplicationController < ActionController::Base
#all token authentication must be done here
#response format must be set to JSON
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
# RESTful url for localize
def default_url_options
{ locale: I18n.locale }
end
def lookup_domain
if request.subdomain.present? && request.subdomain != "www"
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)