mirror of
https://github.com/frappe/books.git
synced 2024-11-14 09:24:04 +00:00
fix: load langs on boot properly
- don't reload in setup wizard cause it crashes at times. - will undo the above once fixed
This commit is contained in:
parent
7afac9cfbd
commit
ab93349e11
@ -2,8 +2,8 @@
|
|||||||
<FormControl
|
<FormControl
|
||||||
:df="languageDf"
|
:df="languageDf"
|
||||||
:value="value"
|
:value="value"
|
||||||
@change="setLanguageMap"
|
@change="(v) => setLanguageMap(v, dontReload)"
|
||||||
:input-class="'focus:outline-none rounded '+inputClass"
|
:input-class="'focus:outline-none rounded ' + inputClass"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -23,6 +23,10 @@ export default {
|
|||||||
default:
|
default:
|
||||||
'bg-gray-100 active:bg-gray-200 focus:bg-gray-200 px-3 py-2 text-base',
|
'bg-gray-100 active:bg-gray-200 focus:bg-gray-200 px-3 py-2 text-base',
|
||||||
},
|
},
|
||||||
|
dontReload: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: { FormControl },
|
components: { FormControl },
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -10,11 +10,10 @@ import { IPC_CHANNELS, IPC_MESSAGES } from './messages';
|
|||||||
import router from './router';
|
import router from './router';
|
||||||
import { outsideClickDirective } from './ui';
|
import { outsideClickDirective } from './ui';
|
||||||
import { setLanguageMap, showToast, stringifyCircular } from './utils';
|
import { setLanguageMap, showToast, stringifyCircular } from './utils';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const language = config.get('language');
|
const language = config.get('language');
|
||||||
if (language) {
|
if (language) {
|
||||||
setLanguageMap(language);
|
await setLanguageMap(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
frappe.isServer = true;
|
frappe.isServer = true;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="flex flex-col justify-center items-center h-96">
|
<div class="flex flex-col justify-center items-center h-96">
|
||||||
<LanguageSelector class="w-40 mt-8" />
|
<LanguageSelector class="w-40 mt-8" :dont-reload="true" />
|
||||||
<p
|
<p
|
||||||
class="text-sm mt-2 hover:underline cursor-pointer text-gray-700"
|
class="text-sm mt-2 hover:underline cursor-pointer text-gray-700"
|
||||||
@click="openContributingTranslations"
|
@click="openContributingTranslations"
|
||||||
|
@ -479,7 +479,7 @@ async function fetchAndSetLanguageMap(code) {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setLanguageMap(initLanguage) {
|
export async function setLanguageMap(initLanguage, dontReload = false) {
|
||||||
const oldLanguage = config.get('language');
|
const oldLanguage = config.get('language');
|
||||||
initLanguage ??= oldLanguage;
|
initLanguage ??= oldLanguage;
|
||||||
const [code, language, usingDefault] = getLanguageCode(
|
const [code, language, usingDefault] = getLanguageCode(
|
||||||
@ -498,8 +498,8 @@ export async function setLanguageMap(initLanguage) {
|
|||||||
config.set('language', language);
|
config.set('language', language);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success && initLanguage !== oldLanguage) {
|
if (!dontReload && success && initLanguage !== oldLanguage) {
|
||||||
ipcRenderer.send(IPC_MESSAGES.RELOAD_MAIN_WINDOW);
|
await ipcRenderer.send(IPC_MESSAGES.RELOAD_MAIN_WINDOW);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user