1
0
Fork 0

Bulgarian language

* don't add Ukrainian chars to Russian language database
* use a common punctuation map instead of repeating it for all languages
* added bulgarian language

Co-authored-by: akasaka <akasaka@somewhereinthe.box>
This commit is contained in:
Dimo Karaivanov 2022-07-02 13:25:17 +03:00 committed by sspanak
parent 336b569faa
commit 4cef087207
23 changed files with 234439 additions and 62 deletions

234114
assets/bg-utf8.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
Bulgarian wordlist by: Miglen Georgiev
Version: f46eff1 (2022-04-26)
Words Count: 234114
Source: https://github.com/miglen/bulgarian-wordlists
License: https://github.com/miglen/bulgarian-wordlists/blob/master/LICENSE
All words validated against a real dictionary.

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF">
<group android:scaleX="0.16638644"
android:scaleY="0.16638644"
android:translateX="-0.22810315"
android:translateY="-1.3642105">
<group android:translateY="133.66406">
<path android:pathData="M8.234375,-47.015625Q8.234375,-59.828125,9.953125,-69.765625Q11.671875,-79.71875,15.328125,-86.890625Q18.984375,-94.078125,24.671875,-98.515625Q30.375,-102.96875,38.328125,-104.75Q47.109375,-106.671875,55.609375,-108.390625Q64.125,-110.125,71.296875,-111.546875L73.625,-100.234375Q70.109375,-99.671875,65.78125,-98.890625Q61.453125,-98.109375,57.0625,-97.265625Q52.671875,-96.421875,48.546875,-95.5625Q44.4375,-94.71875,41.34375,-94.015625Q36.984375,-93.03125,33.46875,-90.6875Q29.953125,-88.359375,27.421875,-84.359375Q24.890625,-80.359375,23.453125,-74.53125Q22.015625,-68.703125,21.734375,-60.71875L22.640625,-60.71875Q23.90625,-62.765625,26.078125,-64.890625Q28.265625,-67.03125,31.21875,-68.75Q34.171875,-70.484375,37.9375,-71.609375Q41.703125,-72.75,46.203125,-72.75Q53.15625,-72.75,58.421875,-70.15625Q63.703125,-67.578125,67.25,-62.9375Q70.8125,-58.296875,72.5625,-51.921875Q74.328125,-45.5625,74.328125,-37.921875Q74.328125,-28.21875,71.890625,-20.9375Q69.46875,-13.65625,65.109375,-8.765625Q60.75,-3.890625,54.625,-1.4375Q48.515625,1,41.203125,1Q33.6875,1,27.59375,-2.140625Q21.515625,-5.28125,17.1875,-11.390625Q12.875,-17.515625,10.546875,-26.46875Q8.234375,-35.4375,8.234375,-47.015625ZM42.046875,-9.65625Q46.265625,-9.65625,49.703125,-11.03125Q53.15625,-12.421875,55.609375,-15.53125Q58.078125,-18.65625,59.40625,-23.71875Q60.75,-28.78125,60.75,-36.21875Q60.75,-42.171875,59.828125,-46.90625Q58.921875,-51.65625,56.875,-55.015625Q54.84375,-58.390625,51.671875,-60.1875Q48.515625,-62,43.953125,-62Q39.65625,-62,35.921875,-60.296875Q32.203125,-58.59375,29.28125,-56.1875Q26.375,-53.78125,24.359375,-51.1875Q22.359375,-48.609375,21.453125,-46.765625Q21.453125,-39.6875,22.328125,-33.03125Q23.203125,-26.375,25.484375,-21.171875Q27.78125,-15.96875,31.78125,-12.8125Q35.796875,-9.65625,42.046875,-9.65625Z"
android:fillColor="#000000"/>
<path android:pathData="M136.70312,-67L107.03125,-67L107.03125,-0.5L94.234375,-0.5L94.234375,-77.890625L136.70312,-77.890625L136.70312,-67Z"
android:fillColor="#000000"/>
</group>
</group>
</vector>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF">
<group android:scaleX="0.17563012"
android:scaleY="0.17563012"
android:translateX="-1.6085906"
android:translateY="-2.72">
<group android:translateY="133.66406">
<path android:pathData="M75.59375,-30.15625Q75.59375,-23.3125,73.484375,-17.75Q71.375,-12.1875,66.9375,-8.234375Q62.515625,-4.296875,55.6875,-2.140625Q48.875,-0,39.453125,-0L14,-0L14,-103.59375L69.40625,-103.59375L69.40625,-92L27.078125,-92L27.078125,-59.59375L37.625,-59.59375Q48.3125,-59.59375,55.578125,-57.265625Q62.859375,-54.9375,67.28125,-50.953125Q71.71875,-46.984375,73.65625,-41.625Q75.59375,-36.28125,75.59375,-30.15625ZM27.078125,-11.3125L38.328125,-11.3125Q50.5625,-11.3125,56.328125,-15.953125Q62.09375,-20.59375,62.09375,-30.15625Q62.09375,-35.0625,60.46875,-38.46875Q58.859375,-41.890625,55.65625,-44Q52.453125,-46.109375,47.5625,-47.046875Q42.6875,-48,36.140625,-48L27.078125,-48L27.078125,-11.3125Z"
android:fillColor="#000000"/>
<path android:pathData="M137.70312,-67L108.03125,-67L108.03125,-0.5L95.234375,-0.5L95.234375,-77.890625L137.70312,-77.890625L137.70312,-67Z"
android:fillColor="#000000"/>
</group>
</group>
</vector>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF">
<group android:scaleX="0.1580671"
android:scaleY="0.1580671"
android:translateX="-1.2751678"
android:translateY="-1.248">
<group android:translateY="133.66406">
<path android:pathData="M75.59375,-30.15625Q75.59375,-23.3125,73.484375,-17.75Q71.375,-12.1875,66.9375,-8.234375Q62.515625,-4.296875,55.6875,-2.140625Q48.875,-0,39.453125,-0L14,-0L14,-103.59375L69.40625,-103.59375L69.40625,-92L27.078125,-92L27.078125,-59.59375L37.625,-59.59375Q48.3125,-59.59375,55.578125,-57.265625Q62.859375,-54.9375,67.28125,-50.953125Q71.71875,-46.984375,73.65625,-41.625Q75.59375,-36.28125,75.59375,-30.15625ZM27.078125,-11.3125L38.328125,-11.3125Q50.5625,-11.3125,56.328125,-15.953125Q62.09375,-20.59375,62.09375,-30.15625Q62.09375,-35.0625,60.46875,-38.46875Q58.859375,-41.890625,55.65625,-44Q52.453125,-46.109375,47.5625,-47.046875Q42.6875,-48,36.140625,-48L27.078125,-48L27.078125,-11.3125Z"
android:fillColor="#000000"/>
<path android:pathData="M150.35938,-103.734375L150.35938,-92L110.078125,-92L110.078125,-0.5L97,-0.5L97,-103.734375L150.35938,-103.734375Z"
android:fillColor="#000000"/>
</group>
</group>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

98
res/values-bg/arrays.xml Normal file
View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="pref_inputmode_entries">
<item>Предсказване</item>
<item>Текст</item>
<item>Числа</item>
</string-array>
<string-array name="pref_lang_titles">
<item>Английски</item>
<item>Руски</item>
<item>Немски</item>
<item>Френски</item>
<item>Италиански</item>
<item>Украински</item>
<item>Български</item>
</string-array>
<string-array name="capsMode">
<item>малки букви</item>
<item>Начална Главна</item>
<item>САМО ГЛАВНИ</item>
</string-array>
<string-array name="keyMode">
<item>Предсказване</item>
<item>Текст</item>
<item>Числа</item>
</string-array>
<string-array name="smileyContentDescription">
<item> Усмивка </item>
<item> Клоун </item>
<item> Хилене </item>
<item> Котка </item>
<item> Половин нос </item>
<item> Злорадство </item>
<item> Хилене с големи очи </item>
<item> Усмивка с големи очи </item>
<item> Широка усмивка</item>
<item> Смях </item>
<item> Смях с отворени очи </item>
<item> Смях със затворени очи </item>
<item> Смях с големи очи </item>
<item> Усмивка с очила и остър нос </item>
<item> Усмивка с остра шапка </item>
<item> Мръщене </item>
<item> Тъга </item>
<item> Отчаяние </item>
<item> Тъжен клоун </item>
<item> Тъжна усмивка </item>
<item> Плач </item>
<item> Смях до сълзи </item>
<item> Псувня </item>
<item> Шокирано мръщене </item>
<item> Мръщене с отворени очи </item>
<item> Тъга със затворени очи </item>
<item> Плач с отворена уста </item>
<item> Мръщене с отворена уста </item>
<item> Потрес </item>
<item> Изненада </item>
<item> Целувка </item>
<item> Усмивка с намигане </item>
<item> Смях с намигане </item>
<item> Език в бузата </item>
<item> Плезене </item>
<item> Дразнене </item>
<item> Плезене с отворени очи </item>
<item> Дразнене </item>
<item> Скептичност </item>
<item> Нерешителност </item>
<item> Объркване </item>
<item> Затворени очи </item>
<item> Невпечатляващо </item>
<item> Изчервяване </item>
<item> Затворени устни </item>
<item> Цензура </item>
<item> Банкер </item>
<item> Много голяма и тъжна уста </item>
<item> Сарказъм </item>
<item> Кисело лице </item>
<item> Невинна котка </item>
<item> Невинна усмивка </item>
<item> Зло намигване </item>
<item> Зло хилене </item>
<item> Блуждаещи очи </item>
<item> Усмивка с шапка за купон </item>
<item> Поздрав с вдигнати ръце </item>
<item> Сърце </item>
<item> Разбито сърце </item>
<item> Котка с отворени очи </item>
</string-array>
</resources>

