编辑:发现这是在 djangocms-installer 生成的非常基本的项目中发生的,我已经报告了an issue about this。
我使用django-cms设置了一个简单的项目,我的客户端的母语是french
。感谢Transifex,法语翻译始终是最新的。不太清楚为什么,与django-cms应用程序相关的所有内容都没有被翻译(管理中的字符串,管理工具栏等)。
“双击编辑”,“创建页面”等字符串仍然是英文版,即使当前登录用户的设置已设置为法语(Accueil › Cms › User settings › gableroux)
。
请注意,管理中的所有其他字符串都将转换为法语
管理de Django
Bienvenue,gableroux。修改器le mot de passe /Déconnexion
现场管理
等
*请注意,我没有在生产中使用这些设置,这是我为此特定问题生成的示例项目,SECRET_KEY
未在任何地方使用;)
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
答案 0 :(得分:3)
为了记录,这个问题已经在django-cms项目Github上解决了:https://github.com/divio/django-cms/issues/3798
最终答案(一旦应用删除了语言环境fr_FR
的补丁)是重新启动服务器 - 只有在重新启动服务器时才考虑区域设置。