diff --git a/java/res/values-fa/donottranslate-more-keys.xml b/java/res/values-fa/donottranslate-more-keys.xml
index 3e13c795a4c7e718fe5522ab31697ab3234da366..1fb1846d94e14d6a44b04de9d17998241dec80d7 100644
--- a/java/res/values-fa/donottranslate-more-keys.xml
+++ b/java/res/values-fa/donottranslate-more-keys.xml
@@ -38,26 +38,26 @@
     <!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. -->
     <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',-,:,!,&#x061F;,&#x060C;,&#x061B;,&#x0650;,&#x064E;,&#x064D;,&#x064B;,&#x0656;,&#x0670;,&#x0655;,&#x0654;,&#x064F;,&#x064C;,&#x0651;,&#x0652;,&#x0653;,&#x0640;&#x0640;&#x0640;|&#x0640;,/"</string>
     <string name="keyhintlabel_for_punctuation">&#x064B;</string>
-    <!-- U+0661: "Ù¡" ARABIC-INDIC DIGIT ONE -->
-    <string name="keylabel_for_symbols_1">&#x0661;</string>
-    <!-- U+0662: "Ù¢" ARABIC-INDIC DIGIT TWO -->
-    <string name="keylabel_for_symbols_2">&#x0662;</string>
-    <!-- U+0663: "Ù£" ARABIC-INDIC DIGIT THREE -->
-    <string name="keylabel_for_symbols_3">&#x0663;</string>
-    <!-- U+0664: "Ù¤" ARABIC-INDIC DIGIT FOUR -->
-    <string name="keylabel_for_symbols_4">&#x0664;</string>
-    <!-- U+0665: "Ù¥" ARABIC-INDIC DIGIT FIVE -->
-    <string name="keylabel_for_symbols_5">&#x0665;</string>
-    <!-- U+0666: "Ù¦" ARABIC-INDIC DIGIT SIX -->
-    <string name="keylabel_for_symbols_6">&#x0666;</string>
-    <!-- U+0667: "Ù§" ARABIC-INDIC DIGIT SEVEN -->
-    <string name="keylabel_for_symbols_7">&#x0667;</string>
-    <!-- U+0668: "Ù¨" ARABIC-INDIC DIGIT EIGHT -->
-    <string name="keylabel_for_symbols_8">&#x0668;</string>
-    <!-- U+0669: "Ù©" ARABIC-INDIC DIGIT NINE -->
-    <string name="keylabel_for_symbols_9">&#x0669;</string>
-    <!-- U+0660: "Ù " ARABIC-INDIC DIGIT ZERO -->
-    <string name="keylabel_for_symbols_0">&#x0660;</string>
+    <!-- U+06F1: "Û±" EXTENDED ARABIC-INDIC DIGIT ONE -->
+    <string name="keylabel_for_symbols_1">&#x06F1;</string>
+    <!-- U+06F2: "Û²" EXTENDED ARABIC-INDIC DIGIT TWO -->
+    <string name="keylabel_for_symbols_2">&#x06F2;</string>
+    <!-- U+06F3: "Û³" EXTENDED ARABIC-INDIC DIGIT THREE -->
+    <string name="keylabel_for_symbols_3">&#x06F3;</string>
+    <!-- U+06F4: "Û´" EXTENDED ARABIC-INDIC DIGIT FOUR -->
+    <string name="keylabel_for_symbols_4">&#x06F4;</string>
+    <!-- U+06F5: "Ûµ" EXTENDED ARABIC-INDIC DIGIT FIVE -->
+    <string name="keylabel_for_symbols_5">&#x06F5;</string>
+    <!-- U+06F6: "Û¶" EXTENDED ARABIC-INDIC DIGIT SIX -->
+    <string name="keylabel_for_symbols_6">&#x06F6;</string>
+    <!-- U+06F7: "Û·" EXTENDED ARABIC-INDIC DIGIT SEVEN -->
+    <string name="keylabel_for_symbols_7">&#x06F7;</string>
+    <!-- U+06F8: "Û¸" EXTENDED ARABIC-INDIC DIGIT EIGHT -->
+    <string name="keylabel_for_symbols_8">&#x06F8;</string>
+    <!-- U+06F9: "Û¹" EXTENDED ARABIC-INDIC DIGIT NINE -->
+    <string name="keylabel_for_symbols_9">&#x06F9;</string>
+    <!-- U+06F0: "Û°" EXTENDED ARABIC-INDIC DIGIT ZERO -->
+    <string name="keylabel_for_symbols_0">&#x06F0;</string>
     <string name="additional_more_keys_for_symbols_1">1</string>
     <string name="additional_more_keys_for_symbols_2">2</string>
     <string name="additional_more_keys_for_symbols_3">3</string>
@@ -84,9 +84,11 @@
     <!-- U+060C: "،" ARABIC COMMA
          U+061B: "Ø›" ARABIC SEMICOLON
          U+061F: "ØŸ" ARABIC QUESTION MARK -->
-    <string name="keylabel_for_apostrophe">&#x060C;</string>
-    <string name="keylabel_for_dash">"."</string>
-    <string name="keyhintlabel_for_apostrophe">&#x061F;</string>
+    <string name="keylabel_for_tablet_comma">"&#x060C;"</string>
+    <string name="keyhintlabel_for_tablet_comma">"!"</string>
+    <string name="more_keys_for_tablet_comma">"!,\\,"</string>
+    <string name="keyhintlabel_for_tablet_period">"&#x061F;"</string>
+    <string name="more_keys_for_tablet_period">"&#x061F;,\?"</string>
     <string name="keyhintlabel_for_dash">&#x064B;</string>
     <string name="more_keys_for_apostrophe">"&#x061F;,&#x061B;,!,:,-,/,\',\""</string>
     <!-- U+0651: "Ù‘" ARABIC SHADDA
@@ -104,7 +106,7 @@
          U+0654: "Ù”" ARABIC HAMZA ABOVE
          U+0655: "Ù•" ARABIC HAMZA BELOW -->
     <!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. -->
-    <string name="more_keys_for_dash">"&#x0651;,&#x0652;,&#x064C;,&#x0653;,&#x064F;,&#x0650;,&#x064E;,&#x064B;,&#x0640;&#x0640;&#x0640;|&#x0640;,&#x064D;,&#x0654;,&#x0656;,&#x0655;,&#x0670;"</string>
+    <string name="more_keys_for_dash">"&#x0651;,&#x0652;,&#x064C;,&#x0653;,&#x064F;,&#x0650;,&#x064E;,&#x064B;,&#x0640;&#x0640;&#x0640;|&#x0640;,&#x064D;,&#x0654;,&#x0656;,&#x0655;,_,&#x0670;"</string>
     <!-- U+266A: "♪" EIGHTH NOTE -->
     <string name="more_keys_for_bullet">&#x266A;</string>
     <!-- U+2605: "★" BLACK STAR
diff --git a/java/res/values/donottranslate-more-keys.xml b/java/res/values/donottranslate-more-keys.xml
index 6577acdb994df1b4622d1c074f2e022eb035cfd1..79e12f86aee617bb59290252aa45abdb780b3186 100644
--- a/java/res/values/donottranslate-more-keys.xml
+++ b/java/res/values/donottranslate-more-keys.xml
@@ -139,6 +139,11 @@
     <string name="more_keys_for_symbols_semicolon"></string>
     <!-- U+2030: "‰" PER MILLE SIGN -->
     <string name="more_keys_for_symbols_percent">&#x2030;</string>
+    <string name="keylabel_for_tablet_comma">,</string>
+    <string name="keyhintlabel_for_tablet_comma">!</string>
+    <string name="more_keys_for_tablet_comma">!</string>
+    <string name="keyhintlabel_for_tablet_period">\?</string>
+    <string name="more_keys_for_tablet_period">\?</string>
     <string name="keylabel_for_apostrophe">\'</string>
     <string name="keylabel_for_dash">-</string>
     <string name="keyhintlabel_for_apostrophe">\"</string>
diff --git a/java/res/xml-fa/keyboard_set.xml b/java/res/xml-fa/keyboard_set.xml
index 9bd105093884c6682756243906c4de5067c82425..cb62b0dae39a0b2fe949206970037bf92d11d20a 100644
--- a/java/res/xml-fa/keyboard_set.xml
+++ b/java/res/xml-fa/keyboard_set.xml
@@ -23,7 +23,7 @@
     latin:keyboardLocale="fa" >
     <Element
         latin:elementName="alphabet"
-        latin:elementKeyboard="@xml/kbd_arabic" />
+        latin:elementKeyboard="@xml/kbd_farsi" />
     <Element
         latin:elementName="symbols"
         latin:elementKeyboard="@xml/kbd_symbols" />
diff --git a/java/res/xml/keys_comma_period.xml b/java/res/xml-sw600dp/keys_comma_period.xml
similarity index 77%
rename from java/res/xml/keys_comma_period.xml
rename to java/res/xml-sw600dp/keys_comma_period.xml
index 6db02b61dcc699bb9433219b5de20bcfce9a0390..f5f307be62660ec372bdaae0fb54fcd20eac7033 100644
--- a/java/res/xml/keys_comma_period.xml
+++ b/java/res/xml-sw600dp/keys_comma_period.xml
@@ -32,14 +32,14 @@
         </case>
         <default>
             <Key
-                latin:keyLabel=","
-                latin:keyHintLabel="!"
-                latin:moreKeys="!"
+                latin:keyLabel="@string/keylabel_for_tablet_comma"
+                latin:keyHintLabel="@string/keyhintlabel_for_tablet_comma"
+                latin:moreKeys="@string/more_keys_for_tablet_comma"
                 latin:keyStyle="hasShiftedLetterHintStyle" />
             <Key
                 latin:keyLabel="."
-                latin:keyHintLabel="\?"
-                latin:moreKeys="\?"
+                latin:keyHintLabel="@string/keyhintlabel_for_tablet_period"
+                latin:moreKeys="@string/more_keys_for_tablet_period"
                 latin:keyStyle="hasShiftedLetterHintStyle" />
         </default>
     </switch>
