My intention is to write Arabic document using org-mode. Please consider the following MWE, given that my configuration in init.el
has below code to enable writing of Arabic script from right to left (rtl) instead of left to right (ltr) default behavior:
;; for right-to-left direction in org-mode
(defun set-bidi-env ()
"interactive"
(setq bidi-paragraph-direction 'nil))
(add-hook 'org-mode-hook 'set-bidi-env)
MWE.org buffer
# -*- mode: org -*-
#+OPTIONS: toc:1
#+LANGUAGE: ar
#+CREATOR: Emacs 25.1.50.2 (Org mode 8.3.4)
* تعريف بالارقام الهندية او الشرقية ١، ٢، ٣
* هذه النقطة الان باللغة العربية
* ما هو الحل؟
* النهاية
* Introducing Hindi or estern numbers 1, 2, 3
* This point now in Arabic
* How to solve it?
* The end.
The last four points in English are translation of the first four bullets in Arabic. So now if I export it to HTML
format by hitting C-c C-e h o I get this output:
Issues
Table of Contents
was not translated into Arabic as would be normally expected when language was set toar
. How to make org-mode aware of these Arabic equivalents of any document structure, e.g. TOC, chapter, figure, table, etc.
Update
This now is fixed. I updated the ox.el
:
(org-export-smart-quotes-alist): add "ar" to the list
(org-export-dictionary): add Arabic equivalents to template keywords
so I would put only the relevant code to table of contents
which is enough for the current MWE:
("Table of Contents"
("ar" :default "قائمة المحتويات")
- List numbers were in Arabic format
1,2,3
(yeah very counter-intuitive I know but bear with me please), while I wanted to appear in Hindi (see 1st list bullet in the output image). I want Hindi in Arabic language instead of 1, 2, 3 numbers. This applies to table of content also. How to achieve this customization?
Update
These are the hindi equivalent for arabic digits:
("0" "\u0660")
("1" "\u0661")
("2" "\u0662")
("3" "\u0663")
("4" "\u0664")
("5" "\u0665")
("6" "\u0666")
("7" "\u0667")
("8" "\u0668")
("9" "\u0669")
I hope this would come in handy to get it exported in case of Arabic language.
- Finally, as you can see in the output, the direction of the first four list items were from left to right not like what is expected in Arabic language from right to left. How to change direction depending on the context of script used (Arabic/English)?
Your help would be much appreciated.