mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 22:29:10 +00:00
Better support for Armenian language
This commit is contained in:
parent
9da38ca9e4
commit
e46783fd9d
7 changed files with 77 additions and 40 deletions
|
@ -2169,18 +2169,25 @@ public final class KeyboardTextsTable {
|
||||||
/* morekeys_nordic_row2_11 ~ */
|
/* morekeys_nordic_row2_11 ~ */
|
||||||
null, null, null, null, null, null, null,
|
null, null, null, null, null, null, null,
|
||||||
/* ~ morekeys_swiss_row2_11 */
|
/* ~ morekeys_swiss_row2_11 */
|
||||||
// U+055E: "՞" ARMENIAN QUESTION MARK
|
//
|
||||||
// U+055C: "՜" ARMENIAN EXCLAMATION MARK
|
// ( U+0028 "(" Բացվող փակագիծ - OPENING PARENTHESES
|
||||||
// U+055A: "՚" ARMENIAN APOSTROPHE
|
// ) U+0029 ")" Փակվող փակագիծ - CLOSING PARENTHESES
|
||||||
// U+0559: "ՙ" ARMENIAN MODIFIER LETTER LEFT HALF RING
|
// ' U+0027 "'" Ապաթարց - APOSTROPHE
|
||||||
// U+055D: "՝" ARMENIAN COMMA
|
// … U+2026 "…" Կախման կետեր
|
||||||
// U+055B: "՛" ARMENIAN EMPHASIS MARK
|
// ՞ U+055E "՞" Հարցական - ARMENIAN QUESTION MARK
|
||||||
// U+058A: "֊" ARMENIAN HYPHEN
|
// ՜ U+055C "՜" Բացականչական - ARMENIAN EXCLAMATION MARK
|
||||||
// U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
// ՛ U+055B "՛" Շեշտ
|
||||||
// U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
// ՝ U+055D "՝" Բութ
|
||||||
// U+055F: "՟" ARMENIAN ABBREVIATION MARK
|
// ֊ U+058A "֊" Միության գծիկ - ARMENIAN HYPHEN
|
||||||
/* morekeys_punctuation */ "!autoColumnOrder!8,\\,,\u055E,\u055C,.,\u055A,\u0559,?,!,\u055D,\u055B,\u058A,\u00BB,\u00AB,\u055F,;,:",
|
// ― U+2015 "―" Անջատման գժիկ - ARMENIAN SEPARATION MARK
|
||||||
/* keyspec_tablet_comma */ "\u055D",
|
// « U+00AB "«" Բացվող չակերտ - LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||||
|
// » U+00BB "»" Փակվող չակերտ - RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||||
|
// , U+002C "," Ստօրակետ - ARMENIAN COMMA
|
||||||
|
// ։ U+0589 "։" Վերջակետ - ARMENIAN COLON
|
||||||
|
// ․ U+2024 "․" Միջակետ
|
||||||
|
//
|
||||||
|
/* morekeys_punctuation */ "!autoColumnOrder!8,\\,,\u055E,\u055C,\u2024,\u2026,',=,/,\u055D,\u055B,\u058A,\u00BB,\u00AB,\u2015,),(",
|
||||||
|
/* keyspec_tablet_comma */ ",",
|
||||||
/* morekeys_star ~ */
|
/* morekeys_star ~ */
|
||||||
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||||
/* ~ keyspec_right_single_angle_quote */
|
/* ~ keyspec_right_single_angle_quote */
|
||||||
|
@ -2188,13 +2195,12 @@ public final class KeyboardTextsTable {
|
||||||
// TODO: Enable this when we have glyph for the following letter
|
// TODO: Enable this when we have glyph for the following letter
|
||||||
// <string name="keyspec_currency">֏</string>
|
// <string name="keyspec_currency">֏</string>
|
||||||
//
|
//
|
||||||
// U+055D: "՝" ARMENIAN COMMA
|
// U+002C: "," ARMENIAN COMMA
|
||||||
/* keyspec_comma */ "\u055D",
|
/* keyspec_comma */ ",",
|
||||||
/* morekeys_tablet_comma */ null,
|
/* morekeys_tablet_comma */ null,
|
||||||
/* keyhintlabel_period */ null,
|
/* keyhintlabel_period */ null,
|
||||||
// U+055E: "՞" ARMENIAN QUESTION MARK
|
// U+055E: "՞" ARMENIAN QUESTION MARK
|
||||||
// U+00BF: "¿" INVERTED QUESTION MARK
|
/* morekeys_question */ "\u055E",
|
||||||
/* morekeys_question */ "\u055E,\u00BF",
|
|
||||||
/* morekeys_h ~ */
|
/* morekeys_h ~ */
|
||||||
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||||
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||||
|
@ -2202,8 +2208,7 @@ public final class KeyboardTextsTable {
|
||||||
null, null, null,
|
null, null, null,
|
||||||
/* ~ morekeys_greater_than */
|
/* ~ morekeys_greater_than */
|
||||||
// U+055C: "՜" ARMENIAN EXCLAMATION MARK
|
// U+055C: "՜" ARMENIAN EXCLAMATION MARK
|
||||||
// U+00A1: "¡" INVERTED EXCLAMATION MARK
|
/* morekeys_exclamation */ "\u055C",
|
||||||
/* morekeys_exclamation */ "\u055C,\u00A1",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Locale is: Icelandic */
|
/* Locale is: Icelandic */
|
||||||
|
|
|
@ -113,6 +113,8 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
|
||||||
switch (script) {
|
switch (script) {
|
||||||
case ScriptUtils.SCRIPT_LATIN:
|
case ScriptUtils.SCRIPT_LATIN:
|
||||||
return "qwerty";
|
return "qwerty";
|
||||||
|
case ScriptUtils.SCRIPT_ARMENIAN:
|
||||||
|
return "armenian_phonetic";
|
||||||
case ScriptUtils.SCRIPT_CYRILLIC:
|
case ScriptUtils.SCRIPT_CYRILLIC:
|
||||||
return "east_slavic";
|
return "east_slavic";
|
||||||
case ScriptUtils.SCRIPT_GREEK:
|
case ScriptUtils.SCRIPT_GREEK:
|
||||||
|
|
|
@ -45,6 +45,8 @@ import org.dslul.openboard.inputmethod.latin.utils.SuggestionResults;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
||||||
private static final String TAG = AndroidWordLevelSpellCheckerSession.class.getSimpleName();
|
private static final String TAG = AndroidWordLevelSpellCheckerSession.class.getSimpleName();
|
||||||
|
@ -62,6 +64,15 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
||||||
private static final String quotesRegexp =
|
private static final String quotesRegexp =
|
||||||
"(\\u0022|\\u0027|\\u0060|\\u00B4|\\u2018|\\u2018|\\u201C|\\u201D)";
|
"(\\u0022|\\u0027|\\u0060|\\u00B4|\\u2018|\\u2018|\\u201C|\\u201D)";
|
||||||
|
|
||||||
|
private static final Map<Integer, String> scriptToPunctuationRegexMap = new TreeMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
scriptToPunctuationRegexMap.put(
|
||||||
|
ScriptUtils.SCRIPT_ARMENIAN,
|
||||||
|
"(\\u0028|\\u0029|\\u0027|\\u2026|\\u055E|\\u055C|\\u055B|\\u055D|\\u058A|\\u2015|\\u00AB|\\u00BB|\\u002C|\\u0589|\\u2024)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static final class SuggestionsParams {
|
private static final class SuggestionsParams {
|
||||||
public final String[] mSuggestions;
|
public final String[] mSuggestions;
|
||||||
public final int mFlags;
|
public final int mFlags;
|
||||||
|
@ -260,12 +271,22 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
||||||
final TextInfo textInfo, final NgramContext ngramContext, final int suggestionsLimit) {
|
final TextInfo textInfo, final NgramContext ngramContext, final int suggestionsLimit) {
|
||||||
try {
|
try {
|
||||||
updateLocale();
|
updateLocale();
|
||||||
final String text = textInfo.getText().
|
// It's good to keep this not local specific since the standard
|
||||||
|
// ones may show up in other languages also.
|
||||||
|
String text = textInfo.getText().
|
||||||
replaceAll(AndroidSpellCheckerService.APOSTROPHE,
|
replaceAll(AndroidSpellCheckerService.APOSTROPHE,
|
||||||
AndroidSpellCheckerService.SINGLE_QUOTE).
|
AndroidSpellCheckerService.SINGLE_QUOTE).
|
||||||
replaceAll("^" + quotesRegexp, "").
|
replaceAll("^" + quotesRegexp, "").
|
||||||
replaceAll(quotesRegexp + "$", "");
|
replaceAll(quotesRegexp + "$", "");
|
||||||
|
|
||||||
|
final String localeRegex = scriptToPunctuationRegexMap.get(
|
||||||
|
ScriptUtils.getScriptFromSpellCheckerLocale(mLocale)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (localeRegex != null) {
|
||||||
|
text = text.replaceAll(localeRegex, "");
|
||||||
|
}
|
||||||
|
|
||||||
if (!mService.hasMainDictionaryForLocale(mLocale)) {
|
if (!mService.hasMainDictionaryForLocale(mLocale)) {
|
||||||
return AndroidSpellCheckerService.getNotInDictEmptySuggestions(
|
return AndroidSpellCheckerService.getNotInDictEmptySuggestions(
|
||||||
false /* reportAsTypo */);
|
false /* reportAsTypo */);
|
||||||
|
|
BIN
app/src/main/res/raw/main_hy.dict
Normal file
BIN
app/src/main/res/raw/main_hy.dict
Normal file
Binary file not shown.
|
@ -55,6 +55,10 @@
|
||||||
android:label="@string/subtype_generic"
|
android:label="@string/subtype_generic"
|
||||||
android:subtypeLocale="ru"
|
android:subtypeLocale="ru"
|
||||||
/>
|
/>
|
||||||
|
<subtype
|
||||||
|
android:label="@string/subtype_generic"
|
||||||
|
android:subtypeLocale="hy"
|
||||||
|
/>
|
||||||
<subtype
|
<subtype
|
||||||
android:label="@string/subtype_generic"
|
android:label="@string/subtype_generic"
|
||||||
android:subtypeLocale="pt_BR"
|
android:subtypeLocale="pt_BR"
|
||||||
|
|
BIN
dictionaries/hy_wordlist.combined.gz
Normal file
BIN
dictionaries/hy_wordlist.combined.gz
Normal file
Binary file not shown.
|
@ -23,30 +23,35 @@
|
||||||
U+0532: "Բ" ARMENIAN CAPITAL LETTER BEN
|
U+0532: "Բ" ARMENIAN CAPITAL LETTER BEN
|
||||||
U+0533: "Գ" ARMENIAN CAPITAL LETTER GIM -->
|
U+0533: "Գ" ARMENIAN CAPITAL LETTER GIM -->
|
||||||
<string name="keylabel_to_alpha">ԱԲԳ</string>
|
<string name="keylabel_to_alpha">ԱԲԳ</string>
|
||||||
<!-- U+055E: "՞" ARMENIAN QUESTION MARK
|
<!--
|
||||||
U+055C: "՜" ARMENIAN EXCLAMATION MARK
|
( U+0028 "(" Բացվող փակագիծ - OPENING PARENTHESES
|
||||||
U+055A: "՚" ARMENIAN APOSTROPHE
|
) U+0029 ")" Փակվող փակագիծ - CLOSING PARENTHESES
|
||||||
U+0559: "ՙ" ARMENIAN MODIFIER LETTER LEFT HALF RING
|
' U+0027 "'" Ապաթարց - APOSTROPHE
|
||||||
U+055D: "՝" ARMENIAN COMMA
|
… U+2026 "…" Կախման կետեր
|
||||||
U+055B: "՛" ARMENIAN EMPHASIS MARK
|
՞ U+055E "՞" Հարցական - ARMENIAN QUESTION MARK
|
||||||
U+058A: "֊" ARMENIAN HYPHEN
|
՜ U+055C "՜" Բացականչական - ARMENIAN EXCLAMATION MARK
|
||||||
U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
՛ U+055B "՛" Շեշտ
|
||||||
U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
՝ U+055D "՝" Բութ
|
||||||
U+055F: "՟" ARMENIAN ABBREVIATION MARK -->
|
֊ U+058A "֊" Միության գծիկ - ARMENIAN HYPHEN
|
||||||
<string name="morekeys_punctuation">"!autoColumnOrder!8,\\,,՞,՜,.,՚,ՙ,?,!,՝,՛,֊,»,«,՟,;,:"</string>
|
― U+2015 "―" Անջատման գժիկ - ARMENIAN SEPARATION MARK
|
||||||
<!-- U+055E: "՞" ARMENIAN QUESTION MARK
|
« U+00AB "«" Բացվող չակերտ - LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||||
U+00BF: "¿" INVERTED QUESTION MARK -->
|
» U+00BB "»" Փակվող չակերտ - RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||||
<string name="morekeys_question">՞,¿</string>
|
, U+002C "," Ստօրակետ - ARMENIAN COMMA
|
||||||
<!-- U+055C: "՜" ARMENIAN EXCLAMATION MARK
|
։ U+0589 "։" Վերջակետ - ARMENIAN COLON
|
||||||
U+00A1: "¡" INVERTED EXCLAMATION MARK -->
|
․ U+2024 "․" Միջակետ
|
||||||
<string name="morekeys_exclamation">՜,¡</string>
|
-->
|
||||||
|
<string name="morekeys_punctuation">"!autoColumnOrder!8,\\,,՞,՜,․,…,',=,/,՝,՛,֊,»,«,―,),("</string>
|
||||||
|
<!-- U+055E: "՞" ARMENIAN QUESTION MARK -->
|
||||||
|
<string name="morekeys_question">՞</string>
|
||||||
|
<!-- U+055C: "՜" ARMENIAN EXCLAMATION MARK -->
|
||||||
|
<string name="morekeys_exclamation">՜</string>
|
||||||
<!-- U+058F: "֏" ARMENIAN DRAM SIGN -->
|
<!-- U+058F: "֏" ARMENIAN DRAM SIGN -->
|
||||||
<!-- TODO: Enable this when we have glyph for the following letter
|
<!-- TODO: Enable this when we have glyph for the following letter
|
||||||
<string name="keyspec_currency">֏</string>
|
<string name="keyspec_currency">֏</string>
|
||||||
-->
|
-->
|
||||||
<!-- U+055D: "՝" ARMENIAN COMMA -->
|
<!-- U+002C: "," ARMENIAN COMMA -->
|
||||||
<string name="keyspec_comma">՝</string>
|
<string name="keyspec_comma">,</string>
|
||||||
<string name="keyspec_tablet_comma">՝</string>
|
<string name="keyspec_tablet_comma">,</string>
|
||||||
<!-- U+0589: "։" ARMENIAN FULL STOP -->
|
<!-- U+0589: "։" ARMENIAN FULL STOP -->
|
||||||
<string name="keyspec_period">։</string>
|
<string name="keyspec_period">։</string>
|
||||||
<string name="keyspec_tablet_period">։</string>
|
<string name="keyspec_tablet_period">։</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue