2022-08-15 20:37:52 +08:00
|
|
|
const e = require('../core/elements');
|
|
|
|
const defaultLocale = require('../../../bigbluebutton-html5/public/locales/en.json');
|
2021-11-16 00:42:29 +08:00
|
|
|
|
2022-01-20 03:50:59 +08:00
|
|
|
async function openSettings(test) {
|
2022-01-20 21:03:18 +08:00
|
|
|
await test.waitAndClick(e.optionsButton);
|
2022-01-20 03:50:59 +08:00
|
|
|
await test.waitAndClick(e.settings);
|
2021-11-16 00:42:29 +08:00
|
|
|
}
|
|
|
|
|
2022-02-04 02:44:48 +08:00
|
|
|
async function getLocaleValues(elements, locale) {
|
|
|
|
const currentValues = {};
|
|
|
|
let currentLocale = {};
|
|
|
|
try {
|
|
|
|
currentLocale = require(`../../../bigbluebutton-html5/public/locales/${locale.replace('-', '_')}.json`);
|
2022-04-08 02:34:25 +08:00
|
|
|
} catch (err) { }
|
2022-02-04 02:44:48 +08:00
|
|
|
|
|
|
|
for (const selector in elements) {
|
|
|
|
const currentKey = elements[selector];
|
2022-02-18 19:41:44 +08:00
|
|
|
currentValues[selector] = currentLocale[currentKey] ? currentLocale[currentKey] : getValueFromSecondaryLocale();
|
2022-02-04 02:44:48 +08:00
|
|
|
|
|
|
|
function getValueFromSecondaryLocale() {
|
|
|
|
const generalLocaleName = locale.split('-')[0];
|
|
|
|
let generalLocale = {};
|
|
|
|
try {
|
|
|
|
generalLocale = require(`../../../bigbluebutton-html5/public/locales/${generalLocaleName}.json`);
|
2022-04-08 02:34:25 +08:00
|
|
|
} catch (err) { }
|
2022-02-18 19:41:44 +08:00
|
|
|
return generalLocale[currentKey] ? generalLocale[currentKey] : defaultLocale[currentKey];
|
2022-02-04 02:44:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return currentValues;
|
|
|
|
}
|
|
|
|
|
2022-08-15 20:37:52 +08:00
|
|
|
async function openAboutModal(test) {
|
|
|
|
await test.waitAndClick(e.optionsButton);
|
|
|
|
await test.waitAndClick(e.showAboutModalButton);
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.openAboutModal = openAboutModal;
|
2021-11-16 00:42:29 +08:00
|
|
|
exports.openSettings = openSettings;
|
2022-02-04 02:44:48 +08:00
|
|
|
exports.getLocaleValues = getLocaleValues;
|