user1059150
user1059150

Reputation: 151

Use of Arabic (RTL) in ReportLab

I would like to know more about use of Arabic in ReportLab. I have heard about the fribidi and pyfribidi packages and tried a little with that (using one of the document I got related to the OPEN ERP configuration), but unfortunately I didn't get the final result. Please help me for this case.

Regards Soorjith P

Upvotes: 4

Views: 3212

Answers (2)

Ruediger Jungbeck
Ruediger Jungbeck

Reputation: 2964

We use python-bidi http://github.com/mksoft/python-bidi for RTL support and Arabic Writer https://github.com/hasenj/arabic-writer/wiki for arabic language support.

import unicodedata

from bidi.algorithm import get_display
import arabic_rtlize 

def drawText(canvas, x,y, text):

    wrkText=text

    isArabic=False
    isBidi=False

    for c in wrkText:
        cat=unicodedata.bidirectional(c)

        if cat=="AL" or cat=="AN":
            isArabic=True
            isBidi=True
            break
        elif cat=="R" or cat=="RLE" or cat=="RLO":
            isBidi=True

    if isArabic:
        wrkText=arabic_rtlize.forms.fuse(wrkText)
        wrkText=arabic_rtlize.process.shape(wrkText)                    

    if isBidi:
        wrkText=get_display(wrkText)

    canvas.drawString(x, y, wrkText)

Upvotes: 2

kifcaliph
kifcaliph

Reputation: 321

قمنا بجمع التعديلات اللازمة لدعم اللغة العربية على نظام أوبن إي آر بي في ملف تعديل (patch) واحد. يحوي هذا الرابط تعليمات مفصلة لكيفية تطبيق هذه التعديلات على دبيان لينكس.

http://openerparabia.org/

تحل هذه التعديلات مشكلتين:

  1. استخدام اللغة العربية في واجهة الاستخدام لعميل ويب (web client): بعد تطبيق هذه التعديلات، ستظهر جميع عناصر الواجهة المترجمة باللغة العربية حين اختيارك للغة العربية كلغة المستخدم.

  2. عرض الحروف العربية بشكل صحيح في التقارير (PDF).

مجتمع أوبن إي آر بي العربي

http://openerparabia.org/


We collected the patches required for proper Arabic language support in OpenERP and packaged them into a single patch.

The patch, along with the instructions to apply it, are published at: https://bitbucket.org/openerparabia/openerp-arabic-support

The patch solves two problems:

  1. Setting the web client user interface language to Arabic A standard OpenERP install will fail to load all the translations: there are far more translated phrases than is actually used. This patch allows all translations to be used. (See https://bugs.launchpad.net/openobject-server/+bug/1019804 for details.)

  2. Display of Arabic characters in PDF reports.

Upvotes: 0

Related Questions