getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.58k stars 443 forks source link

Arabic Language #3353

Open geohadab opened 4 years ago

geohadab commented 4 years ago

Environment

Python Version: python 3.7 Nikola Version: Nikola v8.0.4

Operating System: Ubuntu

Description:

I am trying to build an Arabic blog however, I have seen some issue when using Arabic language hyde1 the image above show the following problems

  1. the template is not mirrored ( the sidebar should be in the right side)
  2. the header text is not translate to Arabic
  3. the article date is Gregorian, can I change it to Hijri date

bootblog

this another template which shows that the text is not aligned RTL

Kwpolska commented 4 years ago

Patches to fix all of these things are welcome.

the template is not mirrored ( the sidebar should be in the right side)

Doing mirroring in CSS is not going to be easy in general, but you could propose a patch to that theme.

the article date is Gregorian, can I change it to Hijri date

I’m not sure if babel supports that, but if it does, it should be trivial to get to work.

the header text is not translate to Arabic

what header text? the footer in the red rectangle is completely user-customizable in conf.py

this another template which shows that the text is not aligned RTL

this looks like a bug in bootstrap 4 (they force body { text-align: left; }. The bootstrap developers removed this from the future versions, and are not willing to bring it to bs4 for backwards compatibility reasons, but I suppose you could add something to fix it (perhaps text-align: right for RTL?).

AUTOMAKERS commented 4 years ago

how can i help you

Kwpolska commented 4 years ago

@AUTOMAKERS You can help with this issue by resolving the problems mentioned in the two posts, eg. fixing the body text alignment for RTL sites with some CSS, or by figuring out a way to display non-Gregorian dates.

geohadab commented 4 years ago

would this framework help ? https://rtlcss.com/index.html

Kwpolska commented 4 years ago

RTLCSS could help you with mirroring the sidebar if you apply it to your site's CSS files. It won't do it on a global level (it produces separate .css files for RTL sites, and I'd prefer not to do that for Nikola).

I patched the Bootstrap 4 bug in e82fcbe22, and also fixed RTL support in the base theme in 31a561055. The patch for Bootstrap 4's body { text-align: left; } looks like this:

html[dir="rtl"] body {
   text-align: right;
}

(the same style would have to be used for RTL mirroring)


The remaining issues (RTL mirroring for hyde and perhaps other themes; non-Gregorian dates) are still not resolved, and contributions for those are welcome.

geohadab commented 3 years ago

is there any update for non-gregorian dates. I see this section in the new version

Date format used to display post dates, if local dates are used. (translatable) Used by moment.js: https://momentjs.com/docs/#/displaying/format/ JS_DATE_FORMAT = 'YYYY-MM-DD HH:mm'

there is a JS library of hijri calendar https://momentjs.com/docs/#/plugins/hijri/

Kwpolska commented 3 years ago

@geohadab You can integrate that library, or some other library (Python or JS), into your blog. This could work as a Nikola plugin if you want others to be able to use that.