Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python django cms不使用用户';s语言作为其核心翻译_Python_Django_Translation_Django Cms_Administration - Fatal编程技术网

Python django cms不使用用户';s语言作为其核心翻译

Python django cms不使用用户';s语言作为其核心翻译,python,django,translation,django-cms,administration,Python,Django,Translation,Django Cms,Administration,编辑:我发现这发生在由djangocms安装程序生成的一个非常基本的项目上,我已经报道过 我已经用设置了一个简单的项目,我的客户的母语是法语。多亏了,法语翻译总是最新的。不太清楚原因,与django cms应用程序相关的所有内容都没有被翻译(管理、管理工具栏中的字符串等) “双击编辑”、“创建页面”等字符串仍然是英文的,即使当前登录的用户将其设置设置为法语(Accueil›Cms›user settings›gableroux) 请注意,administration中的所有其他字符串都翻译为

编辑:我发现这发生在由djangocms安装程序生成的一个非常基本的项目上,我已经报道过

我已经用设置了一个简单的项目,我的客户的母语是法语。多亏了,法语翻译总是最新的。不太清楚原因,与django cms应用程序相关的所有内容都没有被翻译(管理、管理工具栏中的字符串等)

“双击编辑”、“创建页面”等字符串仍然是英文的,即使当前登录的用户将其设置设置为法语
(Accueil›Cms›user settings›gableroux)

请注意,administration中的所有其他字符串都翻译为法语

德扬戈管理局
再见,加布勒鲁。修饰符的移动/连接
杜址行政

等等

生成的设置 *请注意,我没有在生产中使用这些设置,这是我为这个特定问题生成的示例项目,
SECRET\u KEY
没有在任何地方使用;)

如果你有任何想法或你觉得我可以提供更多的信息,请让我知道

皮普冷冻
为了记录在案,django cms项目Github已经解决了这个问题:

最后的答案(一旦应用了删除区域设置的修补程序)是重新启动服务器——只有在服务器重新启动时才会考虑区域设置

import os
gettext = lambda s: s
DATA_DIR = os.path.dirname(os.path.dirname(__file__))
"""
Django settings for omg project.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '@j#r%*#u&2v!yxih1n11e)4gg%k+)1bm&=mdhdcpzn9#ptn597'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []


# Application definition





ROOT_URLCONF = 'omg.urls'

WSGI_APPLICATION = 'omg.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases



# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'fr'

TIME_ZONE = 'America/Chicago'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
STATIC_ROOT = os.path.join(DATA_DIR, 'static')

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'omg', 'static'),
)
SITE_ID = 1

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    'django.template.loaders.eggs.Loader'
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.doc.XViewMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'cms.middleware.user.CurrentUserMiddleware',
    'cms.middleware.page.CurrentPageMiddleware',
    'cms.middleware.toolbar.ToolbarMiddleware',
    'cms.middleware.language.LanguageCookieMiddleware'
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.contrib.messages.context_processors.messages',
    'django.core.context_processors.i18n',
    'django.core.context_processors.debug',
    'django.core.context_processors.request',
    'django.core.context_processors.media',
    'django.core.context_processors.csrf',
    'django.core.context_processors.tz',
    'sekizai.context_processors.sekizai',
    'django.core.context_processors.static',
    'cms.context_processors.cms_settings'
)

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'omg', 'templates'),
)

INSTALLED_APPS = (
    'djangocms_admin_style',
    'djangocms_text_ckeditor',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.admin',
    'django.contrib.sites',
    'django.contrib.sitemaps',
    'django.contrib.staticfiles',
    'django.contrib.messages',
    'cms',
    'menus',
    'sekizai',
    'mptt',
    'djangocms_style',
    'djangocms_column',
    'djangocms_file',
    'djangocms_flash',
    'djangocms_googlemap',
    'djangocms_inherit',
    'djangocms_link',
    'djangocms_picture',
    'djangocms_teaser',
    'djangocms_video',
    'south',
    'reversion',
    'omg'
)

LANGUAGES = (
    ## Customize this
    ('fr', gettext('fr')),
    ('en', gettext('en')),
)

CMS_LANGUAGES = {
    ## Customize this
    'default': {
        'public': True,
        'hide_untranslated': False,
        'redirect_on_fallback': True,
    },
    1: [
        {
            'public': True,
            'code': 'fr',
            'hide_untranslated': False,
            'name': gettext('fr'),
            'redirect_on_fallback': True,
        },
        {
            'public': True,
            'code': 'en',
            'hide_untranslated': False,
            'name': gettext('en'),
            'redirect_on_fallback': True,
        },
    ],
}

CMS_TEMPLATES = (
    ## Customize this
    ('fullwidth.html', 'Fullwidth'),
    ('sidebar_left.html', 'Sidebar Left'),
    ('sidebar_right.html', 'Sidebar Right')
)

CMS_PERMISSION = True

CMS_PLACEHOLDER_CONF = {}

DATABASES = {
    'default':
        {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'project.db', 'HOST': 'localhost', 'USER': '', 'PASSWORD': '', 'PORT': ''}
}
Django==1.6.10
Pillow==2.7.0
South==1.0.2
argparse==1.3.0
dj-database-url==0.3.0
django-classy-tags==0.5.2
django-cms==3.0.9
django-mptt==0.6.1
django-reversion==1.8.5
django-sekizai==0.8.1
djangocms-admin-style==0.2.5
djangocms-column==1.5
djangocms-file==0.1
djangocms-flash==0.1
djangocms-googlemap==0.2
djangocms-inherit==0.1
djangocms-installer==0.7.1
djangocms-link==1.5
djangocms-picture==0.1
djangocms-style==1.5
djangocms-teaser==0.1
djangocms-text-ckeditor==2.4.3
djangocms-video==0.1
html5lib==0.999
pytz==2014.10
requests==2.5.1
six==1.9.0
wsgiref==0.1.2