add localization
This commit is contained in:
@@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
|
|||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
# lookup domain for db from provision
|
# 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
|
helper_method :current_company,:current_login_employee,:current_user
|
||||||
# alias_method :current_user, :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
|
#all token authentication must be done here
|
||||||
#response format must be set to JSON
|
#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
|
def lookup_domain
|
||||||
if request.subdomain.present? && request.subdomain != "www"
|
if request.subdomain.present? && request.subdomain != "www"
|
||||||
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<h1><%= t 'welcome' %></h1>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ module SXRestaurants
|
|||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
config.i18n.default_locale = :'en'
|
||||||
|
|
||||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :sidekiq
|
||||||
config.time_zone = 'Asia/Rangoon'
|
config.time_zone = 'Asia/Rangoon'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
en:
|
en:
|
||||||
|
welcome: "Welcome"
|
||||||
views:
|
views:
|
||||||
pagination:
|
pagination:
|
||||||
first: "« First"
|
first: "« First"
|
||||||
|
|||||||
18
config/locales/mm.yml
Normal file
18
config/locales/mm.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
mm:
|
||||||
|
welcome: "လာပါ"
|
||||||
|
views:
|
||||||
|
pagination:
|
||||||
|
first: "« ပထမ"
|
||||||
|
last: "အဆံုး »"
|
||||||
|
previous: "‹ ေနာက္သို့"
|
||||||
|
next: "ေရ့သို့ ›"
|
||||||
|
truncate: "…"
|
||||||
|
helpers:
|
||||||
|
page_entries_info:
|
||||||
|
one_page:
|
||||||
|
display_entries:
|
||||||
|
zero: "No %{entry_name} found"
|
||||||
|
one: "Displaying <b>1</b> %{entry_name}"
|
||||||
|
other: "Displaying <b>all %{count}</b> %{entry_name}"
|
||||||
|
more_pages:
|
||||||
|
display_entries: "Displaying %{entry_name} <b>%{first} - %{last}</b> of <b>%{total}</b> in total"
|
||||||
@@ -2,7 +2,7 @@ require 'sidekiq/web'
|
|||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
scope "(:locale)", locale: /en|mm/ do
|
||||||
root 'home#index'
|
root 'home#index'
|
||||||
mount Sidekiq::Web => '/kiq'
|
mount Sidekiq::Web => '/kiq'
|
||||||
|
|
||||||
@@ -375,3 +375,4 @@ Rails.application.routes.draw do
|
|||||||
resources :commissioners
|
resources :commissioners
|
||||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user