Exemplo n.º 1
0
            "The path '{0}' in the setting '{1}' does not exist!".format(
                FLUENT_PAGES_TEMPLATE_DIR, settingName))

# Clean settings
FLUENT_PAGES_DEFAULT_LANGUAGE_CODE = normalize_language_code(
    FLUENT_PAGES_DEFAULT_LANGUAGE_CODE)

if not is_supported_django_language(FLUENT_PAGES_DEFAULT_LANGUAGE_CODE):
    raise ImproperlyConfigured(
        "FLUENT_PAGES_DEFAULT_LANGUAGE_CODE '{0}' does not exist in LANGUAGES".
        format(FLUENT_PAGES_DEFAULT_LANGUAGE_CODE))

FLUENT_PAGES_LANGUAGES = parler_appsettings.add_default_language_settings(
    FLUENT_PAGES_LANGUAGES,
    'FLUENT_PAGES_LANGUAGES',
    hide_untranslated=False,
    hide_untranslated_menu_items=False,
    code=FLUENT_PAGES_DEFAULT_LANGUAGE_CODE,
    fallback=FLUENT_PAGES_DEFAULT_LANGUAGE_CODE)

# Using a slug field, enforce keys as slugs too.
FLUENT_PAGES_KEY_CHOICES = [(slugify(str(key)), title)
                            for key, title in FLUENT_PAGES_KEY_CHOICES]


def get_language_settings(language_code, site_id=None):
    """
    Return the language settings for the current site
    """
    if site_id is None:
        site_id = settings.SITE_ID
Exemplo n.º 2
0
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from parler import appsettings as parler_appsettings
from parler.utils import normalize_language_code, is_supported_django_language

# Advanced settings
FLUENT_FAQ_FILTER_SITE_ID = getattr(settings, 'FLUENT_FAQ_FILTER_SITE_ID', True)

# Note: the default language setting is used during the migrations
# Allow this module to have other settings, but default to the shared settings
FLUENT_DEFAULT_LANGUAGE_CODE = getattr(settings, 'FLUENT_DEFAULT_LANGUAGE_CODE', parler_appsettings.PARLER_DEFAULT_LANGUAGE_CODE)
FLUENT_FAQ_DEFAULT_LANGUAGE_CODE = getattr(settings, 'FLUENT_FAQ_DEFAULT_LANGUAGE_CODE', FLUENT_DEFAULT_LANGUAGE_CODE)
FLUENT_FAQ_LANGUAGES = getattr(settings, 'FLUENT_FAQ_LANGUAGES', parler_appsettings.PARLER_LANGUAGES)


# Clean settings
FLUENT_FAQ_DEFAULT_LANGUAGE_CODE = normalize_language_code(FLUENT_FAQ_DEFAULT_LANGUAGE_CODE)

if not is_supported_django_language(FLUENT_FAQ_DEFAULT_LANGUAGE_CODE):
    raise ImproperlyConfigured("FLUENT_FAQ_DEFAULT_LANGUAGE_CODE '{0}' does not exist in LANGUAGES".format(FLUENT_FAQ_DEFAULT_LANGUAGE_CODE))

FLUENT_FAQ_LANGUAGES = parler_appsettings.add_default_language_settings(
    FLUENT_FAQ_LANGUAGES, 'FLUENT_FAQ_LANGUAGES',
    code=FLUENT_FAQ_DEFAULT_LANGUAGE_CODE,
    fallback=FLUENT_FAQ_DEFAULT_LANGUAGE_CODE,
    hide_untranslated=False,
)
Exemplo n.º 3
0
    if not os.path.isabs(FLUENT_PAGES_TEMPLATE_DIR):
        raise ImproperlyConfigured("The setting '{0}' needs to be an absolute path!".format(settingName))
    if not os.path.exists(FLUENT_PAGES_TEMPLATE_DIR):
        raise ImproperlyConfigured("The path '{0}' in the setting '{1}' does not exist!".format(FLUENT_PAGES_TEMPLATE_DIR, settingName))


# Clean settings
FLUENT_PAGES_DEFAULT_LANGUAGE_CODE = normalize_language_code(FLUENT_PAGES_DEFAULT_LANGUAGE_CODE)

if not is_supported_django_language(FLUENT_PAGES_DEFAULT_LANGUAGE_CODE):
    raise ImproperlyConfigured("FLUENT_PAGES_DEFAULT_LANGUAGE_CODE '{0}' does not exist in LANGUAGES".format(FLUENT_PAGES_DEFAULT_LANGUAGE_CODE))

FLUENT_PAGES_LANGUAGES = parler_appsettings.add_default_language_settings(
    FLUENT_PAGES_LANGUAGES, 'FLUENT_PAGES_LANGUAGES',
    hide_untranslated=False,
    hide_untranslated_menu_items=False,
    code=FLUENT_PAGES_DEFAULT_LANGUAGE_CODE,
    fallback=FLUENT_PAGES_DEFAULT_LANGUAGE_CODE
)

# Using a slug field, enforce keys as slugs too.
FLUENT_PAGES_KEY_CHOICES = [(slugify(str(key)), title) for key, title in FLUENT_PAGES_KEY_CHOICES]


def get_language_settings(language_code, site_id=None):
    """
    Return the language settings for the current site
    """
    if site_id is None:
        site_id = settings.SITE_ID
Exemplo n.º 4
0
FLUENT_FAQ_FILTER_SITE_ID = getattr(settings, 'FLUENT_FAQ_FILTER_SITE_ID',
                                    True)

# Note: the default language setting is used during the migrations
# Allow this module to have other settings, but default to the shared settings
FLUENT_DEFAULT_LANGUAGE_CODE = getattr(
    settings, 'FLUENT_DEFAULT_LANGUAGE_CODE',
    parler_appsettings.PARLER_DEFAULT_LANGUAGE_CODE)
FLUENT_FAQ_DEFAULT_LANGUAGE_CODE = getattr(settings,
                                           'FLUENT_FAQ_DEFAULT_LANGUAGE_CODE',
                                           FLUENT_DEFAULT_LANGUAGE_CODE)
FLUENT_FAQ_LANGUAGES = getattr(settings, 'FLUENT_FAQ_LANGUAGES',
                               parler_appsettings.PARLER_LANGUAGES)

# Clean settings
FLUENT_FAQ_DEFAULT_LANGUAGE_CODE = normalize_language_code(
    FLUENT_FAQ_DEFAULT_LANGUAGE_CODE)

if not is_supported_django_language(FLUENT_FAQ_DEFAULT_LANGUAGE_CODE):
    raise ImproperlyConfigured(
        "FLUENT_FAQ_DEFAULT_LANGUAGE_CODE '{0}' does not exist in LANGUAGES".
        format(FLUENT_FAQ_DEFAULT_LANGUAGE_CODE))

FLUENT_FAQ_LANGUAGES = parler_appsettings.add_default_language_settings(
    FLUENT_FAQ_LANGUAGES,
    'FLUENT_FAQ_LANGUAGES',
    code=FLUENT_FAQ_DEFAULT_LANGUAGE_CODE,
    fallback=FLUENT_FAQ_DEFAULT_LANGUAGE_CODE,
    hide_untranslated=False,
)