add gujarati layout (likely needs improvement, see #417)

This commit is contained in:
Helium314 2024-01-21 11:08:29 +01:00
parent c81f7fc59b
commit 279c564c72
3 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,132 @@
[
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ધ" },
"default": { "label": "અ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ન" },
"default": { "label": "ા" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "પ" },
"default": { "label": "િ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ફ" },
"default": { "label": "ી" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "બ" },
"default": { "label": "◌ુ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ભ" },
"default": { "label": "◌ૂ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "મ" },
"default": { "label": "◌ે" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ય" },
"default": { "label": "◌ૈ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ર" },
"default": { "label": "ો" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "લ" },
"default": { "label": "ૌ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "વ" },
"default": { "label": "ં" }
}
],
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "શ" },
"default": { "label": "", "popup": { "main": { "label": "૱" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ષ" },
"default": { "label": "ક", "popup": { "main": { "label": "ૅ" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "સ" },
"default": { "label": "ખ", "popup": { "main": { "label": "ૉ" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "હ" },
"default": { "label": "ગ", "popup": { "main": { "label": "઼" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ળ" },
"default": { "label": "ઘ", "popup": { "main": { "label": "ૺ" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ક્ષ" },
"default": { "label": "ઙ", "popup": { "main": { "label": "ઁ" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "જ્ઞ" },
"default": { "label": "ચ", "popup": { "main": { "label": "૾" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "આ" },
"default": { "label": "છ", "popup": { "main": { "label": "૿" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ઇ" },
"default": { "label": "જ", "popup": { "main": { "label": "ત્ર" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ઈ" },
"default": { "label": "ઝ", "popup": { "main": { "label": "શ્ર" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ઉ" },
"default": { "label": "ઞ", "popup": { "main": { "label": "શ્ર" } } }
}
],
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ઊ" },
"default": { "label": "ટ", "popup": { "main": { "label": "શ્વ" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "એ" },
"default": { "label": "ઠ", "popup": { "main": { "label": "ત્ત" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ઐ" },
"default": { "label": "ડ", "popup": { "main": { "label": "દ્ર" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ઓ" },
"default": { "label": "ઢ", "popup": { "main": { "label": "દ્વ" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ઔ" },
"default": { "label": "ણ", "popup": { "main": { "label": "દ્દ" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "અં" },
"default": { "label": "ત", "popup": { "main": { "label": "દ્ય" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "અઃ" },
"default": { "label": "થ", "popup": { "main": { "label": "꠰" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ૐ" },
"default": { "label": "દ", "popup": { "main": { "label": "꠱" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ૠ" },
"default": { "label": "્", "popup": { "main": { "label": "꠲" } } }
}
]
]

View file

@ -41,6 +41,7 @@ public class ScriptUtils {
public static final int SCRIPT_THAI = 17;
public static final int SCRIPT_BULGARIAN = 18; // todo: why is bulgarian a separate script?
public static final int SCRIPT_HANGUL = 19;
public static final int SCRIPT_GUJARATI = 20;
private static final TreeMap<String, Integer> mLanguageCodeToScriptCode;
private final static ArraySet<Integer> UPPERCASE_SCRIPTS = new ArraySet<>();
@ -79,6 +80,7 @@ public class ScriptUtils {
mLanguageCodeToScriptCode.put("kk", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("ky", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("ne", SCRIPT_DEVANAGARI);
mLanguageCodeToScriptCode.put("gu", SCRIPT_GUJARATI);
// only Latin, Cyrillic, Greek and Armenian have upper/lower case
// https://unicode.org/faq/casemap_charprop.html#3
@ -203,6 +205,9 @@ public class ScriptUtils {
|| codePoint >= 0xA960 && codePoint <= 0xA97C
|| codePoint >= 0xD7B0 && codePoint <= 0xD7C6
|| codePoint >= 0xD7CB && codePoint <= 0xD7FB);
case SCRIPT_GUJARATI:
// Gujarati unicode block is U+0A80..U+0AFF
return (codePoint >= 0xA80 && codePoint <= 0xAFF);
case SCRIPT_UNKNOWN:
return true;
default:

View file

@ -44,6 +44,7 @@
fr_CA: French (Canada)/qwerty
fr_CH: French (Switzerland)/qwertz+
gl_ES: Galician (Spain)/qwerty+
gu: Gujarati/gujarati
hi: Hindi/hindi
hi: Hindi/hindi_compact
hi_ZZ: Hinglish/qwerty # This is a preliminary keyboard layout.
@ -418,6 +419,15 @@
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty+,AsciiCapable,EmojiCapable"
android:isAsciiCapable="true"
/>
<subtype android:icon="@drawable/ic_ime_switcher"
android:label="@string/subtype_generic"
android:subtypeId="0x39713b7f"
android:imeSubtypeLocale="gu"
android:languageTag="gu"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=gujarati,EmojiCapable"
android:isAsciiCapable="false"
/>
<subtype android:icon="@drawable/ic_ime_switcher"
android:label="@string/subtype_generic"