Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load config.json before loading language so default can apply #10551

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/vector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ async function loadApp() {

await loadOlm();

await loadLanguage();

const fragparts = parseQsFromFragment(window.location);
const params = parseQs(window.location);

// set the platform for react sdk
if (window.ipcRenderer) {
console.log("Using Electron platform");
Expand Down Expand Up @@ -239,6 +234,12 @@ async function loadApp() {
// granular settings are loaded correctly and to avoid duplicating the override logic for the theme.
SdkConfig.put(configJson);

// Load language after loading config.json so that settingsDefaults.language can be applied
await loadLanguage();

const fragparts = parseQsFromFragment(window.location);
const params = parseQs(window.location);

// don't try to redirect to the native apps if we're
// verifying a 3pid (but after we've loaded the config)
// or if the user is following a deep link
Expand Down Expand Up @@ -430,6 +431,7 @@ function loadOlm() {

async function loadLanguage() {
const prefLang = SettingsStore.getValue("language", null, /*excludeDefault=*/true);
console.log("DEBUG", prefLang);
let langs = [];

if (!prefLang) {
Expand All @@ -439,6 +441,7 @@ async function loadLanguage() {
} else {
langs = [prefLang];
}
console.log("DEBUG1", langs);
try {
await languageHandler.setLanguage(langs);
document.documentElement.setAttribute("lang", languageHandler.getCurrentLanguage());
Expand Down