Added initial Italian support + more:
* Added "word at cursor" search when adding new word. * Attempted crashfix for weird suggestion building crash
This commit is contained in:
parent
81d3bd65bb
commit
1b15cd0928
15 changed files with 110695 additions and 17 deletions
110461
assets/it-utf8.txt
Normal file
110461
assets/it-utf8.txt
Normal file
File diff suppressed because it is too large
Load diff
BIN
res/drawable-hdpi/ime_it_lang_lower.png
Normal file
BIN
res/drawable-hdpi/ime_it_lang_lower.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 656 B |
BIN
res/drawable-hdpi/ime_it_lang_single.png
Normal file
BIN
res/drawable-hdpi/ime_it_lang_single.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 566 B |
BIN
res/drawable-hdpi/ime_it_lang_upper.png
Normal file
BIN
res/drawable-hdpi/ime_it_lang_upper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 514 B |
BIN
res/drawable/ime_it_lang_lower.png
Normal file
BIN
res/drawable/ime_it_lang_lower.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 656 B |
BIN
res/drawable/ime_it_lang_single.png
Normal file
BIN
res/drawable/ime_it_lang_single.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 566 B |
BIN
res/drawable/ime_it_lang_upper.png
Normal file
BIN
res/drawable/ime_it_lang_upper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 514 B |
|
|
@ -17,12 +17,6 @@
|
|||
<item>German</item>
|
||||
<item>French</item>
|
||||
</string-array>
|
||||
<integer-array translatable="false" name="pref_lang_values">
|
||||
<item>@integer/LANG_EN</item>
|
||||
<item>@integer/LANG_RU</item>
|
||||
<item>@integer/LANG_DE</item>
|
||||
<item>@integer/LANG_FR</item>
|
||||
</integer-array>
|
||||
|
||||
<string-array name="capsMode">
|
||||
<item>Maj déver</item>
|
||||
|
|
|
|||
96
res/values-it/array.xml
Normal file
96
res/values-it/array.xml
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="pref_inputmode_entries">
|
||||
<item>Dizionario</item>
|
||||
<item>Testo</item>
|
||||
<item>Numero</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_lang_titles">
|
||||
<item>Inglese</item>
|
||||
<item>Russo</item>
|
||||
<item>Tedesco</item>
|
||||
<item>Francese</item>
|
||||
<item>Italiano</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="capsMode">
|
||||
<item>Minuscolo</item>
|
||||
<item>Maiuscolo</item>
|
||||
<item>Blocca Maiuscolo</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="keyMode">
|
||||
<item>Dizionario</item>
|
||||
<item>Testo</item>
|
||||
<item>Numero</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="smileyContentDescription">
|
||||
<item> Sorriso </item>
|
||||
<item> Pagliaccio </item>
|
||||
<item> Gran sorriso </item>
|
||||
<item> Gatto </item>
|
||||
<item> Mezzo naso </item>
|
||||
<item> Sadico </item>
|
||||
<item> Occhi grandi e gran sorriso </item>
|
||||
<item> Occhi grandi e sorriso </item>
|
||||
<item> Sorriso sfacciato </item>
|
||||
<item> Risata </item>
|
||||
|
||||
<item> Occhi d\'insetto ridente </item>
|
||||
<item> Ridere ad occhi chiusi </item>
|
||||
<item> Occhio che ride </item>
|
||||
<item> Naso con occhiali ridente </item>
|
||||
<item> Cappello a punta e sorriso </item>
|
||||
<item> Accigliato </item>
|
||||
<item> Triste </item>
|
||||
<item> Avvilito </item>
|
||||
<item> Clown triste </item>
|
||||
<item> Sfacciatamente triste </item>
|
||||
|
||||
<item> Piangere </item>
|
||||
<item> Ridere fino alle lacrime </item>
|
||||
<item> Esclamazione </item>
|
||||
<item> Cipiglio scioccato </item>
|
||||
<item> Occhio d\'insetto accigliato </item>
|
||||
<item> Triste con gli occhi chiusi </item>
|
||||
<item> Piangere a bocca aperta </item>
|
||||
<item> Accigliato a bocca aperta </item>
|
||||
<item> Scioccato </item>
|
||||
<item> Sorpreso </item>
|
||||
|
||||
<item> Bacio </item>
|
||||
<item> Occhiolino </item>
|
||||
<item> Occhiolino ridendo </item>
|
||||
<item> Linguaccia sfacciata </item>
|
||||
<item> Linguaccia </item>
|
||||
<item> Emozionare </item>
|
||||
<item> Occhione linguaccia </item>
|
||||
<item> Infastidito </item>
|
||||
<item> Scettico </item>
|
||||
<item> Indeciso </item>
|
||||
|
||||
<item> Confuso </item>
|
||||
<item> Occhi chiusi </item>
|
||||
<item> Non impressionato </item>
|
||||
<item> Vergognoso </item>
|
||||
<item> Bocca chiusa </item>
|
||||
<item> Censurato </item>
|
||||
<item> Banchiere </item>
|
||||
<item> Bocca triste grande </item>
|
||||
<item> Monello </item>
|
||||
<item> Sgradevole </item>
|
||||
|
||||
<item> Gattino innocente </item>
|
||||
<item> Sorriso innocente </item>
|
||||
<item> Occhiolino malefico </item>
|
||||
<item> Sorriso malefico </item>
|
||||
<item> Occhi sfuggenti </item>
|
||||
<item> Cappello da festa e sorriso </item>
|
||||
<item> Fare il tifo </item>
|
||||
<item> Cuore </item>
|
||||
<item> Cuore spezzato </item>
|
||||
<item> Gatto con occhioni </item>
|
||||
</string-array>
|
||||
</resources>
|
||||
74
res/values-it/strings.xml
Normal file
74
res/values-it/strings.xml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Traditional T9</string>
|
||||
<string name="ime_name">Traditional T9</string>
|
||||
<string name="ime_number">Numeri</string>
|
||||
<string name="pref_inputmode">Modalità inserimento standard</string>
|
||||
<string name="pref_inputmode_desc">Modalità utilizzata per l\'inserimento di testo \'normale\' </string>
|
||||
<string name="traditionalt9_settings">Traditional T9 Impostazioni</string>
|
||||
<string name="main_left_insert">Ins. simbolo</string>
|
||||
<string name="main_left_addword">Agg. parola</string>
|
||||
<string name="main_mid">Fatto</string>
|
||||
<string name="main_mid_commit">Accettare</string>
|
||||
<string name="main_right_upper">Cambia modalità</string>
|
||||
<string name="main_right_lower">Opzioni</string>
|
||||
<string name="main_left_notfound">Agg. parola?</string>
|
||||
<string name="ricon_desc">Mantenere Icona</string>
|
||||
<string name="symbol_next">Pag. successiva</string>
|
||||
<string name="symbol_prev">Pag. preceente</string>
|
||||
<string name="symbol_insert">Ins. simbolo</string>
|
||||
<string name="smiley_insert">Ins. Smiley</string>
|
||||
<string name="symbol_page">Pag.: %1$s/%2$s</string>
|
||||
|
||||
<string name="add_word">Agg. parola</string>
|
||||
<string name="close">Chiudi</string>
|
||||
<string name="add_word_blank">Nessuna parola da aggiungere.</string>
|
||||
<string name="add_word_badchar">Impossibile aggiungere parola con caratteri inesistenti per %1$s (%2$s).</string>
|
||||
<string name="add_word_exist1">Parola (%1$s) già nel database.</string>
|
||||
<string name="add_word_exist2">Parola (%1$s) già nel database per %2$s.</string>
|
||||
<string name="title_activity_add_word">Aggiungi parola</string>
|
||||
<string name="action_settings">Impostazioni</string>
|
||||
<string name="database_notready">Database non disponibile.</string>
|
||||
<string name="database_settings_notready">Database non disponibile. Utilizzo impostazioni di base.</string>
|
||||
|
||||
<string name="updating_database_title">Aggiornamento database dizionario…</string>
|
||||
<string name="updating_database">Aggiornamento database dizionario, potrebbe volerci un po\'.</string>
|
||||
<string name="updating_database_done">Aggiornamento database dizionario completato.</string>
|
||||
<string name="updating_database_unavailable">Aggiornamento database dizionario, inserimento parole non disponibile al momento.</string>
|
||||
|
||||
<string name="pref_lang_title">Supporto multilingue…</string>
|
||||
<string name="pref_help">"Mostra aiuto</string>
|
||||
<string name="pref_loaddict">Carica dizionario</string>
|
||||
<string name="pref_loaduserdict">Carica dizionario utente</string>
|
||||
<string name="pref_nukedict">Elimina dizionario</string>
|
||||
<string name="pref_backupdict">Salvataggio dizionario</string>
|
||||
<string name="pref_restoredict">Ripristina dizionario</string>
|
||||
<string name="pref_querytest">Test ricerca</string>
|
||||
<string name="pref_testfunc">Test func</string>
|
||||
|
||||
<string name="pref_mode_notify">Modalità notifiche</string>
|
||||
<string name="pref_mode_notify_subtitle">Usato per la vocalizzazione del cambio modalità</string>
|
||||
|
||||
<string name="pref_loadingdict">Caricamento dizionario…</string>
|
||||
<string name="pref_loadinguserdict">Caricamento dizionario utente…</string>
|
||||
<string name="pref_load_title">Caricamento dizionario IME</string>
|
||||
<string name="pref_loadingbackup">Ripristino dizionario…</string>
|
||||
<string name="pref_savingbackup">Salvataggio dizionario…</string>
|
||||
<string name="pref_nukingdict">Eliminazione dizionario… Attendere prego…</string>
|
||||
<string name="pref_loaduser_notfound">Dizionario per %1$s non trovato. Impossibile caricare.</string>
|
||||
|
||||
<string name="pref_backup_warn">Attenzione: salvataggio già esistente. Sovrascrivere ?</string>
|
||||
<string name="pref_backup_title">Salvataggio database IME </string>
|
||||
<string name="pref_backup_noext">Errore: Nessuna unità esterna disponibile per il salvataggio. Il salvataggio verrà interrotto.</string>
|
||||
<string name="pref_restore_warn">I dati presenti nel salvataggio sostituiranno i dati esistenti. I dati non presenti nel salvataggio verranno mantenuti. In alternativa utilizzare \"%1$s\" prima di effettuare il ripristino.</string>
|
||||
<string name="pref_restore_title">Ripristino database IME </string>
|
||||
<string name="pref_restore_noext">Errore: Nessuna unità esterna disponibile per il ripristino. Il ripristino verrà interrotto.</string>
|
||||
<string name="pref_restore_nofile">Errore: File di salvataggio non trovato.</string>
|
||||
<string name="pref_nuke_warn">Attenzione: L\'intero dizionario sarà cancellato. Continuare ?</string>
|
||||
<string name="pref_nuke_title">Elimina dizionario IME </string>
|
||||
<string name="pref_reloadKeys">Ricaricamento KeyMap</string>
|
||||
|
||||
<string name="hello_world">Ciao mondo!</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
<item>Russian</item>
|
||||
<item>German</item>
|
||||
<item>French</item>
|
||||
<item>Italian</item>
|
||||
</string-array>
|
||||
<!--pref_lang_titles pair with pref_lang_values -->
|
||||
<integer-array translatable="false" name="pref_lang_values">
|
||||
|
|
@ -23,6 +24,7 @@
|
|||
<item>@integer/LANG_RU</item>
|
||||
<item>@integer/LANG_DE</item>
|
||||
<item>@integer/LANG_FR</item>
|
||||
<item>@integer/LANG_IT</item>
|
||||
</integer-array>
|
||||
|
||||
<string-array name="capsMode">
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<integer name="LANG_RU">2</integer>
|
||||
<integer name="LANG_DE">4</integer>
|
||||
<integer name="LANG_FR">8</integer>
|
||||
<integer name="LANG_IT">16</integer>
|
||||
|
||||
<integer name="INPUT_DICT">0</integer>
|
||||
<integer name="INPUT_TEXT">1</integer>
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ public class CharMap {
|
|||
// add extra characters for German and French maps.
|
||||
enMap.put('€', 1); enMap.put('ß', 7); // German chars
|
||||
enMap.put('î', 4); enMap.put('ù', 8); // French chars
|
||||
Map<Character, Integer> endefrmap = Collections.unmodifiableMap(enMap);
|
||||
CHARTABLE.add(0, endefrmap);
|
||||
enMap.put('ì', 4); enMap.put('ò', 8); // Italian chars
|
||||
Map<Character, Integer> endefritmap = Collections.unmodifiableMap(enMap);
|
||||
CHARTABLE.add(0, endefritmap);
|
||||
|
||||
// Russian
|
||||
Map<Character, Integer> ruMap = new HashMap<Character, Integer>();
|
||||
|
|
@ -73,8 +74,9 @@ public class CharMap {
|
|||
ruMap.put('0', 0);
|
||||
CHARTABLE.add(1, Collections.unmodifiableMap(ruMap));
|
||||
|
||||
CHARTABLE.add(2, Collections.unmodifiableMap(endefrmap));
|
||||
CHARTABLE.add(3, Collections.unmodifiableMap(endefrmap));
|
||||
CHARTABLE.add(2, Collections.unmodifiableMap(endefritmap));
|
||||
CHARTABLE.add(3, Collections.unmodifiableMap(endefritmap));
|
||||
CHARTABLE.add(4, Collections.unmodifiableMap(endefritmap));
|
||||
}
|
||||
|
||||
protected static final char[][] ENT9TABLE = { { '0', '+' },
|
||||
|
|
@ -116,13 +118,23 @@ public class CharMap {
|
|||
{ 't', 'u', 'v', 'T', 'U', 'V', 'ü', 'Ü', 'û', 'Û', '8' },
|
||||
{ 'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9' },
|
||||
{ '\n' } };
|
||||
protected static final char[][][] T9TABLE = { ENT9TABLE, RUT9TABLE, DET9TABLE, FRT9TABLE };
|
||||
|
||||
protected static final char[][] ITT9TABLE = {
|
||||
{ ' ', '+', '0' },
|
||||
{ '.', ',', '?', '!', ':', ';', '"', '/', '-', '@', '^', '€', '$', '%', '&', '*', '(', ')', '_', '1' },
|
||||
{ 'a', 'b', 'c', 'A', 'B', 'C', 'à', 'À', '2' }, { 'd', 'e', 'f', 'D', 'E', 'F', 'é', 'è', 'É', 'È', '3' },
|
||||
{ 'g', 'h', 'i', 'G', 'H', 'I', 'ì', 'Ì', '4' }, { 'j', 'k', 'l', 'J', 'K', 'L', '5' },
|
||||
{ 'm', 'n', 'o', 'M', 'N', 'O', 'ò', 'Ò', '6' }, { 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7' },
|
||||
{ 't', 'u', 'v', 'T', 'U', 'V', 'ù', 'Ù', '8' }, { 'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9' },
|
||||
{ '\n' } };
|
||||
protected static final char[][][] T9TABLE = { ENT9TABLE, RUT9TABLE, DET9TABLE, FRT9TABLE, ITT9TABLE };
|
||||
|
||||
protected static final int[] ENT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0 };
|
||||
protected static final int [] RUT9CAPSTART = {0, 0, 4, 5, 4, 4, 4, 4, 4, 4, 0};
|
||||
protected static final int[] DET9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0 };
|
||||
protected static final int[] FRT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0 };
|
||||
protected static final int[][] T9CAPSTART = {ENT9CAPSTART, RUT9CAPSTART, DET9CAPSTART, FRT9CAPSTART};
|
||||
protected static final int[] ITT9CAPSTART = { 0, 0, 3, 3, 3, 3, 3, 4, 3, 4, 0 };
|
||||
protected static final int[][] T9CAPSTART = {ENT9CAPSTART, RUT9CAPSTART, DET9CAPSTART, FRT9CAPSTART, ITT9CAPSTART};
|
||||
|
||||
protected static String getStringSequence(String word, LANGUAGE lang) {
|
||||
StringBuilder seq = new StringBuilder();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class LangHelper {
|
|||
// 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.
|
||||
// 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);
|
||||
NONE(-1, -1), EN(0,1), RU(1,2), DE(2,4), FR(3,8), IT(4,16);
|
||||
public final int index;
|
||||
public final int id;
|
||||
// lookup map
|
||||
|
|
@ -25,7 +25,7 @@ public class LangHelper {
|
|||
public static LANGUAGE get(int i) { return lookup.get(i);}
|
||||
}
|
||||
|
||||
protected static final Locale[] LOCALES = {Locale.ENGLISH, RUSSIAN, Locale.GERMAN, Locale.FRENCH};
|
||||
protected static final Locale[] LOCALES = {Locale.ENGLISH, RUSSIAN, Locale.GERMAN, Locale.FRENCH, Locale.ITALIAN};
|
||||
//protected static final String[] LANGS = {"EN", "RU", "DE"};
|
||||
|
||||
public static final int LANG_DEFAULT = LANGUAGE.EN.id;
|
||||
|
|
@ -67,7 +67,12 @@ public class LangHelper {
|
|||
{R.drawable.ime_en_text_lower, R.drawable.ime_en_text_single, R.drawable.ime_en_text_upper}, //TEXT
|
||||
{R.drawable.ime_number}, //NUM
|
||||
},
|
||||
|
||||
{
|
||||
// Italian resources
|
||||
{R.drawable.ime_it_lang_lower, R.drawable.ime_it_lang_single, R.drawable.ime_it_lang_upper}, //LANG
|
||||
{R.drawable.ime_en_text_lower, R.drawable.ime_en_text_single, R.drawable.ime_en_text_upper}, //TEXT
|
||||
{R.drawable.ime_number}, //NUM
|
||||
},
|
||||
};
|
||||
|
||||
public static LANGUAGE[] buildLangs(int i) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import java.util.AbstractList;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class TraditionalT9 extends InputMethodService implements
|
||||
KeyboardView.OnKeyboardActionListener {
|
||||
|
||||
|
|
@ -176,12 +178,42 @@ public class TraditionalT9 extends InputMethodService implements
|
|||
mComposingI.setLength(0);
|
||||
mWordFound = true;
|
||||
}
|
||||
|
||||
private String getSurroundingWord() {
|
||||
CharSequence before = currentInputConnection.getTextBeforeCursor(50, 0);
|
||||
CharSequence after = currentInputConnection.getTextAfterCursor(50, 0);
|
||||
int bounds = -1;
|
||||
if (!TextUtils.isEmpty(before)) {
|
||||
bounds = before.length() -1;
|
||||
while (bounds > 0 && !Character.isWhitespace(before.charAt(bounds))) {
|
||||
bounds--;
|
||||
}
|
||||
before = before.subSequence(bounds, before.length());
|
||||
}
|
||||
if (!TextUtils.isEmpty(after)) {
|
||||
bounds = 0;
|
||||
while (bounds < after.length() && !Character.isWhitespace(after.charAt(bounds))) {
|
||||
bounds++;
|
||||
}
|
||||
Log.d("getSurroundingWord", "after:"+after.toString());
|
||||
after = after.subSequence(0, bounds);
|
||||
}
|
||||
return before.toString().trim() + after.toString().trim();
|
||||
}
|
||||
|
||||
protected void showAddWord() {
|
||||
if (mKeyMode == MODE_LANG) {
|
||||
// decide if we are going to look for work to base on
|
||||
String template = mComposing.toString();
|
||||
if (template.length() == 0) {
|
||||
//get surrounding word:
|
||||
template = getSurroundingWord();
|
||||
}
|
||||
Log.d("showAddWord", "WORD: "+template);
|
||||
Intent awintent = new Intent(this, AddWordAct.class);
|
||||
awintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
awintent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
awintent.putExtra("org.nyanya.android.traditionalt9.word", mComposing.toString());
|
||||
awintent.putExtra("org.nyanya.android.traditionalt9.word", template);
|
||||
awintent.putExtra("org.nyanya.android.traditionalt9.lang", mLang.id);
|
||||
clearState();
|
||||
currentInputConnection.setComposingText("", 0);
|
||||
|
|
@ -883,6 +915,7 @@ public class TraditionalT9 extends InputMethodService implements
|
|||
prefix = mPreviousWord;
|
||||
} else {
|
||||
if (suggestions) {
|
||||
if (mCandidateView.mSelectedIndex == -1) { mCandidateView.mSelectedIndex = 0; }
|
||||
prefix = mPreviousWord = mSuggestionStrings.get(mCandidateView.mSelectedIndex);
|
||||
} else {
|
||||
prefix = mPreviousWord;
|
||||
|
|
@ -922,7 +955,7 @@ public class TraditionalT9 extends InputMethodService implements
|
|||
}
|
||||
}
|
||||
setSuggestions(mSuggestionStrings, 0);
|
||||
} else {
|
||||
} else {
|
||||
setSuggestions(null, -1);
|
||||
setCandidatesViewShown(false);
|
||||
if (interfacehandler != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue