Development i18n Ubuntu

Persian keyboard layout for Ubuntu phone – Part 1: What to expect

Ubuntu touch does not have a Persian keyboard layout (as of December 2016). I thought it would be a valuable contribution to the Ubuntu project if I could make one. I had previously designed and implemented a soft keyboard layout for Android (that is, Persian layout for the excellent Hacker’s Keyboard by Klaus Weidner). I knew that making a new keyboard layout for an existing keyboard system should not be so difficult: as long as I start from an existing keyboard layout that is most similar to Persian (e.g. Arabic), I can replace Arabic characters with Persian ones and the rest would be mostly cosmetic changes.

That’s why I decided to make it.

Android’s Persian keyboard layout

But before I start, let’s take a look at Persian keyboard layout in my Android smartphone running Android 5.1. The following is the Persian layout in Android in its various modes.

normal mode
normal mode, extended letters for Alef
normal mode, extended diacritics symbols
normal mode, the Zero-Width Non-Joiner (ZWNJ) key, together with the extended form, Zero-Width Joiner (ZWJ)
symbols mode
symbols mode, extended Rial (currency) key
symbols mode, shifted

From the above, it is evident that there is a lot going on in the Persian layout of Android 5.1. It requires much more work than to just replacing a handful of characters in the normal mode of a Latin layout and to call it a Persian layout. Most notably,

  • there is no shift key in the normal mode for Persian layout. The Arabic script (which is also used in modern Persian language) does not have a concept of lower case and upper case.
  • The extended keys of the dot key are completely different from a Latin layout. They are filled with diacritics symbols used in the Persian alphabet. Theses are the symbols that represent short vowels in the Arabic script.
  • There is a separate key near the space key dedicated to ZWNJ, and its extended key, ZWJ. These (invisible) special characters are defined in unicode and control how neighboring characters join or not join. The symbols shown on the key buttons are different from what they actually insert into the text.
  • In the symbols mode, Persian digits are used instead of Latin digits (e.g. ۲ instead of 2). Notice also that the same Persian digits are shown as small hints in the normal mode of the Persian layout (the upper row of the keyboard). Also, Persian currency symbol (Rial) is used.
  • When in symbols mode, the key to switch back to normal mode is not “ABC”, but “اب‌پ” (the first three letters of the Persian alphabet).

If I set Android Persian layout as the ultimate goal for Ubuntu touch, it is clear from the above that I should

  • define a separate symbols keyboard, specific to Persian,
  • define special keys for ZWNJ and ZWJ, in the same way that other special keys (shift etc.) are defined,
  • make sure Persian digits are used in symbols mode and are also shown as hints in the normal mode

However, I have some criticisms for the Android layout, and I would like to avoid those (in my opinion) Android’s mistakes. Most importantly,

  • there is no (Persian) question mark (؟) and comma (،) in the normal mode. One has to enter symbols mode to enter them. In Latin keyboards, both such keys are extended forms of the dot (.) key and can be typed very quickly directly from the normal mode.
  • Keys from different rows are all aligned horizontally. This is unlike Latin keyboards where for example the key “A” is between “Q” and “W” (in the lower row). This perfect alignment will increase probability of mis-typing. It would be nice to make a different number of keys in each row of the layout, so that keys from different rows are not horizontally aligned.
  • There are simply too many consonant characters that are hardly used in Persian. I would very much prefer to hide keys Jeh (ژ), Theh (ث) and Thal (ذ) as extensions to keys Zeh (ز), Teh (ت), and Dal (د), respectively. This will save some precious horizontal space, and will make the keys larger, hence easier to type.

In the next post, I will write about the first steps to make changes to the Ubuntu keyboard.

6 replies on “Persian keyboard layout for Ubuntu phone – Part 1: What to expect”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.