Skip to content
Snippets Groups Projects
Unverified Commit c9b69874 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Fixed issues with default locale (#5452)

parent 0a2bb045
No related merge requests found
...@@ -26,7 +26,7 @@ module Api ...@@ -26,7 +26,7 @@ module Api
def index def index
return render_data data: current_user, serializer: CurrentUserSerializer, status: :ok if current_user return render_data data: current_user, serializer: CurrentUserSerializer, status: :ok if current_user
render_data data: { signed_in: false }, status: :ok render_data data: { signed_in: false, default_locale: ENV.fetch('DEFAULT_LOCALE') }, status: :ok
end end
# POST /api/v1/sessions # POST /api/v1/sessions
......
...@@ -38,7 +38,7 @@ export default function AuthProvider({ children }) { ...@@ -38,7 +38,7 @@ export default function AuthProvider({ children }) {
provider: currentUser?.provider, provider: currentUser?.provider,
avatar: currentUser?.avatar, avatar: currentUser?.avatar,
signed_in: currentUser?.signed_in ?? false, signed_in: currentUser?.signed_in ?? false,
language: currentUser?.language || window.navigator.language || window.navigator.userLanguage, language: currentUser?.language || currentUser?.default_locale || window.navigator.language || window.navigator.userLanguage,
permissions: currentUser?.permissions, permissions: currentUser?.permissions,
role: currentUser?.role, role: currentUser?.role,
verified: currentUser?.verified, verified: currentUser?.verified,
......
...@@ -82,5 +82,7 @@ module Greenlight ...@@ -82,5 +82,7 @@ module Greenlight
# Fetch 'RELATIVE_URL_ROOT' ENV variable value while removing any trailing slashes. # Fetch 'RELATIVE_URL_ROOT' ENV variable value while removing any trailing slashes.
config.relative_url_root = ENV.fetch('RELATIVE_URL_ROOT', nil)&.sub(%r{/*\z}, '') config.relative_url_root = ENV.fetch('RELATIVE_URL_ROOT', nil)&.sub(%r{/*\z}, '')
config.relative_url_root = '/' if config.relative_url_root.blank? config.relative_url_root = '/' if config.relative_url_root.blank?
I18n.load_path += Dir[Rails.root.join('config/locales/*.{rb,yml}').to_s]
end end
end end
...@@ -69,7 +69,7 @@ REDIS_URL= ...@@ -69,7 +69,7 @@ REDIS_URL=
#GCS_CLIENT_CERT= #GCS_CLIENT_CERT=
# Define the default locale language code (i.e. 'en' for English) from the following list: # Define the default locale language code (i.e. 'en' for English) from the following list:
# [en, ar, fr, es] # [en, ar, fr, es, fa_IR]
#DEFAULT_LOCALE=en #DEFAULT_LOCALE=en
# Set this if you like to deploy Greenlight on a relative root path other than / # Set this if you like to deploy Greenlight on a relative root path other than /
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment