AI 150810: Fix for 2023252 & 2023256: Turkish accented characters for the keyboard
  BUG=2023252,2023256

Automated import of CL 150810
diff --git a/res/values-tr/donottranslate.xml b/res/values-tr/donottranslate.xml
new file mode 100644
index 0000000..f206e4c
--- /dev/null
+++ b/res/values-tr/donottranslate.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Accented characters related to "g" -->
+    <string name="alternates_for_g">ğ</string>
+</resources>
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index d510f15..664c2cd 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -56,13 +56,14 @@
     <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Kaydedildi"</string>
     <string name="alternates_for_a" msgid="2566516493365324765">"àáâãäåæ"</string>
     <string name="alternates_for_e" msgid="3900510936875547555">"èéêë"</string>
-    <string name="alternates_for_i" msgid="7097915268629342242">"ıìíîï"</string>
+    <string name="alternates_for_i" msgid="7097915268629342242">"iìíîï"</string>
     <string name="alternates_for_o" msgid="6151402748321267776">"öòóôõœø"</string>
     <string name="alternates_for_u" msgid="5899096818189442934">"üùúû"</string>
     <string name="alternates_for_s" msgid="348762530927662188">"ş§ß"</string>
     <string name="alternates_for_n" msgid="6257322556221886400">"ñ"</string>
     <string name="alternates_for_c" msgid="151699780720639892">"ç"</string>
     <string name="alternates_for_y" msgid="1722776806607271199">"ýÿ"</string>
+    <string name="key_i">"ı"</string>
     <string name="tip_long_press" msgid="6101270866284343344">"Vurguları görmek için bir tuşu basılı tutun (ø, ö, v.b.)"</string>
     <string name="tip_dismiss" msgid="7585579046862204381">"Klavyeyi herhangi bir anda kapatmak için geri tuşuna ↶ basın"</string>
     <string name="tip_access_symbols" msgid="6344098517525531652">"Sayılara ve simgelere erişin"</string>
diff --git a/res/values/donottranslate.xml b/res/values/donottranslate.xml
index d9649f3..c694194 100644
--- a/res/values/donottranslate.xml
+++ b/res/values/donottranslate.xml
@@ -32,4 +32,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 c01630a..ec9a8b7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -125,7 +125,10 @@
     <string name="alternates_for_c">ç</string>
     <!-- Accented forms of "y" -->
     <string name="alternates_for_y">ýÿ</string>
-    
+
+    <!-- Label to display on the "i" key -->
+    <string name="key_i">i</string>
+ 
     <!-- Tip to long press on keys -->
     <string name="tip_long_press">Hold a key down to see accents (ø, ö, etc.)</string>
     <!-- Tip to dismiss keyboard -->
diff --git a/res/xml/kbd_qwerty.xml b/res/xml/kbd_qwerty.xml
index 2fa6c90..0493b99 100755
--- a/res/xml/kbd_qwerty.xml
+++ b/res/xml/kbd_qwerty.xml
@@ -46,7 +46,7 @@
                 android:popupKeyboard="@xml/kbd_popup_template"
                 android:popupCharacters="@string/alternates_for_u"
         />
-        <Key android:codes="105" android:keyLabel="i"
+        <Key android:keyLabel="@string/key_i"
                 android:popupKeyboard="@xml/kbd_popup_template"
                 android:popupCharacters="@string/alternates_for_i"
         />
@@ -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/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index b358df3..6ee9bd1 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -692,7 +692,8 @@
             }
         }
         if (mInputView.isShifted()) {
-            primaryCode = Character.toUpperCase(primaryCode);
+            // TODO: This doesn't work with ß, need to fix it in the next release.
+            primaryCode = new String(keyCodes, 0, 1).toUpperCase().charAt(0);
         }
         if (mPredicting) {
             if (mInputView.isShifted() && mComposing.length() == 0) {
@@ -871,7 +872,7 @@
             suggestion = suggestion.toString().toUpperCase();
         } else if (preferCapitalization() 
                 || (mKeyboardSwitcher.isAlphabetMode() && mInputView.isShifted())) {
-            suggestion = Character.toUpperCase(suggestion.charAt(0)) 
+            suggestion = suggestion.toString().toUpperCase().charAt(0)
                     + suggestion.subSequence(1, suggestion.length()).toString();
         }
         InputConnection ic = getCurrentInputConnection();