From 43792515ba6b4093b2b479e4bdb274c670c15d56 Mon Sep 17 00:00:00 2001 From: Mike Chen Date: Thu, 9 Jul 2009 23:44:48 +0800 Subject: translate header, index and footer pages --- context.py | 9 ++ locale/zh_CN/LC_MESSAGES/django.mo | Bin 6519 -> 8581 bytes locale/zh_CN/LC_MESSAGES/django.po | 180 +++++++++++++++++++++++++++++++++++-- settings.py | 42 +++------ settings_local.py.dist | 4 + templates/base.html | 9 +- templates/base_content.html | 13 +-- templates/footer.html | 16 ++-- templates/header.html | 37 ++++---- templates/index.html | 53 ++++++----- templates/logout.html | 9 +- 11 files changed, 267 insertions(+), 105 deletions(-) create mode 100644 context.py diff --git a/context.py b/context.py new file mode 100644 index 00000000..f420b154 --- /dev/null +++ b/context.py @@ -0,0 +1,9 @@ +from django.conf import settings +def application_settings(context): + return { + 'APP_TITLE' : settings.APP_TITLE, + 'APP_URL' : settings.APP_URL, + 'APP_KEYWORDS' : settings.APP_KEYWORDS, + 'APP_DESCRIPTION' : settings.APP_DESCRIPTION, + 'APP_INTRO' : settings.APP_INTRO + } diff --git a/locale/zh_CN/LC_MESSAGES/django.mo b/locale/zh_CN/LC_MESSAGES/django.mo index 13786a3a..3b86743b 100644 Binary files a/locale/zh_CN/LC_MESSAGES/django.mo and b/locale/zh_CN/LC_MESSAGES/django.mo differ diff --git a/locale/zh_CN/LC_MESSAGES/django.po b/locale/zh_CN/LC_MESSAGES/django.po index 9f15a3e7..160a3a64 100644 --- a/locale/zh_CN/LC_MESSAGES/django.po +++ b/locale/zh_CN/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-05 12:30+0000\n" +"POT-Creation-Date: 2009-07-09 15:42+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,11 +16,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: settings.py:24 +#: settings.py:12 msgid "account/" msgstr "" -#: settings.py:24 django_authopenid/urls.py:9 django_authopenid/urls.py:11 +#: settings.py:12 django_authopenid/urls.py:9 django_authopenid/urls.py:11 msgid "signin/" msgstr "" @@ -104,7 +104,7 @@ msgstr "" msgid "非法OpenID地址: %s" msgstr "" -#: django_authopenid/views.py:366 +#: django_authopenid/views.py:366 templates/index.html:78 msgid "Welcome" msgstr "欢迎" @@ -229,7 +229,7 @@ msgstr "用户收藏的问题" msgid "Favorites - User Profile" msgstr "收藏-用户资料" -#: forum/user.py:60 +#: forum/user.py:60 templates/index.html:46 msgid "Votes" msgstr "投票" @@ -254,9 +254,176 @@ msgid "Preferences - User Profile" msgstr "设置-用户资料" #: templates/badges.html:5 templates/badges.html.py:16 +#: templates/header.html:31 msgid "Badges" msgstr "奖牌榜" +#: templates/base.html:53 templates/base_content.html:52 +msgid "Congratulations! You have new badges: " +msgstr "恭喜您被授予奖牌:" + +#: templates/base.html:54 templates/base_content.html:53 +msgid "go to see" +msgstr "查看" + +#: templates/base.html:55 templates/base_content.html:54 +#: templates/header.html:35 +msgid "Profile" +msgstr "我的资料" + +#: templates/footer.html:5 templates/header.html:10 templates/index.html:81 +msgid "About us" +msgstr "关于我们" + +#: templates/footer.html:6 templates/header.html:11 +msgid "faq" +msgstr "常见问题" + +#: templates/footer.html:8 +msgid "Contact" +msgstr "联系我们" + +#: templates/footer.html:9 +msgid "Privacy" +msgstr "隐私政策" + +#: templates/footer.html:10 +msgid "Feedback" +msgstr "用户反馈" + +#: templates/header.html:6 templates/logout.html:5 templates/logout.html.py:16 +msgid "Logout" +msgstr "退出登录" + +#: templates/header.html:8 +msgid "Login" +msgstr "登录" + +#: templates/header.html:21 +msgid "link to homepage" +msgstr "返回首页" + +#: templates/header.html:27 templates/header.html.py:56 +#: templates/index.html:21 +msgid "Questions" +msgstr "问题" + +#: templates/header.html:28 templates/header.html.py:57 +msgid "Tags" +msgstr "标签" + +#: templates/header.html:29 templates/header.html.py:58 +msgid "Users" +msgstr "用户" + +#: templates/header.html:30 +msgid "Books" +msgstr "读书" + +#: templates/header.html:32 +msgid "Unanswered" +msgstr "没有回答的问题" + +#: templates/header.html:38 +msgid "Ask a question" +msgstr "我要提问" + +#: templates/header.html:53 +msgid "Search" +msgstr "搜索" + +#: templates/index.html:6 +msgid "Home" +msgstr "首页" + +#: templates/index.html:23 +msgid "Newest updated questions" +msgstr "最新更新的问题" + +#: templates/index.html:23 +msgid "Newest" +msgstr "最新问题" + +#: templates/index.html:24 +msgid "Questions with most answers" +msgstr "被回复最多的问题" + +#: templates/index.html:24 +msgid "Hottest" +msgstr "最热问题" + +#: templates/index.html:25 +msgid "Questions with most votes" +msgstr "被投票最多的问题" + +#: templates/index.html:25 +msgid "Best" +msgstr "最有价值问题" + +#: templates/index.html:26 templates/index.html.py:118 +msgid "All questions" +msgstr "所有问题" + +#: templates/index.html:26 +msgid "All" +msgstr "所有问题" + +#: templates/index.html:45 +msgid "Answers" +msgstr "回答" + +#: templates/index.html:47 +msgid "Visits" +msgstr "访问" + +#: templates/index.html:55 +msgid "Community wiki" +msgstr "社区wiki" + +#: templates/index.html:67 templates/index.html.py:91 +msgid "Browse questions with tag of " +msgstr "查看所有以下主题问题:" + +#: templates/index.html:87 +msgid "Recent tags" +msgstr "最新标签" + +#: templates/index.html:94 templates/index.html.py:118 +msgid "Popular tags" +msgstr "受欢迎的标签" + +#: templates/index.html:98 +msgid "Recent badges" +msgstr "最新奖牌" + +#: templates/index.html:109 +msgid "All badges" +msgstr "所有奖牌" + +#: templates/index.html:113 +msgid "RSS feed of recent 30 questions" +msgstr "RSS订阅最新30个问题" + +#: templates/index.html:113 +msgid "Subscribe" +msgstr "订阅最新问题" + +#: templates/index.html:118 +msgid "Are you looking for more questions? Try to browse" +msgstr "在寻找更多问题吗?请查阅" + +#: templates/index.html:118 +msgid " or " +msgstr " 或者 " + +#: templates/index.html:118 +msgid ". Please help us answer " +msgstr "。请帮助我们回答" + +#: templates/index.html:118 +msgid "Unanswered questions" +msgstr "没有回答的问题" + #: templates/authopenid/changeemail.html:10 msgid "Account: change email" msgstr "修改电子邮件" @@ -408,9 +575,6 @@ msgstr "删除您的帐号和所有内容" #~ msgid "A new account" #~ msgstr "新帐号" -#~ msgid "Username" -#~ msgstr "用户名" - #~ msgid "An exisiting account" #~ msgstr "已经存在的帐号" diff --git a/settings.py b/settings.py index 50579cb9..985de51a 100644 --- a/settings.py +++ b/settings.py @@ -1,26 +1,22 @@ +# encoding:utf-8 # Django settings for lanai project. import os.path +#DEBUG SETTINGS DEBUG = True TEMPLATE_DEBUG = DEBUG - INTERNAL_IPS = ('127.0.0.1',) - #for OpenID auth ugettext = lambda s: s LOGIN_URL = '/%s%s' % (ugettext('account/'), ugettext('signin/')) -#system will send admins email about error stacktrace if DEBUG=False +#EMAIL AND ADMINS ADMINS = ( ('CNProg team', 'team@cnprog.com'), ) MANAGERS = ADMINS -DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. - SERVER_EMAIL = 'webmaster@cnprog.com' DEFAULT_FROM_EMAIL = 'webmaster@cnprog.com' EMAIL_HOST_USER = '' @@ -30,33 +26,21 @@ EMAIL_HOST='smtp.gmail.com' EMAIL_PORT='587' EMAIL_USE_TLS=True -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# If running in a Windows environment this must be set to the same as your -# system time zone. +#LOCALIZATIONS TIME_ZONE = 'Asia/Chongqing Asia/Chungking' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -#LANGUAGE_CODE = 'en-us' +# LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'zh-cn' - SITE_ID = 1 - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. USE_I18N = True - -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". +#OTHER SETTINS +APP_TITLE = u'CNProg.com 程序员问答社区' +APP_URL = 'http://www.cnprog.com' +APP_KEYWORDS = u'技术问答社区,中国程序员,编程技术社区,程序员社区,程序员论坛,程序员wiki,程序员博客' +APP_DESCRIPTION = u'中国程序员的编程技术问答社区。我们做专业的、可协作编辑的技术问答社区。' +APP_INTRO = u'