81
res/values-bg/strings.xml Normal file
View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name">Traditional T9</string>
<string name="ime_name">Клавиатура T9</string>
<string name="ime_number">Цифри</string>
<string name="pref_inputmode">Режим на писане</string>
<string name="pref_inputmode_desc">Дали да е включено или не подсказването на думи, когато започнете да пишете</string>
<string name="traditionalt9_settings">Настройки на Traditional T9</string>
<string name="main_left_insert">Въведи символ</string>
<string name="main_left_addword">Добави дума</string>
<string name="main_mid">Готово</string>
<string name="main_mid_commit">Въведи</string>
<string name="main_right_upper">Следващ режим</string>
<string name="main_right_lower">Избор</string>
<string name="main_left_notfound">Добавяне на дума?</string>
<string name="ricon_desc">Hold Icon</string>
<string name="symbol_next">Следващи</string>
<string name="symbol_prev">Предишни</string>
<string name="symbol_insert">Въведи символ</string>
<string name="smiley_insert">Въведи усмивка</string>
<string name="symbol_page">Страница: %1$s/%2$s</string>
<string name="add_word">Добави дума</string>
<string name="close">Затвори</string>
<string name="add_word_blank">Не може да се въведе никаква дума.</string>
<string name="add_word_badchar">Не може да се въведе дума с непозволени символи за %1$s (%2$s).</string>
<string name="add_word_exist1">(%1$s) е вече речника.</string>
<string name="add_word_exist2">(%1$s) е вече в речника за %2$s.</string>
<string name="title_activity_add_word">Добавяне на дума</string>
<string name="action_settings">Настройки</string>
<string name="database_notready">Базата данни е недостъпна.</string>
<string name="database_settings_notready">Базата данни е недостъпна. Зареждане на стандартни настройки.</string>
<string name="updating_database_title">Обновяване на речника…</string>
<string name="updating_database">Речникът се обновява, моля изчакайте…</string>
<string name="updating_database_done">Речникът е обновен.</string>
<string name="updating_database_unavailable">Не може да се въвеждат нови думи, докато се обновява речникът.</string>
<string name="pref_lang_title">Избор на езици</string>
<string name="pref_help">Помощ</string>
<string name="pref_loaddict">Зареди заводски речник</string>
<string name="pref_loaduserdict">Зареди собствен речник</string>
<string name="pref_nukedict">Изтрий собствен речник</string>
<string name="pref_backupdict">Резервно копие на речник</string>
<string name="pref_restoredict">Възстанови копие</string>
<string name="pref_querytest">Query test</string>
<string name="pref_testfunc">Test func</string>
<string name="pref_mode_notify">Показвай режима</string>
<string name="pref_mode_notify_subtitle">Ще се показва икона с текущият режим на писане</string>
<string name="pref_loadingdict">Зареждане на речник…</string>
<string name="pref_loadinguserdict">Зареждане на вашия речник…</string>
<string name="pref_load_title">Зареди речник</string>
<string name="pref_loadingbackup">Възстановяване на речник…</string>
<string name="pref_savingbackup">Създаване на резервно копие…</string>
<string name="pref_nukingdict">Изтриване на речник…</string>
<string name="pref_loaduser_notfound">Няма речник за %1$s. Не може да се зареди такъв.</string>
<string name="pref_backup_warn">Внимание! Вече съществува резервно копие на речника. Моля потвърдете презаписването му</string>
<string name="pref_backup_title">Създаване на резервно копие</string>
<string name="pref_backup_noext">Грешка! Няма външна памет, за да се запише резервното копие.</string>
<string name="pref_restore_warn">Ако имате думи в речника на телефона, те ще бъдат заменени със същите от резервното копие. Ако не желаете това, моля изберете \"%1$s\" преди възстановяването..</string>
<string name="pref_restore_title">Възстановяване на резервно копие</string>
<string name="pref_restore_noext">Грешка! Няма външна памет, от която да се възстанови резервното копие на речника.</string>
<string name="pref_restore_nofile">Грешка! Не е открито резервно копие.</string>
<string name="pref_nuke_warn">Внимание! Всички думи от Вашия речник ще бъдат изтрити. Потвърждавате ли?</string>
<string name="pref_nuke_title">Изтрий собствения речник</string>
<string name="pref_reloadKeys">Зареди keymap.txt</string>
<string name="pref_reloadKeysSum">Зарежда повторно файла с разменени клавиши</string>
<string name="pref_reloadKeysDone">Упешно зареждане.</string>
<string name="pref_reloadKeysDoneWE">Имаше грешки при зареждане (виж logcat.)</string>
<string name="pref_reloadKeysNoFile">Няма файл keymap.txt.</string>
<string name="pref_keyRemap">Смени клавиши</string>
<string name="pref_keyRemapSum">Ако е избрано, сменените клавиши ще важат не само при писане, но и във всички приложения.</string>
<string name="pref_spaceOnZero">Интервал с 0</string>
<string name="pref_spaceOnZeroSum" tools:ignore="MissingTranslation">Ако е избрано, ще пишете интервал с 0, вместо с #.</string>
<string name="hello_world">Работи!</string>
</resources>