diff --git a/java/res/xml-sw600dp/rowkeys_farsi1.xml b/java/res/xml-sw600dp/rowkeys_farsi1.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ab260a460a045f672932cb7a103ae613a4bc2384
--- /dev/null
+++ b/java/res/xml-sw600dp/rowkeys_farsi1.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <!-- U+0636: "ض" ARABIC LETTER DAD -->
+    <Key
+        latin:keyLabel="&#x0636;" />
+    <!-- U+0635: "ص" ARABIC LETTER SAD -->
+    <Key
+        latin:keyLabel="&#x0635;" />
+    <!-- U+062B: "Ø«" ARABIC LETTER THEH -->
+    <Key
+        latin:keyLabel="&#x062B;" />
+    <!-- U+0642: "Ù‚" ARABIC LETTER QAF -->
+    <Key
+        latin:keyLabel="&#x0642;" />
+    <!-- U+0641: "ف" ARABIC LETTER FEH -->
+    <Key
+        latin:keyLabel="&#x0641;" />
+    <!-- U+063A: "غ" ARABIC LETTER GHAIN -->
+    <Key
+        latin:keyLabel="&#x063A;" />
+    <!-- U+0639: "ع" ARABIC LETTER AIN -->
+    <Key
+        latin:keyLabel="&#x0639;" />
+    <!-- U+0647: "Ù‡" ARABIC LETTER HEH
+         U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM
+         U+0647/U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER
+         U+06C0: "Û€" ARABIC LETTER HEH WITH YEH ABOVE
+         U+0629: "Ø©" ARABIC LETTER TEH MARBUTA -->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+06C0 ARABIC LETTER HEH WITH YEH ABOVE -->
+    <Key
+        latin:keyLabel="&#x0647;"
+        latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;,&#x06C0;,&#x0629;,%" />
+    <!-- U+062E: "Ø®" ARABIC LETTER KHAH -->
+    <Key
+        latin:keyLabel="&#x062E;" />
+    <!-- U+062D: "Ø­" ARABIC LETTER HAH -->
+    <Key
+        latin:keyLabel="&#x062D;" />
+    <!-- U+062C: "ج" ARABIC LETTER JEEM -->
+    <Key
+        latin:keyLabel="&#x062C;" />
+    <!-- U+0686: "Ú†" ARABIC LETTER TCHEH -->
+    <Key
+        latin:keyLabel="&#x0686;" />
+</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_farsi2.xml b/java/res/xml-sw600dp/rowkeys_farsi2.xml
new file mode 100644
index 0000000000000000000000000000000000000000..98e0f2186623f9aeec780455a1d0dcebb3d0cfce
--- /dev/null
+++ b/java/res/xml-sw600dp/rowkeys_farsi2.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <!-- U+0634: "Ø´" ARABIC LETTER SHEEN -->
+    <Key
+        latin:keyLabel="&#x0634;" />
+    <!-- U+0633: "س" ARABIC LETTER SEEN -->
+    <Key
+        latin:keyLabel="&#x0633;" />
+    <!-- U+06CC: "ی" ARABIC LETTER FARSI YEH
+         U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
+         U+064A: "ÙŠ" ARABIC LETTER YEH -->
+    <Key
+        latin:keyLabel="&#x06CC;"
+        latin:moreKeys="&#x0626;,&#x064A;" />
+    <!-- U+0628: "ب" ARABIC LETTER BEH -->
+    <Key
+        latin:keyLabel="&#x0628;" />
+    <!-- U+0644: "Ù„" ARABIC LETTER LAM -->
+    <Key
+        latin:keyLabel="&#x0644;" />
+    <!-- U+0627: "ا" ARABIC LETTER ALEF
+         U+0621: "Ø¡" ARABIC LETTER HAMZA
+         U+0622: "Ø¢" ARABIC LETTER ALEF WITH MADDA ABOVE
+         U+0672: "Ù²" ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE
+         U+0671: "Ù±" ARABIC LETTER ALEF WASLA
+         U+0673: "Ù³" ARABIC LETTER ALEF WITH WAVY HAMZA BELOW-->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+0672 ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE -->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+0673 ARABIC LETTER ALEF WITH WAVY HAMZA BELOW -->
+    <Key
+        latin:keyLabel="&#x0627;"
+        latin:moreKeys="&#x0621;,&#x0622;,&#x0672;,&#x0671;,&#x0673;" />
+    <!-- U+062A: "ت" ARABIC LETTER TEH -->
+    <Key
+        latin:keyLabel="&#x062A;" />
+    <!-- U+0646: "Ù†" ARABIC LETTER NOON -->
+    <Key
+        latin:keyLabel="&#x0646;" />
+    <!-- U+0645: "Ù…" ARABIC LETTER MEEM -->
+    <Key
+        latin:keyLabel="&#x0645;" />
+    <!-- U+06A9: "Ú©" ARABIC LETTER KEHEH
+         U+0643: "Ùƒ" ARABIC LETTER KAF -->
+    <Key
+        latin:keyLabel="&#x06A9;"
+        latin:moreKeys="&#x0643;" />
+    <!-- U+06AF: "Ú¯" ARABIC LETTER GAF -->
+    <Key
+        latin:keyLabel="&#x06AF;" />
+</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_farsi3.xml b/java/res/xml-sw600dp/rowkeys_farsi3.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c80c14a55696b5d4b5c19de15c92889dec4f9179
--- /dev/null
+++ b/java/res/xml-sw600dp/rowkeys_farsi3.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <!-- U+0638: "ظ" ARABIC LETTER ZAH -->
+    <Key
+        latin:keyLabel="&#x0638;" />
+    <!-- U+0637: "Ø·" ARABIC LETTER TAH -->
+    <Key
+        latin:keyLabel="&#x0637;" />
+    <!-- U+0632: "ز" ARABIC LETTER ZAIN
+         U+0698: "Ú˜" ARABIC LETTER JEH -->
+    <Key
+        latin:keyLabel="&#x0632;"
+        latin:moreKeys="&#x0698;" />
+    <!-- U+0631: "ر" ARABIC LETTER REH -->
+    <Key
+        latin:keyLabel="&#x0631;" />
+    <!-- U+0630: "ذ" ARABIC LETTER THAL -->
+    <Key
+        latin:keyLabel="&#x0630;" />
+    <!-- U+062F: "د" ARABIC LETTER DAL -->
+    <Key
+        latin:keyLabel="&#x062F;" />
+    <!-- U+067E: "Ù¾" ARABIC LETTER PEH -->
+    <Key
+        latin:keyLabel="&#x067E;" />
+    <!-- U+0648: "Ùˆ" ARABIC LETTER WAW
+         U+0676: "Ù¶" ARABIC LETTER HIGH HAMZA WAW -->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+0676 ARABIC LETTER HIGH HAMZA WAW -->
+    <Key
+        latin:keyLabel="&#x0648;"
+        latin:moreKeys="&#x0676;" />
+</merge>
diff --git a/java/res/xml-sw600dp/rows_farsi.xml b/java/res/xml-sw600dp/rows_farsi.xml
new file mode 100644
index 0000000000000000000000000000000000000000..75800420ae4fa85650e7f66e0d02590f3a6bccf4
--- /dev/null
+++ b/java/res/xml-sw600dp/rows_farsi.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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/key_styles_common" />
+    <Row
+        latin:keyWidth="7.6%p"
+    >
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi1" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillBoth" />
+    </Row>
+    <Row
+        latin:keyWidth="7.6%p"
+    >
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi2"
+            latin:keyXPos="4.5%p" />
+        <Key
+            latin:keyStyle="enterKeyStyle"
+            latin:keyWidth="fillBoth" />
+    </Row>
+    <Row
+        latin:keyWidth="7.6%p"
+    >
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyWidth="10.0%p" />
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi3" />
+        <include
+            latin:keyboardLayout="@xml/keys_comma_period" />
+        <include
+            latin:keyboardLayout="@xml/key_smiley"
+            latin:keyXPos="-9.0%p"
+            latin:keyWidth="fillRight" />
+    </Row>
+    <include
+        latin:keyboardLayout="@xml/row_qwerty4" />
+</merge>
diff --git a/java/res/xml-sw768dp/row_qwerty4.xml b/java/res/xml-sw768dp/row_qwerty4.xml
index 0aa04f8f76e4846917ceb18a56c497dceb40df75..90da21ba36bca1e24f1be2b22bb750782f2de534 100644
--- a/java/res/xml-sw768dp/row_qwerty4.xml
+++ b/java/res/xml-sw768dp/row_qwerty4.xml
@@ -87,11 +87,7 @@
                 <!-- U+200C: "" ZERO WIDTH NON-JOINER
                      U+200D: "" ZERO WIDTH JOINER -->
                 <Key
-                    latin:keyLabel="&#x200C;"
-                    latin:moreKeys="&#x200D;"
-                    latin:keyLabelFlags="hasPopupHint"
-                    latin:altCode="@integer/key_space"
-                    latin:keyActionFlags="altCodeWhileTyping" />
+                    latin:keyStyle="zwnjKeyStyle" />
             </case>
             <default>
                 <Key
diff --git a/java/res/xml-sw768dp/rows_farsi.xml b/java/res/xml-sw768dp/rows_farsi.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b969ff21cce24ed34fd1e897b11c0c15722da96b
--- /dev/null
+++ b/java/res/xml-sw768dp/rows_farsi.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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/key_styles_common" />
+    <Row
+        latin:keyWidth="7.125%p"
+    >
+        <Key
+            latin:keyStyle="tabKeyStyle"
+            latin:keyLabelFlags="alignLeft" />
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi1" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillBoth" />
+    </Row>
+    <Row
+        latin:keyWidth="7.125%p"
+    >
+        <Key
+            latin:keyStyle="toSymbolKeyStyle"
+            latin:keyLabelFlags="alignLeft"
+            latin:keyWidth="11.172%p"/>
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi2" />
+        <Key
+            latin:keyStyle="enterKeyStyle"
+            latin:keyXPos="-9.375%p"
+            latin:keyWidth="fillBoth" />
+    </Row>
+    <Row
+        latin:keyWidth="7.375%p"
+    >
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyWidth="13.829%p"/>
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi3" />
+        <include
+            latin:keyboardLayout="@xml/keys_comma_period" />
+        <Key
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth" />
+    </Row>
+    <include
+        latin:keyboardLayout="@xml/row_qwerty4" />
+</merge>
diff --git a/java/res/xml/kbd_farsi.xml b/java/res/xml/kbd_farsi.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1af4e61caa3502883138c117d37c59d5e1d7e613
--- /dev/null
+++ b/java/res/xml/kbd_farsi.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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.
+*/
+-->
+
+<Keyboard
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <include
+        latin:keyboardLayout="@xml/rows_farsi" />
+</Keyboard>
diff --git a/java/res/xml/key_styles_currency.xml b/java/res/xml/key_styles_currency.xml
index 6ddeb4c60c1a9ea2d28c9fa2285776e6d530dbe4..bd1d959e407bb756cd5d9fb80caa6b4b4862c074 100644
--- a/java/res/xml/key_styles_currency.xml
+++ b/java/res/xml/key_styles_currency.xml
@@ -101,6 +101,32 @@
                 latin:styleName="moreCurrency4KeyStyle"
                 latin:keyLabel="&#x00A2;" />
         </case>
