1
0
Fork 0

removed the capital letter hack and added a new one, only for the English I, in DictionaryLoader

removed some unused code and fixed a spelling mistake
This commit is contained in:
sspanak 2023-07-03 12:19:23 +03:00 committed by Dimo Karaivanov
parent dc0468ffeb
commit 17e9b779e6
6 changed files with 6 additions and 24 deletions

View file

@ -101,15 +101,6 @@ public class DictionaryDb {
}
public static boolean doesWordExistSync(Language language, String word) {
if (language == null || word == null || word.equals("")) {
return false;
}
return getInstance().wordsDao().doesWordExist(language.getId(), word) > 0;
}
public static void deleteWords(Runnable notification) {
deleteWords(notification, null);
}

View file

@ -10,6 +10,7 @@ import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Locale;
import io.github.sspanak.tt9.ConsumerCompat;
import io.github.sspanak.tt9.Logger;
@ -168,11 +169,11 @@ public class DictionaryLoader {
private void importLetters(Language language) {
ArrayList<Word> letters = new ArrayList<>();
boolean isEnglish = language.getLocale().equals(Locale.ENGLISH);
for (int key = 2; key <= 9; key++) {
for (String langChar : language.getKeyCharacters(key, false)) {
if (DictionaryDb.doesWordExistSync(language, langChar.toUpperCase(language.getLocale()))) {
continue;
}
langChar = (isEnglish && langChar.equals("i")) ? langChar.toUpperCase(Locale.ENGLISH) : langChar;
Word word = new Word();
word.langId = language.getId();