Design Development i18n Ubuntu

Persian keyboard layout for Ubuntu phone – Part 4: Final design touch

Or, why Ubuntu touch has will soon have a better Persian keyboard layout than Android?

I finally completed the design of the Persian layout with all of its bells and whistles, and I have proposed the layout for merging into the Ubuntu project. I am excited to share with you some screenshots!

At the end of this post, I will discuss why this layout is even better than the current golden standard for mobile Persian layouts, which is implemented in Android.


Normal mode. Keys in the bottom row from left: symbols shift key, language menu, comma, space, zero-width non-joiner (ZWNJ), dot, and backspace.

Normal mode. Extended keys for Persian letter Yeh (ی).

Normal mode. Extended keys for dot, from left: Persian percent sign, colon, semicolon, Persian question mark, exclamation mark, slash, and Persian Kashida.

Normal mode. Extended keys for comma: Persian- (and French-) style quotation marks, parentheses, and Persian/Araic diacritics.

Symbols mode. Keys in the second row from left: decimal separator, thousands separator, and Iranian currency symbol ﷼ (Rial). Note also that the ZWNJ key is now replaced by ZWJ.

Symbols mode. Extended keys for Rial (currency) key.

Symbols mode, shifted.

Why is this better than the Persian layout in Android?

In the design of this new Persian layout for Ubuntu phone, I have addressed the following shortcomings in the Persian keyboard layout in Android. Some of these points are repeated from a previous blog post, while some others are new.

  • Android has no question and exclamation marks in its normal mode, not even as extended keys. The user has to switch to symbols keyboard to type either of these frequent characters.
  • Android has no decimal or thousands separator (٫ and ٬, respectively). A dot character (.) is no replacement for decimal separator in Persian since it is terribly similar to the Persian zero digit (۰). Many people mistakenly use a slash character as a replacement for decimal separator, and it results in BBC Persian to mis-report earthquake magnitudes.
  • In Android, keys from different rows are all aligned horizontally (see a screenshot). This is unlike the US/UK layouts where for example the key “A” is between “Q” and “W” (in the lower row). This perfect alignment will increase probability of mis-typing.
  • Android keyboard is too crowded with some consonant letters that are rarely used in modern Persian writing. Based on the results from this letter frequency analysis tool that I developed myself, I have removed the least-used characters from this Persian layout, and people seem to be happy about it.

Remaining issues

There are some minor issues about this keyboard layout that are beyond the layout itself, and should be addressed in the ubuntu-keyboard package as a whole. I am interested to work with other Ubuntu developers to find a proper way to fix these minor issues in the future.

First, the ubuntu-keyboard package does not provide an easy way to define a key where the label of the key is different from what it inserts into the text. The ZWNJ and ZWJ keys are good examples, and they are now working only thanks to a sub-optimal hack.

Second, key labels have an LTR (left-to-right) directionality by default. This forced me to add an RLM (right-to-left mark) character after all directionally-weak characters (e.g. parentheses and brackets) to make them show up correctly on the key label. As a result, these invisible RLMs are inserted into the text whenever the user types e.g. a parenthesis. While this is not a big issue (RLM is invisible), this has to be fixed to avoid possible text-processing issues with some legacy software.

What’s next?

For me, this was a beautiful experience for contributing to the Ubuntu project. I look forward to see this layout merged into the project, and to make more code contributions to Ubuntu.

5 replies on “Persian keyboard layout for Ubuntu phone – Part 4: Final design touch”

This looks great!

I unfortunately don’t know Farsi, so won’t be able to use the keyboard itself, but the description of the process is really interesting and useful.

Regarding the compilation (part 2), isn’t it possible to cross-compile from a desktop/laptop, which would hopefully take less than 45 minutes? I’ve only compiled the ubuntu touch terminal app, a while ago, and I used Qt Creator, which uses an arm chroot for the compilation.

Thanks for your kind words. Yes, I could in principle compile everything from a desktop, but I didn’t want to mess up my work laptop with all development packages, and I didn’t have enough power/storage to make a dedicated development environment in a VM or bare metal.