Важное изменение в настройках для переводов
This commit is contained in:
parent
ac5e2dd88e
commit
002213aa87
4
Makefile
4
Makefile
@ -1,8 +1,8 @@
|
||||
build:
|
||||
pelican --ignore-cache -s pelicanconf.py
|
||||
pelican -s pelicanconf.py
|
||||
|
||||
web:
|
||||
pelican --ignore-cache -s pelicanconf-web.py
|
||||
pelican -s pelicanconf-web.py
|
||||
|
||||
clean:
|
||||
rm -rf cache __pycache__
|
||||
|
@ -2,33 +2,6 @@
|
||||
# -*- coding: utf-8 -*- #
|
||||
import os
|
||||
|
||||
class i18n(object):
|
||||
# looks for translations in
|
||||
# {LOCALE_DIR}/{LANGUAGE}/LC_MESSAGES/{DOMAIN}.mo
|
||||
# if not present, falls back to default
|
||||
|
||||
DOMAIN = 'messages'
|
||||
LOCALE_DIR = '{THEME}/translations'
|
||||
LANGUAGES = ['ru']
|
||||
NEWSTYLE = True
|
||||
|
||||
__name__ = 'i18n'
|
||||
|
||||
def register(self):
|
||||
from pelican.signals import generator_init
|
||||
generator_init.connect(self.install_translator)
|
||||
|
||||
def install_translator(self, generator):
|
||||
import gettext
|
||||
try:
|
||||
translator = gettext.translation(
|
||||
self.DOMAIN,
|
||||
self.LOCALE_DIR.format(THEME=THEME),
|
||||
self.LANGUAGES)
|
||||
except (OSError, IOError):
|
||||
translator = gettext.NullTranslations()
|
||||
generator.env.install_gettext_translations(translator, self.NEWSTYLE)
|
||||
|
||||
# ABOUT_ME = ' '
|
||||
AUTHOR = 'Андрей Астафьев'
|
||||
SITENAME = 'ДСП'
|
||||
@ -67,14 +40,16 @@ DISPLAY_TAGS_ON_SIDEBAR = True
|
||||
THEME = 'themes/bootstrap4'
|
||||
BOOTSTRAP_THEME = 'litera'
|
||||
|
||||
I18N_TEMPLATES_LANG = 'ru'
|
||||
# I18N_GETTEXT_LOCALEDIR = 'translations'
|
||||
# I18N_GETTEXT_DOMAIN = 'messages'
|
||||
|
||||
# Обязательно в виде массива
|
||||
I18N_TEMPLATES_LANG = ['ru']
|
||||
I18N_GETTEXT_NEWSTYLE = True
|
||||
I18N_GETTEXT_LOCALEDIR = 'themes/bootstrap4/translations'
|
||||
I18N_GETTEXT_DOMAIN = 'messages'
|
||||
JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n']}
|
||||
|
||||
PLUGIN_PATHS = ["plugins/official", "plugins/thirdparty"]
|
||||
PLUGINS = [i18n(), "pelican-css", "series", "subcategory", "tag_cloud", "tipue_search", "replacer", "asciidoctor"]
|
||||
PLUGINS = ["i18n_subsites", "pelican-css", "series", "subcategory", "tag_cloud", "tipue_search", "replacer", "asciidoctor"]
|
||||
|
||||
|
||||
ASCIIDOCTOR_CMD = "asciidoctor"
|
||||
|
@ -2,33 +2,6 @@
|
||||
# -*- coding: utf-8 -*- #
|
||||
import os
|
||||
|
||||
class i18n(object):
|
||||
# looks for translations in
|
||||
# {LOCALE_DIR}/{LANGUAGE}/LC_MESSAGES/{DOMAIN}.mo
|
||||
# if not present, falls back to default
|
||||
|
||||
DOMAIN = 'messages'
|
||||
LOCALE_DIR = '{THEME}/translations'
|
||||
LANGUAGES = ['ru']
|
||||
NEWSTYLE = True
|
||||
|
||||
__name__ = 'pelicanconf.i18n'
|
||||
|
||||
def register(self):
|
||||
from pelican.signals import generator_init
|
||||
generator_init.connect(self.install_translator)
|
||||
|
||||
def install_translator(self, generator):
|
||||
import gettext
|
||||
try:
|
||||
translator = gettext.translation(
|
||||
self.DOMAIN,
|
||||
self.LOCALE_DIR.format(THEME=THEME),
|
||||
self.LANGUAGES)
|
||||
except (OSError, IOError):
|
||||
translator = gettext.NullTranslations()
|
||||
generator.env.install_gettext_translations(translator, self.NEWSTYLE)
|
||||
|
||||
# ABOUT_ME = ' '
|
||||
AUTHOR = 'Андрей Астафьев'
|
||||
SITENAME = 'ДСП'
|
||||
@ -67,14 +40,16 @@ DISPLAY_TAGS_ON_SIDEBAR = True
|
||||
THEME = 'themes/bootstrap4'
|
||||
BOOTSTRAP_THEME = 'litera'
|
||||
|
||||
I18N_TEMPLATES_LANG = 'ru'
|
||||
# I18N_GETTEXT_LOCALEDIR = 'translations'
|
||||
# I18N_GETTEXT_DOMAIN = 'messages'
|
||||
|
||||
# Обязательно в виде массива
|
||||
I18N_TEMPLATES_LANG = ['ru']
|
||||
I18N_GETTEXT_NEWSTYLE = True
|
||||
I18N_GETTEXT_LOCALEDIR = 'themes/bootstrap4/translations'
|
||||
I18N_GETTEXT_DOMAIN = 'messages'
|
||||
JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n']}
|
||||
|
||||
PLUGIN_PATHS = ["plugins/official", "plugins/thirdparty"]
|
||||
PLUGINS = [i18n(), "pelican-css", "series", "subcategory", "tag_cloud", "tipue_search", "replacer", "asciidoctor"]
|
||||
PLUGINS = ["i18n_subsites", "pelican-css", "series", "subcategory", "tag_cloud", "tipue_search", "replacer", "asciidoctor"]
|
||||
|
||||
|
||||
ASCIIDOCTOR_CMD = "asciidoctor"
|
||||
|
Loading…
Reference in New Issue
Block a user