View file

@ -18,6 +18,7 @@
<item>French</item> <item>French</item>
<item>Italian</item> <item>Italian</item>
<item>Ukrainian</item> <item>Ukrainian</item>
<item>Bulgarian</item>
</string-array> </string-array>
<!--pref_lang_titles pair with pref_lang_values --> <!--pref_lang_titles pair with pref_lang_values -->
<integer-array translatable="false" name="pref_lang_values"> <integer-array translatable="false" name="pref_lang_values">
@ -27,6 +28,7 @@
<item>@integer/LANG_FR</item> <item>@integer/LANG_FR</item>
<item>@integer/LANG_IT</item> <item>@integer/LANG_IT</item>
<item>@integer/LANG_UK</item> <item>@integer/LANG_UK</item>
<item>@integer/LANG_BG</item>
</integer-array> </integer-array>
<string-array name="capsMode"> <string-array name="capsMode">

View file

@ -7,6 +7,7 @@
<integer name="LANG_FR">8</integer> <integer name="LANG_FR">8</integer>
<integer name="LANG_IT">16</integer> <integer name="LANG_IT">16</integer>
<integer name="LANG_UK">32</integer> <integer name="LANG_UK">32</integer>
<integer name="LANG_BG">64</integer>
<integer name="INPUT_DICT">0</integer> <integer name="INPUT_DICT">0</integer>
<integer name="INPUT_TEXT">1</integer> <integer name="INPUT_TEXT">1</integer>

View file