CNProg是一个面向程序员的可协作编辑的开放源代码问答社区

您可以在这里提问各类程序技术问题 - 问题不分语言和平台。 同时也希望您对力所能及的问题,给予您的宝贵答案。

' ADMIN_MEDIA_PREFIX = '/admin/media/' - -# Make this unique, and don't share it with anybody. SECRET_KEY = '$oo^&_m&qwbib=(_4m_n*zn-d=g#s0he5fx9xonnym#8p6yigm' - # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', @@ -73,12 +57,13 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.transaction.TransactionMiddleware', #'django.middleware.sqlprint.SqlPrintingMiddleware', 'middleware.pagesize.QuestionsPageSizeMiddleware', - 'debug_toolbar.middleware.DebugToolbarMiddleware', + #'debug_toolbar.middleware.DebugToolbarMiddleware', ) TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'django.core.context_processors.auth', + 'context.application_settings' ) ROOT_URLCONF = 'urls' @@ -87,6 +72,7 @@ TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'), ) +#UPLOAD SETTINGS FILE_UPLOAD_TEMP_DIR = os.path.join(os.path.dirname(__file__), 'tmp').replace('\\','/') FILE_UPLOAD_HANDLERS = ("django.core.files.uploadhandler.MemoryFileUploadHandler", "django.core.files.uploadhandler.TemporaryFileUploadHandler",) diff --git a/settings_local.py.dist b/settings_local.py.dist index 96f28b4e..2c8f939d 100644 --- a/settings_local.py.dist +++ b/settings_local.py.dist @@ -6,6 +6,10 @@ LOG_FILENAME = '/Users/sailing/Development/cnprog_beta2/django.lanai.log' logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG,) +#Database configuration +DATABASE_ENGINE = 'mysql' +DATABASE_HOST = '' +DATABASE_PORT = '' DATABASE_NAME = 'cnprog' # Or path to database file if using sqlite3. DATABASE_USER = 'root' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. diff --git a/templates/base.html b/templates/base.html index 3ed3b3f4..90b40612 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,8 +1,9 @@ {% load extra_filters %} +{% load i18n %} - {% block title %}{% endblock %} - CNProg.com 程序员问答社区 + {% block title %}{% endblock %} - {{ APP_TITLE }} {% spaceless %} {% block meta %}{% endblock %} {% endspaceless %} @@ -49,9 +50,9 @@ {% include "header.html" %} diff --git a/templates/base_content.html b/templates/base_content.html index 7fec09ed..6dec6cae 100644 --- a/templates/base_content.html +++ b/templates/base_content.html @@ -1,7 +1,8 @@ - +{% load i18n %} + - {% block title %}{% endblock %} - CNProg.com 程序员问答社区 + {% block title %}{% endblock %} - {{ APP_TITLE }} @@ -48,10 +49,10 @@ {% include "header.html" %}
diff --git a/templates/footer.html b/templates/footer.html index 2e3d6293..46649b9f 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -1,23 +1,21 @@ {% load extra_tags %} - +{% load i18n %} - \ No newline at end of file + diff --git a/templates/header.html b/templates/header.html index b362a5e6..1da107b6 100644 --- a/templates/header.html +++ b/templates/header.html @@ -1,13 +1,14 @@ {% load extra_tags %} +{% load i18n %}
@@ -17,24 +18,24 @@ @@ -49,16 +50,16 @@
- +
- 问题 - 标签 - 用户 + {% trans "Questions" %} + {% trans "Tags" %} + {% trans "Users" %}
-
\ No newline at end of file + diff --git a/templates/index.html b/templates/index.html index bc159ca9..ba3e2229 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,9 +2,10 @@ {% load extra_tags %} {% load humanize %} {% load extra_filters %} -{% block title %}{% spaceless %}首页{% endspaceless %}{% endblock %} -{% block meta %} - {% endblock %} +{% load i18n %} +{% block title %}{% spaceless %}{% trans "Home" %}{% endspaceless %}{% endblock %} +{% block meta %} + {% endblock %} {% block forejs %}