add localization
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h1><%= t 'welcome' %></h1>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,8 @@ module SXRestaurants
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- 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_job.queue_adapter = :sidekiq
|
||||
config.time_zone = 'Asia/Rangoon'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
en:
|
||||
welcome: "Welcome"
|
||||
views:
|
||||
pagination:
|
||||
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
|
||||
|
||||
|
||||
scope "(:locale)", locale: /en|mm/ do
|
||||
root 'home#index'
|
||||
mount Sidekiq::Web => '/kiq'
|
||||
|
||||
@@ -375,3 +375,4 @@ Rails.application.routes.draw do
|
||||
resources :commissioners
|
||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user