Load the default language on startup #133

Merged
jakob.scheid merged 3 commits from fix/load-default-language into main 2026-07-21 19:59:06 +02:00
Showing only changes of commit f343d99406 - Show all commits
+14 -19
View File
@@ -14,26 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { createApp } from 'vue' import { createApp } from 'vue';
import App from './App.vue' import App from './App.vue';
import { i18n, loadLanguage, fallbackLocale } from './i18n' import { i18n, loadLanguage, fallbackLocale } from './i18n';
import getCurrentLanguage from './utils/currentLanguage' import getCurrentLanguage from './utils/currentLanguage';
import router from './router' import router from './router';
import './styles/common.css' import './styles/common.css';
import './styles/variables/colors.css' import './styles/variables/colors.css';
(async () => { (async () => {
await loadLanguage(fallbackLocale) await loadLanguage(fallbackLocale);
jakob.scheid marked this conversation as resolved Outdated
Outdated
Review

Please use a semicolon at the end of the line.

Please use a semicolon at the end of the line.
Outdated
Review

I will fix that.

I will fix that.
await loadLanguage(getCurrentLanguage());
jakob.scheid marked this conversation as resolved Outdated
Outdated
Review

This check is not necessary. loadLanguage already checks whether a language has already been loaded. If the language preferred by the user is the same as the fallback language, it is not redundantly fetched.

This check is not necessary. `loadLanguage` already checks whether a language has already been loaded. If the language preferred by the user is the same as the fallback language, it is not redundantly fetched.
const currentLanguage = getCurrentLanguage() createApp(App)
.use(router)
if (currentLanguage !== fallbackLocale) { .use(i18n)
await loadLanguage(currentLanguage) .mount('#app');
} })();
createApp(App)
.use(router)
.use(i18n)
.mount('#app')
})()