Skip to content

Commit

Permalink
i18n: change iframe disabled message based on current hostname (#13950)
Browse files Browse the repository at this point in the history
* i18n: change iframe disabled message based on current hostname

This will allow us to remove translation overrides from branded repo

* fix linter
  • Loading branch information
quitrk authored Oct 13, 2023
1 parent 8741ee7 commit d02c7dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@
"dataChannelClosed": "Video quality impaired",
"dataChannelClosedDescription": "The bridge channel has been disconnected and thus video quality is limited to its lowest setting.",
"disabledIframe": "Embedding is only meant for demo purposes, so this call will disconnect in {{timeout}} minutes.",
"disabledIframeSecondary": "Embedding {{domain}} is only meant for demo purposes, so this call will disconnect in {{timeout}} minutes. Please use <a href='{{jaasDomain}}' rel='noopener noreferrer' target='_blank'>Jitsi as a Service</a> for production embedding!",
"disconnected": "disconnected",
"displayNotifications": "Display notifications for",
"dontRemindMe": "Do not remind me",
Expand Down
21 changes: 20 additions & 1 deletion react/features/conference/middleware.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,30 @@ function _checkIframe(state: IReduxState, dispatch: IStore['dispatch']) {
if (inIframe() && state['features/base/config'].disableIframeAPI && !browser.isElectron()
&& !isVpaasMeeting(state) && !allowIframe) {
// show sticky notification and redirect in 5 minutes
const { locationURL } = state['features/base/connection'];
let translationKey = 'notify.disabledIframe';
const hostname = locationURL?.hostname ?? '';
let domain = '';

const mapping: Record<string, string> = {
'8x8.vc': 'https://jaas.8x8.vc',
'meet.jit.si': 'https://jitsi.org/jaas'
};

const jaasDomain = mapping[hostname];

if (jaasDomain) {
translationKey = 'notify.disabledIframeSecondary';
domain = hostname;
}

dispatch(showWarningNotification({
description: translateToHTML(
i18next.t.bind(i18next),
'notify.disabledIframe',
translationKey,
{
domain,
jaasDomain,
timeout: IFRAME_DISABLED_TIMEOUT_MINUTES
}
)
Expand Down

0 comments on commit d02c7dc

Please sign in to comment.