Blacklist asian languages from input selection list, since this is LatinIME.

Bug: 2488167
Don't show ko, ja and zh languages in the list.

Remove a debug println.
Add alternates_for_g to the keyboard for it to work on turkish. This
  must have not gotten merged from donut.
diff --git a/Android.mk b/Android.mk
index e453579..5396ed5 100755
--- a/Android.mk
+++ b/Android.mk
@@ -15,7 +15,7 @@
 
 #LOCAL_AAPT_FLAGS := -0 .dict
 
-#LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := current
 
 LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags
 
diff --git a/res/values/donottranslate.xml b/res/values/donottranslate.xml
index 87c28ae..d501735 100644
--- a/res/values/donottranslate.xml
+++ b/res/values/donottranslate.xml
@@ -34,4 +34,6 @@
     <string name="alternates_for_z"></string>
     <!-- Accented characters related to "l" -->
     <string name="alternates_for_l"></string>
+    <!-- Accented characters related to "g" -->
+    <string name="alternates_for_g"></string>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9025ca0..35dd3e0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -319,4 +319,7 @@
     
     <!-- Add to dictionary hint -->
     <string name="hint_add_to_dictionary">\u2190 Tap again to save</string>
+    
+    <!-- Inform the user that a particular language has an available dictionary -->
+    <string name="has_dictionary">Dictionary available</string>
 </resources>
diff --git a/res/xml/kbd_qwerty.xml b/res/xml/kbd_qwerty.xml
index 4aa4761..1a9ea5c 100755
--- a/res/xml/kbd_qwerty.xml
+++ b/res/xml/kbd_qwerty.xml
@@ -70,7 +70,10 @@
                 android:popupKeyboard="@xml/kbd_popup_template"
                 android:popupCharacters="@string/alternates_for_d"/>
         <Key android:codes="102" android:keyLabel="f"/>
-        <Key android:codes="103" android:keyLabel="g"/>
+        <Key android:codes="103" android:keyLabel="g"
+                android:popupKeyboard="@xml/kbd_popup_template"
+                android:popupCharacters="@string/alternates_for_g"
+        />
         <Key android:codes="104" android:keyLabel="h"/>
         <Key android:codes="106" android:keyLabel="j"/>
         <Key android:codes="107" android:keyLabel="k"/>
diff --git a/src/com/android/inputmethod/latin/BinaryDictionary.java b/src/com/android/inputmethod/latin/BinaryDictionary.java
index ec467c8..43f4c4c 100644
--- a/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -138,7 +138,6 @@
     @Override
     public synchronized void close() {
         if (mNativeDict != 0) {
-            System.err.println("Closing BinaryDictionary");
             closeNative(mNativeDict);
             mNativeDict = 0;
         }
diff --git a/src/com/android/inputmethod/latin/InputLanguageSelection.java b/src/com/android/inputmethod/latin/InputLanguageSelection.java
index 73298e3..b1ddb21 100644
--- a/src/com/android/inputmethod/latin/InputLanguageSelection.java
+++ b/src/com/android/inputmethod/latin/InputLanguageSelection.java
@@ -34,6 +34,9 @@
 
     private String mSelectedLanguages;
     private ArrayList<Loc> mAvailableLanguages = new ArrayList<Loc>();
+    private static final String[] BLACKLIST_LANGUAGES = {
+        "ko", "ja", "zh"
+    };
 
     private static class Loc implements Comparable {
         static Collator sCollator = Collator.getInstance();
@@ -137,6 +140,9 @@
                 String country = s.substring(3, 5);
                 Locale l = new Locale(language, country);
 
+                // Exclude languages that are not relevant to LatinIME
+                if (arrayContains(BLACKLIST_LANGUAGES, language)) continue;
+
                 if (finalSize == 0) {
                     preprocess[finalSize++] =
                             new Loc(LanguageSwitcher.toTitleCase(l.getDisplayName(l)), l);
@@ -167,4 +173,11 @@
         }
         return uniqueLocales;
     }
+
+    private boolean arrayContains(String[] array, String value) {
+        for (int i = 0; i < array.length; i++) {
+            if (array[i].equalsIgnoreCase(value)) return true;
+        }
+        return false;
+    }
 }