Skip to content

Commit 2ae989d

Browse files
committed
Fix for non-english initial locales
1 parent 5659d0e commit 2ae989d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

LocaleSelector.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { locale } from "./locale.js";
33
import recognition from "./recognition.js";
4-
let selectedLocaleCode;
4+
let selectedLocaleCode = locale.getCurrentLocaleCode();
55
</script>
66

77
<style>

locale.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const getInitialLocale = () => {
1515
};
1616

1717
let currentLocaleCode = getInitialLocale().substr(0, 2);
18+
19+
if (!(currentLocaleCode in locales)) currentLocaleCode = "en";
20+
1821
let currentLocale = locales[currentLocaleCode];
1922

2023
console.log(`Initial locale ${currentLocaleCode}`);

0 commit comments

Comments
 (0)