RTL version of Flex theme - a minimalist Pelican theme - with some new small features.
- Change the direction of important tags to RTL.
- Add support for using multiple custom JS/CSS files.
- Add "featured-image" CSS class for styling featured images.
At first clone the pelican-plugins repository and enable i18n for your pelican site by adding the following code to your pelicanconf.py
:
# Enable i18n plugin, probably you already have some others here.
PLUGINS = ['i18n_subsites']
# Enable Jinja2 i18n extension used to parse translations.
JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n',]}
The step above only enable i18n, but it won't translate anything from English.
If you want to translate to another language you need to change DEFAULT_LANG
and I18N_TEMPLATES_LANG
in your pelicanconf.py
. You should change LOCALE
and OG_LOCALE
to match your new configuration too.
To translate to Persian language you can add following code to your pelicanconf.py
:
# Default theme language.
I18N_TEMPLATES_LANG = 'fa_IR'
# Your time zone.
TIMEZONE = 'Asia/Tehran'
# Your language.
DEFAULT_LANG = 'fa'
LOCALE = 'fa'
when you add non ASCII or special characters in tags and categories, pelican converts them to ASCII characters or removes them.
for example if you use سیب
for tag, pelican converts it to sb
or sib
.
to stop this, find utils.py
in pelican's site-packages folder. find slugify
function and find this lines and comment out them:
value = unidecode(value)
# ...
value = value.encode('ascii', 'ignore')
change this line:
value = unicodedata.normalize('NFKD', value)
to:
value = unicodedata.normalize('NFKC', value)
and finally change this line:
return value.decode('ascii')
to:
return value.strip()
Attention: these changes may cause unexpected problems.
Alexandre Vicenzi for Flex Theme - https://github.com/alexandrevicenzi/Flex
Pelican dev team for Pelican static site generator - https://github.com/getpelican/pelican
MIT