mirror of https://github.com/jetkvm/kvm.git
Added exposition on isoCode management
This commit is contained in:
parent
c28f3b4cd0
commit
ce95be8af9
|
@ -7,6 +7,12 @@ export function useKeyboardLayout(): { keyboard: KeyboardLayout } {
|
||||||
const { keyboardLayout } = useSettingsStore();
|
const { keyboardLayout } = useSettingsStore();
|
||||||
|
|
||||||
const isoCode = useMemo(() => {
|
const isoCode = useMemo(() => {
|
||||||
|
// If we don't have a specific layout, default to "en-US" because that was the original layout
|
||||||
|
// developed so it is a good fallback. Additionally, we replace "en_US" with "en-US" because
|
||||||
|
// the original server-side code used "en_US" as the default value, but that's not the correct
|
||||||
|
// ISO code for English/United State. To ensure we remain backward compatible with devices that
|
||||||
|
// have not had their Keyboard Layout selected by the user, we want to treat "en_US" as if it was
|
||||||
|
// "en-US" to match the ISO standard codes now used in the keyboardLayouts.
|
||||||
console.log("Current keyboard layout from store:", keyboardLayout);
|
console.log("Current keyboard layout from store:", keyboardLayout);
|
||||||
if (keyboardLayout && keyboardLayout.length > 0)
|
if (keyboardLayout && keyboardLayout.length > 0)
|
||||||
return keyboardLayout.replace("en_US", "en-US");
|
return keyboardLayout.replace("en_US", "en-US");
|
||||||
|
@ -14,7 +20,6 @@ export function useKeyboardLayout(): { keyboard: KeyboardLayout } {
|
||||||
}, [keyboardLayout]);
|
}, [keyboardLayout]);
|
||||||
|
|
||||||
const keyboard = useMemo(() => {
|
const keyboard = useMemo(() => {
|
||||||
console.log("Selected keyboard layout:", isoCode);
|
|
||||||
return selectedKeyboard(isoCode);
|
return selectedKeyboard(isoCode);
|
||||||
}, [isoCode]);
|
}, [isoCode]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue