Localization/Arabic

From ArchWiki

This article describes how to set up Arabic language environment.

Applications

Bidirectional text includes text direction support among applications. In particular, Firefox Ctrl+Shift+X is the only supported shortcut for switching text direction.

Ayaspell offers Arabic spellchecking extensions for applications like LibreOffice, Firefox, and also system-wide dictionaries using hunspell-arAUR.

For Islamic utilities like Hijri date conversion and prayer times, check Islamic tools.

Libreoffice

  1. Enable Complex Text Layout: Tools > Options... > Language Settings > Languages > Default Languages for Documents.
  2. Install Ayaspell dictionary: Tools > Language > More Dictionaries Online > Arabic.

Fonts

Check Font configuration/Examples#Arabic for setting up font configuration. Persian fonts like vazirmatn-fontsAUR also include support for Arabic letters. A list of Persian fonts can be checked from Fonts#Persian.

Troubleshooting

Common issues may be solved by checking Locale#Troubleshooting first. For problems related to text direction, check Bidi.

XKB Lam Alif problem

X keyboard layout sends Arabic ligature glyphs as a single glyph. For example, Laa+Alif ligature "لا" (U+0644, U+0627) is sent as "ﻻ" (U+FEFB), and similarly for (ﻷ، ﻵ، ﻹ). This is due to a known limitation in xkb which does not allow mapping a key to more than one character.

Workaround with X compose

The following solutions require X server restart. If you have im-config installed, you can use im-config -n xim. Alternatively, add the following to your environment variables:

XIM=none
XIM_PROGRAM=/bin/true
XIM_ARGS=
GTK_IM_MODULE=xim
QT_IM_MODULE=xim
SHORT_DESC="X compose table"

However, since most QT-based programs do not have this issue, it is enough to add export GTK_IM_MODULE=xim to ~/.xsessionrc or ~/.xprofile.

Tip: If XIM is set as the default input method, then XCompose table offers additional Arabic letters like: گ، ڤ، چ، پ, quotes «», as well as Wikipedia:Zero-width non-joiner, by pressing the AltGr key. The default compose table is located in /usr/share/X11/xkb/symbols/ara.

Workaround with ibus

  • Set ibus as an input method by running im-chooser or by setting the environment variables:
    GTK_IM_MODULE=ibus; QT_IM_MODULE=ibus; XMODIFIERS=@im=ibus
  • Run ibus-daemon or ibus-setup if ibus is not set up.
  • Use ar-kbd-m17n as ibus input method.

Fix Arabic legibility when using Noto Fonts

The Nastaliq Urdu fonts are chosen by default for Arabic. Use the following configuration to blacklist them, ensuring the system uses a proper Arabic font.

/etc/fonts/conf.d/66-noto-reject-nastaliq.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <selectfont>
    <rejectfont>
      <glob>/usr/share/fonts/noto/NotoNastaliq*</glob>
    </rejectfont>
  </selectfont>
</fontconfig>

See also