diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 2a42050b..4ba85ed4 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -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)
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index b9da59d4..b6f044b9 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -59,6 +59,7 @@
<% end %>
<% end %>
+
<%= t 'welcome' %>
<%= yield %>
diff --git a/config/application.rb b/config/application.rb
index 78ff63dc..4a8b873a 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -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'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index ced8af0a..ba4f31fa 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1,4 +1,5 @@
en:
+ welcome: "Welcome"
views:
pagination:
first: "« First"
diff --git a/config/locales/mm.yml b/config/locales/mm.yml
new file mode 100644
index 00000000..69a9131e
--- /dev/null
+++ b/config/locales/mm.yml
@@ -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 1 %{entry_name}"
+ other: "Displaying all %{count} %{entry_name}"
+ more_pages:
+ display_entries: "Displaying %{entry_name} %{first} - %{last} of %{total} in total"
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 70accbb2..3c24f5bd 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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