ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Help in translate website to arabic (css and lang)

Hello there
I have website need it to be in Arabic language beside English
so I need help in translate website to Arabic (CSS files and lang)

Regards

1 Like

You can do the following:
at hooks.py define this variable with bootstrap-rtl file.
app_css_right = [“assets/erpsystem/css/bootstrap/bootstrap-rtl.min.css”,“assets/erpsystem/css/erpnext-rtl.css”]

Then in desk.py who exist in /apps/frappe/frappe/templates/pages/desk.py
modify the return at function get_context this

return {
“build_version”: get_build_version(),
“include_js”: hooks[“app_include_js”],
“include_css”: hooks[“app_include_css”],
“include_css_rlt”: [] if frappe.local.lang == “en” else hooks[“app_css_right”],
“sounds”: hooks[“sounds”],
“boot”: boot if context.get(“for_mobile”) else boot_json,
“csrf_token”: csrf_token,
“background_image”: boot.user.background_image or boot.default_background_image,
“google_analytics_id”: frappe.conf.get(“google_analytics_id”)
}

I’ve add this line
"include_css_rlt": [] if frappe.local.lang == "en" else hooks["app_css_right"],

Then at desk.html who exist in /apps/frappe/frappe/templates/pages/desk.html
add the following tags

{% for include in include_css_rlt -%}

{%- endfor -%}

You can check my fork, I’ve implement it, and it works successfully.

3 Likes

Thank you Bro.

1 Like

Just load bootstrap rtl (didnt test if this is necessary) then specify which elements should be rtl <p class="rtl">.

I simply altered the main html tag like this and everything worked <html dir='rtl'>

I’ll update later with the jQuery code I used to make this alteration.