Skip to content

Commit

Permalink
fixed rails backend I18n translations and added fallbacks (#5647)
Browse files Browse the repository at this point in the history
* fixed rails backend I18n translations and added fallbacks

* fixed rubocop issues

* updated fallback language to only english and pass locale for I18n translation meeting starter

* fixed meeting starter spec to expect correct language moderator message

* passing language localization for meeting starter access code
  • Loading branch information
SilentFlameCR authored Jan 8, 2024
1 parent a9a8181 commit 008cd52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/services/meeting_starter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def call

def computed_options(access_code:)
room_url = "#{root_url(host: @base_url)}rooms/#{@room.friendly_id}/join"
moderator_message = "#{I18n.t('meeting.moderator_message')}<br>#{room_url}"
moderator_message += "<br>#{I18n.t('meeting.access_code', code: access_code)}" if access_code.present?
moderator_message = "#{I18n.t('meeting.moderator_message', locale: @current_user.language.to_sym)}<br>#{room_url}"
moderator_message += "<br>#{I18n.t('meeting.access_code', code: access_code, locale: @current_user.language.to_sym)}" if access_code.present?
{
moderatorOnlyMessage: moderator_message,
logoutURL: room_url,
Expand Down
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ class Application < Rails::Application
config.relative_url_root = '/' if config.relative_url_root.blank?

I18n.load_path += Dir[Rails.root.join('config/locales/*.{rb,yml}').to_s]
config.i18n.fallbacks = %i[en]
end
end
2 changes: 1 addition & 1 deletion spec/services/meeting_starter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
let(:options) do
url = File.join(base_url, '/rooms/', room.friendly_id, '/join')
{
moderatorOnlyMessage: "To invite someone to the meeting, send them this link:<br>#{url}",
moderatorOnlyMessage: "#{I18n.t('meeting.moderator_message', locale: user.language.to_sym)}<br>#{url}",
logoutURL: url,
meta_endCallbackUrl: File.join(base_url, '/meeting_ended'),
'meta_bbb-recording-ready-url': File.join(base_url, '/recording_ready'),
Expand Down

0 comments on commit 008cd52

Please sign in to comment.