Support Spanish keyboard

Bug: 4312114
Change-Id: I3feca4e87bdca0e4b5304fc325188e7eac115328
diff --git a/java/res/values-es/donottranslate-altchars.xml b/java/res/values-es/donottranslate-altchars.xml
index 99f1663..16111ec 100644
--- a/java/res/values-es/donottranslate-altchars.xml
+++ b/java/res/values-es/donottranslate-altchars.xml
@@ -25,4 +25,6 @@
     <string name="alternates_for_u">7,ú,ü,ù,û,ū</string>
     <string name="alternates_for_n">ñ,ń</string>
     <string name="alternates_for_c">ç,ć,č</string>
+    <string name="alternates_for_punctuation">"\\,,\?,!,¿,¡,:,-,\',\",),(,/,;,+,&amp;,\@"</string>
+    <string name="alternates_for_web_tab_punctuation">".,\\,,\?,!,¿,¡,:,-,\',\",),(,/,;,+,&amp;,\@"</string>
 </resources>
diff --git a/java/res/xml-es/kbd_qwerty.xml b/java/res/xml-es/kbd_qwerty.xml
index 3973a6a..568f4d6 100644
--- a/java/res/xml-es/kbd_qwerty.xml
+++ b/java/res/xml-es/kbd_qwerty.xml
@@ -23,5 +23,5 @@
     latin:keyboardLocale="es,es_US"
 >
     <include
-        latin:keyboardLayout="@xml/kbd_rows_qwerty" />
+        latin:keyboardLayout="@xml/kbd_rows_spanish" />
 </Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_rows_azerty.xml b/java/res/xml-sw600dp/kbd_rows_azerty.xml
index 4df45eb..b53bbbb 100644
--- a/java/res/xml-sw600dp/kbd_rows_azerty.xml
+++ b/java/res/xml-sw600dp/kbd_rows_azerty.xml
@@ -150,7 +150,7 @@
         </switch>
         <include
             latin:keyboardLayout="@xml/kbd_row3_right" />
-   </Row>
+    </Row>
     <include
         latin:keyboardLayout="@xml/kbd_qwerty_row4" />
 </merge>
diff --git a/java/res/xml-sw600dp/kbd_rows_spanish.xml b/java/res/xml-sw600dp/kbd_rows_spanish.xml
new file mode 100644
index 0000000..7ef44bb
--- /dev/null
+++ b/java/res/xml-sw600dp/kbd_rows_spanish.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_key_styles" />
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row1" />
+    <Row
+        latin:keyWidth="8.5%p"
+    >
+        <Key
+            latin:keyLabel="a"
+            latin:popupCharacters="@string/alternates_for_a"
+            latin:keyXPos="5.0%p"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="s"
+            latin:popupCharacters="@string/alternates_for_s" />
+        <Key
+            latin:keyLabel="d"
+            latin:popupCharacters="@string/alternates_for_d" />
+        <Key
+            latin:keyLabel="f" />
+        <Key
+            latin:keyLabel="g"
+            latin:popupCharacters="@string/alternates_for_g" />
+        <Key
+            latin:keyLabel="h" />
+        <Key
+            latin:keyLabel="j" />
+        <Key
+            latin:keyLabel="k"
+            latin:popupCharacters="@string/alternates_for_k" />
+        <Key
+            latin:keyLabel="l"
+            latin:popupCharacters="@string/alternates_for_l" />
+        <Key
+            latin:keyLabel="ñ" />
+        <Key
+            latin:keyStyle="returnKeyStyle"
+            latin:keyXPos="-14.6%p"
+            latin:keyWidth="fillBoth"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row3" />
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml-sw768dp/kbd_rows_spanish.xml b/java/res/xml-sw768dp/kbd_rows_spanish.xml
new file mode 100644
index 0000000..300592e
--- /dev/null
+++ b/java/res/xml-sw768dp/kbd_rows_spanish.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_key_styles" />
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row1" />
+    <Row
+        latin:keyWidth="8.125%p"
+    >
+        <Key
+            latin:keyStyle="toSymbolKeyStyle"
+            latin:keyLabelOption="alignLeft"
+            latin:keyWidth="10.167%p"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="a"
+            latin:popupCharacters="@string/alternates_for_a" />
+        <Key
+            latin:keyLabel="s"
+            latin:popupCharacters="@string/alternates_for_s" />
+        <Key
+            latin:keyLabel="d"
+            latin:popupCharacters="@string/alternates_for_d" />
+        <Key
+            latin:keyLabel="f" />
+        <Key
+            latin:keyLabel="g"
+            latin:popupCharacters="@string/alternates_for_g" />
+        <Key
+            latin:keyLabel="h" />
+        <Key
+            latin:keyLabel="j" />
+        <Key
+            latin:keyLabel="k"
+            latin:popupCharacters="@string/alternates_for_k" />
+        <Key
+            latin:keyLabel="l"
+            latin:popupCharacters="@string/alternates_for_l" />
+        <Key
+            latin:keyLabel="ñ" />
+        <Key
+            latin:keyStyle="returnKeyStyle"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row3" />
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml/kbd_rows_spanish.xml b/java/res/xml/kbd_rows_spanish.xml
new file mode 100644
index 0000000..c5ead10
--- /dev/null
+++ b/java/res/xml/kbd_rows_spanish.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_key_styles" />
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row1" />
+    <Row
+        latin:keyWidth="10%p"
+    >
+        <Key
+            latin:keyLabel="a"
+            latin:popupCharacters="@string/alternates_for_a"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="s"
+            latin:popupCharacters="@string/alternates_for_s" />
+        <Key
+            latin:keyLabel="d"
+            latin:popupCharacters="@string/alternates_for_d" />
+        <Key
+            latin:keyLabel="f" />
+        <Key
+            latin:keyLabel="g"
+            latin:popupCharacters="@string/alternates_for_g" />
+        <Key
+            latin:keyLabel="h" />
+        <Key
+            latin:keyLabel="j" />
+        <Key
+            latin:keyLabel="k"
+            latin:popupCharacters="@string/alternates_for_k" />
+        <Key
+            latin:keyLabel="l"
+            latin:popupCharacters="@string/alternates_for_l" />
+        <Key
+            latin:keyLabel="ñ"
+            latin:keyEdgeFlags="right" />
+    </Row>
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row3" />
+    <include
+        latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>