Skip to content

Commit

Permalink
Merge pull request #12897 from ramonlsouza/issue-12887
Browse files Browse the repository at this point in the history
Add override locale support - guest wait page
  • Loading branch information
antobinary committed Aug 5, 2021
2 parents 696a141 + 7def76c commit 1ff6a26
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions bigbluebutton-html5/private/static/guest-wait/guest-wait.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,45 @@
});
};

function fetchLocalizedMessages() {
async function fetchOverrideLocale() {
const token = findSessionToken();
let overrideLocale = false;

if (token) {
const sessionToken = token.split('=')[1];

// use enter api to get params for the client
const ENTER_ENDPOINT = `/bigbluebutton/api/enter?sessionToken=${sessionToken}`;
const url = new URL(`${window.location.origin}${ENTER_ENDPOINT}`);

const fetchContent = await fetch(url, { credentials: 'same-origin' });
const parseToJson = await fetchContent.json();
const { response } = parseToJson;

if (response.returncode !== 'FAILED') {
const { customdata } = response;

customdata.forEach((el) => {
const settingKey = Object.keys(el).shift();

if (settingKey === 'bbb_override_default_locale') {
overrideLocale = el[settingKey];
}
});
}
}
return overrideLocale;
}

async function fetchLocalizedMessages() {
const DEFAULT_LANGUAGE = 'en';
const LOCALES_ENDPOINT = '/html5client/locale';
const url = new URL(`${window.location.origin}${LOCALES_ENDPOINT}`);
url.search = `locale=${navigator.language}`;
const overrideLocale = await fetchOverrideLocale();

url.search = overrideLocale
? `locale=${overrideLocale}`
: `locale=${navigator.language}&init=true`;

const localesPath = 'locales';

Expand Down

0 comments on commit 1ff6a26

Please sign in to comment.