+        <case
+            latin:languageCode="fa"
+        >
+            <!-- U+FDFC: "ï·¼" RIAL SIGN
+                 U+00A3: "£" POUND SIGN
+                 U+20AC: "€" EURO SIGN
+                 U+00A2: "¢" CENT SIGN -->
+            <!-- TODO: DroidSansArabic lacks the glyph of U+FCDC: RIAL SIGN -->
+            <key-style
+                latin:styleName="currencyKeyStyle"
+                latin:keyLabel="&#xFDFC;"
+                latin:moreKeys="@string/more_keys_for_currency_general" />
+            <key-style
+                latin:styleName="moreCurrency1KeyStyle"
+                latin:keyLabel="£" />
+            <key-style
+                latin:styleName="moreCurrency2KeyStyle"
+                latin:keyLabel="€" />
+            <key-style
+                latin:styleName="moreCurrency3KeyStyle"
+                latin:keyLabel="$"
+                latin:moreKeys="¢" />
+            <key-style
+                latin:styleName="moreCurrency4KeyStyle"
+                latin:keyLabel="¢" />
+        </case>
         <!-- United Kingdom -->
         <case
             latin:countryCode="GB"
diff --git a/java/res/xml/rowkeys_farsi1.xml b/java/res/xml/rowkeys_farsi1.xml
new file mode 100644
index 0000000000000000000000000000000000000000..15cb80182ab71eadb5371a44a7f6a9bb3030bec8
--- /dev/null
+++ b/java/res/xml/rowkeys_farsi1.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <!-- U+0635: "ص" ARABIC LETTER SAD
+         U+06F1: "Û±" EXTENDED ARABIC-INDIC DIGIT ONE -->
+    <Key
+        latin:keyLabel="&#x0635;"
+        latin:keyHintLabel="1"
+        latin:additionalMoreKeys="1,&#x06F1;" />
+    <!-- U+0642: "Ù‚" ARABIC LETTER QAF
+         U+06F2: "Û²" EXTENDED ARABIC-INDIC DIGIT TWO -->
+    <Key
+        latin:keyLabel="&#x0642;"
+        latin:keyHintLabel="2"
+        latin:additionalMoreKeys="2,&#x06F2;" />
+    <!-- U+0641: "ف" ARABIC LETTER FEH
+         U+06F3: "Û³" EXTENDED ARABIC-INDIC DIGIT THREE -->
+    <Key
+        latin:keyLabel="&#x0641;"
+        latin:keyHintLabel="3"
+        latin:additionalMoreKeys="3,&#x06F3;" />
+    <!-- U+063A: "غ" ARABIC LETTER GHAIN
+         U+06F4: "Û´" EXTENDED ARABIC-INDIC DIGIT FOUR -->
+    <Key
+        latin:keyLabel="&#x063A;"
+        latin:keyHintLabel="4"
+        latin:additionalMoreKeys="4,&#x06F4;" />
+    <!-- U+0639: "ع" ARABIC LETTER AIN
+         U+06F5: "Ûµ" EXTENDED ARABIC-INDIC DIGIT FIVE -->
+    <Key
+        latin:keyLabel="&#x0639;"
+        latin:keyHintLabel="5"
+        latin:additionalMoreKeys="5,&#x06F5;" />
+    <!-- U+0647: "Ù‡" ARABIC LETTER HEH
+         U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM
+         U+0647/U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER
+         U+06C0: "Û€" ARABIC LETTER HEH WITH YEH ABOVE
+         U+0629: "Ø©" ARABIC LETTER TEH MARBUTA
+         U+06F6: "Û¶" EXTENDED ARABIC-INDIC DIGIT SIX -->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+06C0 ARABIC LETTER HEH WITH YEH ABOVE -->
+    <Key
+        latin:keyLabel="&#x0647;"
+        latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;,&#x06C0;,&#x0629;,%"
+        latin:keyHintLabel="6"
+        latin:additionalMoreKeys="6,&#x06F6;" />
+    <!-- U+062E: "Ø®" ARABIC LETTER KHAH
+         U+06F7: "Û·" EXTENDED ARABIC-INDIC DIGIT SEVEN -->
+    <Key
+        latin:keyLabel="&#x062E;"
+        latin:keyHintLabel="7"
+        latin:additionalMoreKeys="7,&#x06F7;" />
+    <!-- U+062D: "Ø­" ARABIC LETTER HAH
+         U+06F8: "Û¸" EXTENDED ARABIC-INDIC DIGIT EIGHT -->
+    <Key
+        latin:keyLabel="&#x062D;"
+        latin:keyHintLabel="8"
+        latin:additionalMoreKeys="8,&#x06F8;" />
+    <!-- U+062C: "ج" ARABIC LETTER JEEM
+         U+06F9: "Û¹" EXTENDED ARABIC-INDIC DIGIT NINE -->
+    <Key
+        latin:keyLabel="&#x062C;"
+        latin:keyHintLabel="9"
+        latin:additionalMoreKeys="9,&#x06F9;" />
+    <!-- U+0686: "Ú†" ARABIC LETTER TCHEH
+         U+06F0: "Û°" EXTENDED ARABIC-INDIC DIGIT ZERO -->
+    <Key
+        latin:keyLabel="&#x0686;"
+        latin:keyHintLabel="0"
+        latin:additionalMoreKeys="0,&#x06F0;" />
+</merge>
diff --git a/java/res/xml/rowkeys_farsi2.xml b/java/res/xml/rowkeys_farsi2.xml
new file mode 100644
index 0000000000000000000000000000000000000000..77279c60fe976c3d3f30868f972fb67b8c2dbee9
--- /dev/null
+++ b/java/res/xml/rowkeys_farsi2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <!-- U+0634: "Ø´" ARABIC LETTER SHEEN -->
+    <Key
+        latin:keyLabel="&#x0634;" />
+    <!-- U+0633: "س" ARABIC LETTER SEEN
+         U+0636: "ض" ARABIC LETTER DAD -->
+    <Key
+        latin:keyLabel="&#x0633;"
+        latin:moreKeys="&#x0636;" />
+    <!-- U+06CC: "ی" ARABIC LETTER FARSI YEH
+         U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
+         U+064A: "ÙŠ" ARABIC LETTER YEH -->
+    <Key
+        latin:keyLabel="&#x06CC;"
+        latin:moreKeys="&#x0626;,&#x064A;" />
+    <!-- U+0628: "ب" ARABIC LETTER BEH -->
+    <Key
+        latin:keyLabel="&#x0628;" />
+    <!-- U+0644: "Ù„" ARABIC LETTER LAM -->
+    <Key
+        latin:keyLabel="&#x0644;" />
+    <!-- U+0627: "ا" ARABIC LETTER ALEF
+         U+0621: "Ø¡" ARABIC LETTER HAMZA
+         U+0622: "Ø¢" ARABIC LETTER ALEF WITH MADDA ABOVE
+         U+0672: "Ù²" ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE
+         U+0671: "Ù±" ARABIC LETTER ALEF WASLA
+         U+0673: "Ù³" ARABIC LETTER ALEF WITH WAVY HAMZA BELOW-->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+0672 ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE -->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+0673 ARABIC LETTER ALEF WITH WAVY HAMZA BELOW -->
+    <Key
+        latin:keyLabel="&#x0627;"
+        latin:moreKeys="&#x0621;,&#x0622;,&#x0672;,&#x0671;,&#x0673;" />
+    <!-- U+062A: "ت" ARABIC LETTER TEH
+         U+062B: "ﺙ" ARABIC LETTER THEH -->
+    <Key
+        latin:keyLabel="&#x062A;"
+        latin:moreKeys="&#x062B;" />
+    <!-- U+0646: "Ù†" ARABIC LETTER NOON -->
+    <Key
+        latin:keyLabel="&#x0646;" />
+    <!-- U+0645: "Ù…" ARABIC LETTER MEEM -->
+    <Key
+        latin:keyLabel="&#x0645;" />
+    <!-- U+06A9: "Ú©" ARABIC LETTER KEHEH
+         U+0643: "Ùƒ" ARABIC LETTER KAF -->
+    <Key
+        latin:keyLabel="&#x06A9;"
+        latin:moreKeys="&#x0643;" />
+</merge>
diff --git a/java/res/xml/rowkeys_farsi3.xml b/java/res/xml/rowkeys_farsi3.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8db56e3402b1828704389435e8786926c6c94bc6
--- /dev/null
+++ b/java/res/xml/rowkeys_farsi3.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <!-- U+0637: "Ø·" ARABIC LETTER TAH
+         U+0638: "ظ" ARABIC LETTER ZAH -->
+    <Key
+        latin:keyLabel="&#x0637;"
+        latin:moreKeys="&#x0638;" />
+    <!-- U+0698: "Ú˜" ARABIC LETTER JEH -->
+    <Key
+        latin:keyLabel="&#x0698;" />
+    <!-- U+0632: "ز" ARABIC LETTER ZAIN -->
+    <Key
+        latin:keyLabel="&#x0632;" />
+    <!-- U+0631: "ر" ARABIC LETTER REH -->
+    <Key
+        latin:keyLabel="&#x0631;" />
+    <!-- U+062F: "د" ARABIC LETTER DAL
+         U+0630: "ذ" ARABIC LETTER THAL -->
+    <Key
+        latin:keyLabel="&#x062F;"
+        latin:moreKeys="&#x0630;" />
+    <!-- U+067E: "Ù¾" ARABIC LETTER PEH -->
+    <Key
+        latin:keyLabel="&#x067E;" />
+    <!-- U+0648: "Ùˆ" ARABIC LETTER WAW
+         U+0676: "Ù¶" ARABIC LETTER HIGH HAMZA WAW -->
+    <!-- TODO: DroidSansArabic lacks the glyph of U+0676 ARABIC LETTER HIGH HAMZA WAW -->
+    <Key
+        latin:keyLabel="&#x0648;"
+        latin:moreKeys="&#x0676;" />
+    <!-- U+06AF: "Ú¯" ARABIC LETTER GAF -->
+    <Key
+        latin:keyLabel="&#x06AF;" />
+</merge>
diff --git a/java/res/xml/rows_farsi.xml b/java/res/xml/rows_farsi.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cc0c526b3cd76152b20afedc467ba88a6f5314ce
--- /dev/null
+++ b/java/res/xml/rows_farsi.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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/key_styles_common" />
+    <Row
+        latin:keyWidth="10%p"
+    >
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi1" />
+    </Row>
+    <Row
+        latin:keyWidth="10%p"
+    >
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi2" />
+    </Row>
+    <Row
+        latin:keyWidth="10%p"
+    >
+        <include
+            latin:keyboardLayout="@xml/rowkeys_farsi3"
+            latin:keyXPos="5.0%p" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillRight"
+            latin:visualInsetsLeft="1%p" />
+    </Row>
+    <include
+        latin:keyboardLayout="@xml/row_qwerty4" />
+</merge>