@ -13,77 +13,76 @@ import java.util.Map;
public class CharMap { public class CharMap {
protected static final AbstractList<Map<Character, Integer>> CHARTABLE = new ArrayList<Map<Character, Integer>>(LangHelper.NLANGS); protected static final AbstractList<Map<Character, Integer>> CHARTABLE = new ArrayList<Map<Character, Integer>>(LangHelper.NLANGS);
static { static {
// Punctuation
Map<Character, Integer> commonMap = new HashMap<Character, Integer>();
commonMap.put('.', 1); commonMap.put(',', 1); commonMap.put('!', 1); commonMap.put('?', 1);
commonMap.put('-', 1); commonMap.put('"', 1); commonMap.put('\'', 1); commonMap.put('@', 1);
commonMap.put('#', 1); commonMap.put('$', 1); commonMap.put('%', 1); commonMap.put('&', 1);
commonMap.put('*', 1); commonMap.put('(', 1); commonMap.put(')', 1); commonMap.put(':', 1);
commonMap.put(';', 1); commonMap.put('/', 1); commonMap.put('+', 1); commonMap.put('=', 1);
commonMap.put('<', 1); commonMap.put('>', 1); commonMap.put('^', 1); commonMap.put('_', 1);
commonMap.put('~', 1);
commonMap.put('1', 1); commonMap.put('2', 2); commonMap.put('3', 3);
commonMap.put('4', 4); commonMap.put('5', 5); commonMap.put('6', 6);
commonMap.put('7', 7); commonMap.put('8', 8); commonMap.put('9', 9);
commonMap.put('+', 0); commonMap.put('0', 0); // not sure why "+" is both on 1 on 0, but kept it anyway
/*** Latin Scripts ***/
// English // English
Map<Character, Integer> enMap = new HashMap<Character, Integer>(); // the English dictionary contains foreign words with their original spelling,
enMap.put('.', 1); enMap.put(',', 1); enMap.put('!', 1); enMap.put('?', 1); // so non-English characters must be inside the map
enMap.put('-', 1); enMap.put('"', 1); enMap.put('\'', 1); enMap.put('@', 1); Map<Character, Integer> enMap = new HashMap<Character, Integer>(commonMap);
enMap.put('#', 1); enMap.put('$', 1); enMap.put('%', 1); enMap.put('&', 1);
enMap.put('*', 1); enMap.put('(', 1); enMap.put(')', 1); enMap.put(':', 1);
enMap.put(';', 1); enMap.put('/', 1); enMap.put('+', 1); enMap.put('=', 1);
enMap.put('<', 1); enMap.put('>', 1); enMap.put('^', 1); enMap.put('_', 1);
enMap.put('~', 1); enMap.put('1', 1);
enMap.put('a', 2); enMap.put('á', 2); enMap.put('ä', 2); enMap.put('â', 2); enMap.put('a', 2); enMap.put('á', 2); enMap.put('ä', 2); enMap.put('â', 2);
enMap.put('à', 2); enMap.put('å', 2); enMap.put('b', 2); enMap.put('c', 2); enMap.put('à', 2); enMap.put('å', 2); enMap.put('b', 2); enMap.put('c', 2);
enMap.put('ç', 2); enMap.put('2', 2); enMap.put('ç', 2);
enMap.put('d', 3); enMap.put('e', 3); enMap.put('é', 3); enMap.put('ë', 3); enMap.put('d', 3); enMap.put('e', 3); enMap.put('é', 3); enMap.put('ë', 3);
enMap.put('è', 3); enMap.put('ê', 3); enMap.put('f', 3); enMap.put('3', 3); enMap.put('è', 3); enMap.put('ê', 3); enMap.put('f', 3);
enMap.put('g', 4); enMap.put('h', 4); enMap.put('i', 4); enMap.put('í', 4); enMap.put('g', 4); enMap.put('h', 4); enMap.put('i', 4); enMap.put('í', 4);
enMap.put('ï', 4); enMap.put('4', 4); enMap.put('ï', 4);
enMap.put('j', 5); enMap.put('k', 5); enMap.put('l', 5); enMap.put('5', 5); enMap.put('j', 5); enMap.put('k', 5); enMap.put('l', 5); enMap.put('5', 5);
enMap.put('m', 6); enMap.put('n', 6); enMap.put('ñ', 6); enMap.put('o', 6); enMap.put('m', 6); enMap.put('n', 6); enMap.put('ñ', 6); enMap.put('o', 6);
enMap.put('ó', 6); enMap.put('ö', 6); enMap.put('ô', 6); enMap.put('6', 6); enMap.put('ó', 6); enMap.put('ö', 6); enMap.put('ô', 6);
enMap.put('p', 7); enMap.put('q', 7); enMap.put('r', 7); enMap.put('s', 7); enMap.put('p', 7); enMap.put('q', 7); enMap.put('r', 7); enMap.put('s', 7);
enMap.put('7', 7);
enMap.put('t', 8); enMap.put('u', 8); enMap.put('û', 6); enMap.put('ü', 8); enMap.put('t', 8); enMap.put('u', 8); enMap.put('û', 6); enMap.put('ü', 8);
enMap.put('v', 8); enMap.put('8', 8); enMap.put('w', 9); enMap.put('v', 8);
enMap.put('x', 9); enMap.put('y', 9); enMap.put('z', 9); enMap.put('w', 9); enMap.put('x', 9); enMap.put('y', 9); enMap.put('z', 9);
enMap.put('9', 9); enMap.put('+', 0); enMap.put('0', 0);
// add extra characters for German and French maps. // add extra characters for German and French maps.
enMap.put('€', 1); enMap.put('ß', 7); // German chars enMap.put('€', 1); enMap.put('ß', 7); // German chars
enMap.put('æ', 1); enMap.put('î', 4); enMap.put('ù', 8); enMap.put('œ', 6); // French chars enMap.put('æ', 1); enMap.put('î', 4); enMap.put('ù', 8); enMap.put('œ', 6); // French chars
enMap.put('ì', 4); enMap.put('ò', 8); // Italian chars enMap.put('ì', 4); enMap.put('ò', 8); // Italian chars
Map<Character, Integer> endefritmap = Collections.unmodifiableMap(enMap);
CHARTABLE.add(0, endefritmap); /*** Cyrillic Scripts ***/
Map<Character, Integer> cyrillicMap = new HashMap<Character, Integer>(commonMap);
cyrillicMap.put('а', 2); cyrillicMap.put('б', 2); cyrillicMap.put('в', 2); cyrillicMap.put('г', 2);
cyrillicMap.put('д', 3); cyrillicMap.put('е', 3); cyrillicMap.put('ж', 3); cyrillicMap.put('з', 3);
cyrillicMap.put('и', 4); cyrillicMap.put('й', 4); cyrillicMap.put('к', 4); cyrillicMap.put('л', 4);
cyrillicMap.put('м', 5); cyrillicMap.put('н', 5); cyrillicMap.put('о', 5); cyrillicMap.put('п', 5);
cyrillicMap.put('р', 6); cyrillicMap.put('с', 6); cyrillicMap.put('т', 6); cyrillicMap.put('у', 6);
cyrillicMap.put('ф', 7); cyrillicMap.put('х', 7); cyrillicMap.put('ц', 7); cyrillicMap.put('ч', 7);
cyrillicMap.put('ш', 8); cyrillicMap.put('щ', 8);
cyrillicMap.put('ь', 9); cyrillicMap.put('ю', 9); cyrillicMap.put('я', 9);
// Bulgarian
Map<Character, Integer> bgMap = new HashMap<Character, Integer>(cyrillicMap);
bgMap.put('ъ', 8);
// Russian // Russian
Map<Character, Integer> ruMap = new HashMap<Character, Integer>(); Map<Character, Integer> ruMap = new HashMap<Character, Integer>(bgMap);
ruMap.put('.', 1); ruMap.put(',', 1); ruMap.put('!', 1); ruMap.put('?', 1); ruMap.put('ё', 3); ruMap.put('ы', 8); ruMap.put('э', 9);
ruMap.put('-', 1); ruMap.put('"', 1); ruMap.put('\'', 1); ruMap.put('@', 1);
ruMap.put('#', 1); ruMap.put('$', 1); ruMap.put('%', 1); ruMap.put('&', 1);
ruMap.put('*', 1); ruMap.put('(', 1); ruMap.put(')', 1); ruMap.put(':', 1);
ruMap.put(';', 1); ruMap.put('/', 1); ruMap.put('+', 1); ruMap.put('=', 1);
ruMap.put('<', 1); ruMap.put('>', 1); ruMap.put('^', 1); ruMap.put('_', 1);
ruMap.put('~', 1); ruMap.put('1', 1);
ruMap.put('а', 2); ruMap.put('б', 2); ruMap.put('в', 2); ruMap.put('г', 2);
ruMap.put('2', 2);
ruMap.put('д', 3); ruMap.put('е', 3); ruMap.put('ё', 3); ruMap.put('ж', 3);
ruMap.put('з', 3); ruMap.put('3', 3);
ruMap.put('и', 4); ruMap.put('й', 4); ruMap.put('к', 4); ruMap.put('л', 4);
ruMap.put('4', 4);
ruMap.put('м', 5); ruMap.put('н', 5); ruMap.put('о', 5); ruMap.put('п', 5);
ruMap.put('5', 5);
ruMap.put('р', 6); ruMap.put('с', 6); ruMap.put('т', 6); ruMap.put('у', 6);
ruMap.put('6', 6);
ruMap.put('ф', 7); ruMap.put('х', 7); ruMap.put('ц', 7); ruMap.put('ч', 7);
ruMap.put('7', 7);
ruMap.put('ш', 8); ruMap.put('щ', 8); ruMap.put('ъ', 8); ruMap.put('ы', 8);
ruMap.put('8', 8);
ruMap.put('ь', 9); ruMap.put('э', 9); ruMap.put('ю', 9); ruMap.put('я', 9);
ruMap.put('9', 9);
ruMap.put('+', 0);
ruMap.put('0', 0);
// add extra characters for other Cyrillic maps. // Ukrainian
ruMap.put('ґ', 2); ruMap.put('є', 3); ruMap.put('і', 4); ruMap.put('ї', 4);// Ukrainian chars Map<Character, Integer> ukMap = new HashMap<Character, Integer>(cyrillicMap);
// Stub for Bulgarian chars ukMap.put('ґ', 2); ukMap.put('є', 3); ukMap.put('і', 4); ukMap.put('ї', 4);// Ukrainian chars
// Stub for Bielorussian chars
// etc CHARTABLE.add(0, Collections.unmodifiableMap(enMap));
CHARTABLE.add(1, Collections.unmodifiableMap(ruMap)); CHARTABLE.add(1, Collections.unmodifiableMap(ruMap));
CHARTABLE.add(2, Collections.unmodifiableMap(enMap));
CHARTABLE.add(2, Collections.unmodifiableMap(endefritmap)); CHARTABLE.add(3, Collections.unmodifiableMap(enMap));
CHARTABLE.add(3, Collections.unmodifiableMap(endefritmap)); CHARTABLE.add(4, Collections.unmodifiableMap(enMap));
CHARTABLE.add(4, Collections.unmodifiableMap(endefritmap)); CHARTABLE.add(5, Collections.unmodifiableMap(ukMap));
CHARTABLE.add(5, Collections.unmodifiableMap(ruMap)); CHARTABLE.add(6, Collections.unmodifiableMap(bgMap));
} }
protected static final char[][] ENT9TABLE = { { '0', '+' }, protected static final char[][] ENT9TABLE = { { '0', '+' },
@ -144,7 +143,15 @@ public class CharMap {
{ 'ш', 'щ', 'Ш', 'Щ', '8' }, { 'ь', 'ю', 'я', 'Ь', 'Ю', 'Я', '9' }, { 'ш', 'щ', 'Ш', 'Щ', '8' }, { 'ь', 'ю', 'я', 'Ь', 'Ю', 'Я', '9' },
{ ' ', '\n' }, { ' ', '0', '+' }, { '\n' } }; // LAST TWO SPACE ON 0 { ' ', '\n' }, { ' ', '0', '+' }, { '\n' } }; // LAST TWO SPACE ON 0
protected static final char[][][] T9TABLE = { ENT9TABLE, RUT9TABLE, DET9TABLE, FRT9TABLE, ITT9TABLE, UKT9TABLE }; protected static final char[][] BGT9TABLE = { { '0', '+' },
{ '.', ',', '?', '!', '\'', '"', '/', '-', '@', '$', '%', '&', '*', '#', '(', ')', '_', '1' },
{ 'а', 'б', 'в', 'г', 'А', 'Б', 'В', 'Г', '2' }, { 'д', 'е', 'ж', 'з', 'Д', 'Е', 'Ж', 'З', '3' },
{ 'и', 'й', 'к', 'л', 'И', 'Й', 'К', 'Л', '4' }, { 'м', 'н', 'о', 'п', 'М', 'Н', 'О', 'П', '5' },
{ 'р', 'с', 'т', 'у', 'Р', 'С', 'Т', 'У', '6' }, { 'ф', 'х', 'ц', 'ч', 'Ф', 'Х', 'Ц', 'Ч', '7' },
{ 'ш', 'щ', 'ъ', 'Ш', 'Щ', 'Ъ', '8' }, { 'ь', 'ю', 'я', 'Ь', 'Ю', 'Я', '9' },
{ ' ', '\n' }, { ' ', '0', '+' }, { '\n' } }; // LAST TWO SPACE ON 0
protected static final char[][][] T9TABLE = { ENT9TABLE, RUT9TABLE, DET9TABLE, FRT9TABLE, ITT9TABLE, UKT9TABLE, BGT9TABLE };
// last 2 don't matter, are for spaceOnZero extra 'slots' 0 position, and 10 position // last 2 don't matter, are for spaceOnZero extra 'slots' 0 position, and 10 position
protected static final int[] ENT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0, 0, 0 }; protected static final int[] ENT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0, 0, 0 };
@ -153,7 +160,8 @@ public class CharMap {
protected static final int[] FRT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0, 0, 0 }; protected static final int[] FRT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0, 0, 0 };
protected static final int[] ITT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0, 0, 0 }; protected static final int[] ITT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0, 0, 0 };
protected static final int[] UKT9CAPSTART = { 0, 0, 5, 5, 6, 4, 4, 4, 2, 3, 0, 0, 0 }; protected static final int[] UKT9CAPSTART = { 0, 0, 5, 5, 6, 4, 4, 4, 2, 3, 0, 0, 0 };
protected static final int[][] T9CAPSTART = {ENT9CAPSTART, RUT9CAPSTART, DET9CAPSTART, FRT9CAPSTART, ITT9CAPSTART, UKT9CAPSTART}; protected static final int[] BGT9CAPSTART = { 0, 0, 4, 4, 4, 4, 4, 4, 3, 3, 0, 0, 0 };
protected static final int[][] T9CAPSTART = {ENT9CAPSTART, RUT9CAPSTART, DET9CAPSTART, FRT9CAPSTART, ITT9CAPSTART, UKT9CAPSTART, BGT9CAPSTART};
protected static String getStringSequence(String word, LANGUAGE lang) { protected static String getStringSequence(String word, LANGUAGE lang) {
StringBuilder seq = new StringBuilder(); StringBuilder seq = new StringBuilder();

View file

@ -5,15 +5,18 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
public class LangHelper { public class LangHelper {
protected static final Locale BULGARIAN = new Locale("bg", "BG");
protected static final Locale RUSSIAN = new Locale("ru","RU"); protected static final Locale RUSSIAN = new Locale("ru","RU");
protected static final Locale UKRAINIAN = new Locale("uk","UA"); protected static final Locale UKRAINIAN = new Locale("uk","UA");
public enum LANGUAGE { public enum LANGUAGE {
// MAKE SURE THESE MATCH WITH values/const.xml // MAKE SURE THESE MATCH WITH values/const.xml
// (index, id) Where index is index in arrays like LOCALES and MUST increment and MUST be in // (index, id) Where index is index in arrays like LOCALES and MUST increment and MUST be in
// the same order as arrays.xml/pref_lang_values, and id is the identifier used in // the same order as arrays.xml/pref_lang_values, and id is the identifier used in
// the database and such. id should never change unless database update is done. // the database and such. id should never change unless database update is done.
// id MUST increment in doubles (as the enabled languages are stored as an integer) // id MUST increment in doubles (as the enabled languages are stored as an integer)
NONE(-1, -1), EN(0,1), RU(1,2), DE(2,4), FR(3,8), IT(4,16), UK(5,32); NONE(-1, -1), EN(0,1), RU(1,2), DE(2,4), FR(3,8), IT(4,16), UK(5,32), BG(6, 64);
public final int index; public final int index;
public final int id; public final int id;
// lookup map // lookup map
@ -26,7 +29,7 @@ public class LangHelper {
public static LANGUAGE get(int i) { return lookup.get(i);} public static LANGUAGE get(int i) { return lookup.get(i);}
} }
protected static final Locale[] LOCALES = {Locale.ENGLISH, RUSSIAN, Locale.GERMAN, Locale.FRENCH, Locale.ITALIAN, UKRAINIAN}; protected static final Locale[] LOCALES = {Locale.ENGLISH, RUSSIAN, Locale.GERMAN, Locale.FRENCH, Locale.ITALIAN, UKRAINIAN, BULGARIAN};
public static final int LANG_DEFAULT = LANGUAGE.EN.id; public static final int LANG_DEFAULT = LANGUAGE.EN.id;
@ -79,6 +82,12 @@ public class LangHelper {
{R.drawable.ime_ru_text_lower, R.drawable.ime_ru_text_single, R.drawable.ime_ru_text_upper}, //TEXT {R.drawable.ime_ru_text_lower, R.drawable.ime_ru_text_single, R.drawable.ime_ru_text_upper}, //TEXT
{R.drawable.ime_number}, //NUM {R.drawable.ime_number}, //NUM
}, },
{
// Bulgarian resources
{R.drawable.ime_bg_lang_lower, R.drawable.ime_bg_lang_single, R.drawable.ime_bg_lang_upper}, //LANG
{R.drawable.ime_ru_text_lower, R.drawable.ime_ru_text_single, R.drawable.ime_ru_text_upper}, //TEXT
{R.drawable.ime_number}, //NUM
},
}; };
public static LANGUAGE[] buildLangs(int i) { public static LANGUAGE[] buildLangs(int i) {