1
0
Fork 0
This commit is contained in:
sspanak 2024-12-28 14:07:57 +02:00 committed by Dimo Karaivanov
parent 240e5c444a
commit e3d0bac90f
13 changed files with 1380245 additions and 18 deletions

View file

@ -17,11 +17,7 @@ class LocaleWordsSorter {
LocaleWordsSorter(@Nullable Language language) {
if (LanguageKind.isHindi(language)) {
sortingPattern = Pattern.compile("[\\u0904-\\u0939\\u0958-\\u0961][\\u0900-\\u0904\\u093A-\\u094F\\u0962\\u0963]+");
} else {
sortingPattern = null;
}
sortingPattern = LanguageKind.isIndic(language) ? Pattern.compile("\\p{L}\\p{M}+") : null;
}

View file

@ -5,17 +5,19 @@ import java.util.Locale;
public class LanguageKind {
public static final int KOREAN = 601579;
public static boolean isArabic(Language language) { return language != null && language.getId() == 502337; }
public static boolean isCyrillic(Language language) { return language != null && language.getKeyCharacters(2).contains("а"); }
public static boolean isLatinBased(Language language) { return language != null && language.getKeyCharacters(2).contains("a"); }
public static boolean isRTL(Language language) { return isArabic(language) || isHebrew(language); }
public static boolean isArabic(Language language) { return language != null && language.getId() == 502337; }
public static boolean isEnglish(Language language) { return language != null && language.getLocale().equals(Locale.ENGLISH); }
public static boolean isFrench(Language language) { return language != null && language.getId() == 596550; }
public static boolean isGreek(Language language) { return language != null && language.getId() == 597381; }
public static boolean isGujarati(Language language) { return language != null && language.getId() == 468647; }
public static boolean isHebrew(Language language) { return language != null && (language.getId() == 305450 || language.getId() == 403177); }
public static boolean isHindi(Language language) { return language != null && language.getId() == 468264; }
public static boolean isIndic(Language language) { return isHindi(language); }
public static boolean isHinglish(Language language) { return language != null && language.getId() == 468421; }
public static boolean isIndic(Language language) { return isGujarati(language) || isHindi(language); }
public static boolean isKorean(Language language) { return language != null && language.getId() == KOREAN; }
public static boolean isLatinBased(Language language) { return language != null && language.getKeyCharacters(2).contains("a"); }
public static boolean isRTL(Language language) { return isArabic(language) || isHebrew(language); }
public static boolean isUkrainian(Language language) { return language != null && language.getId() == 54645; }
}

View file

@ -211,9 +211,12 @@ public class SoftKeyNumber extends SoftKey {
// Greek diacritics and ending sigma
|| currentLetter == 'ς'
|| (isGreek && (currentLetter < 'α' || currentLetter > 'ω'))
// Hindi matras
// Hindi combining
|| (currentLetter >= 0x0900 && currentLetter <= 0x0903) || (currentLetter >= 0x093A && currentLetter <= 0x094F)
|| (currentLetter >= 0x0951 && currentLetter <= 0x0957) || currentLetter == 0x0962 || currentLetter == 0x0963
// Gujarati combining
|| (currentLetter >= 0x0A81 && currentLetter <= 0x0A83) || (currentLetter >= 0xABC && currentLetter <= 0x0ACD)
|| currentLetter == 0x0AE2 || currentLetter == 0x0AE3
;
}
}

View file

@ -25,10 +25,13 @@ class Punctuation {
',', '-', '\'', ':', ';', '!', '?', '.'
));
final private static ArrayList<Character> CombiningPunctuationIndic = new ArrayList<>(Arrays.asList(
'्', '़', 'ऽ', '', '।', '॰', '॥'
final private static ArrayList<Character> CombiningPunctuationGujarati = new ArrayList<>(Arrays.asList(
'્', '઼', 'ઽ', '', '।', '॰', '॥' // Indic combining chars look the same, but have different Unicode values
));
final private static ArrayList<Character> CombiningPunctuationHindi = new ArrayList<>(Arrays.asList(
'्', '़', 'ऽ', '', '।', '॰', '॥' // Indic combining chars look the same, but have different Unicode values
));
final private static ArrayList<Character> CombiningPunctuationHebrew = new ArrayList<>(Arrays.asList(
',' , '-', '\'', ':', ';', '!', '?', '.', '"'
@ -65,11 +68,16 @@ class Punctuation {
public static boolean isCombiningPunctuation(Language language, char ch) {
return
CombiningPunctuation.contains(ch)
|| (LanguageKind.isIndic(language) && CombiningPunctuationIndic.contains(ch))
|| (LanguageKind.isGujarati(language) && CombiningPunctuationGujarati.contains(ch))
|| (LanguageKind.isHindi(language) && CombiningPunctuationHindi.contains(ch))
|| (LanguageKind.isHebrew(language) && CombiningPunctuationHebrew.contains(ch));
}
public static boolean isCombiningPunctuation(char ch) {
return CombiningPunctuation.contains(ch) || CombiningPunctuationIndic.contains(ch) || CombiningPunctuationHebrew.contains(ch);
return
CombiningPunctuation.contains(ch)
|| CombiningPunctuationGujarati.contains(ch)
|| CombiningPunctuationHindi.contains(ch)
|| CombiningPunctuationHebrew.contains(ch);
}
}