forked from External/greenlight
Open graph displaying incorrect language bug (#2836)
* Open graph displaying incorrect language bug * Cleaning and Fixes
This commit is contained in:
parent
e082cd2b85
commit
d53cfc0c50
|
@ -94,14 +94,18 @@ class ApplicationController < ActionController::Base
|
||||||
render :migration_error, status: 500 unless ENV["DB_MIGRATE_FAILED"].blank?
|
render :migration_error, status: 500 unless ENV["DB_MIGRATE_FAILED"].blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets the appropriate locale.
|
# Determines proper locale to be used by calling user_locale with params based on if room owner exists
|
||||||
def user_locale(user = current_user)
|
def determine_locale(user)
|
||||||
locale = if user && user.language != 'default'
|
if user && user.language != 'default'
|
||||||
user.language
|
user.language
|
||||||
else
|
else
|
||||||
Rails.configuration.default_locale.presence || http_accept_language.language_region_compatible_from(I18n.available_locales)
|
Rails.configuration.default_locale.presence || http_accept_language.language_region_compatible_from(I18n.available_locales)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Sets the appropriate locale.
|
||||||
|
def user_locale(user = current_user)
|
||||||
|
locale = determine_locale(user)
|
||||||
begin
|
begin
|
||||||
I18n.locale = locale.tr('-', '_') unless locale.nil?
|
I18n.locale = locale.tr('-', '_') unless locale.nil?
|
||||||
rescue
|
rescue
|
||||||
|
@ -110,6 +114,7 @@ class ApplicationController < ActionController::Base
|
||||||
I18n.locale = "en"
|
I18n.locale = "en"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
helper_method :user_locale
|
||||||
|
|
||||||
# Checks to make sure that the admin has changed his password from the default
|
# Checks to make sure that the admin has changed his password from the default
|
||||||
def check_admin_password
|
def check_admin_password
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<title><%= yield(:page_title).present? ? yield(:page_title) : t("bigbluebutton") %></title>
|
<title><%= yield(:page_title).present? ? yield(:page_title) : t("bigbluebutton") %></title>
|
||||||
<meta property="og:title" content="<%= yield(:page_title).present? ? yield(:page_title) : t("bigbluebutton") %>" />
|
<meta property="og:title" content="<%= yield(:page_title).present? ? yield(:page_title) : t("bigbluebutton") %>" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
|
<meta property="og:locale" content=<%=user_locale(@room&.owner)%> />
|
||||||
<meta property="og:description" content="<%= yield(:page_desc).present? ? yield(:page_desc) : t("landing.about", href: "Greenlight", locale: :en) %>" />
|
<meta property="og:description" content="<%= yield(:page_desc).present? ? yield(:page_desc) : t("landing.about", href: "Greenlight", locale: :en) %>" />
|
||||||
<meta property="og:url" content="<%= request.base_url %>" />
|
<meta property="og:url" content="<%= request.base_url %>" />
|
||||||
<meta property="og:image" content="<%= logo_image %>" />
|
<meta property="og:image" content="<%= logo_image %>" />
|
||||||
|
|
Loading…
Reference in New Issue