1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-28 03:10:45 +00:00

Added i18n form login and myhome page

This commit is contained in:
zhengxie 2012-10-26 19:15:52 +08:00
parent 0106d08911
commit f76f396937
26 changed files with 468 additions and 129 deletions

View File

@ -329,7 +329,7 @@ class RegistrationForm(forms.Form):
if not emailuser:
return self.cleaned_data['email']
else:
raise forms.ValidationError("该邮箱已被注册")
raise forms.ValidationError(_("A user with this email already"))
def clean_userid(self):
if self.cleaned_data['userid'] and len(self.cleaned_data['userid']) != 40:
@ -346,6 +346,6 @@ class RegistrationForm(forms.Form):
"""
if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError("两次输入的密码不一致")
raise forms.ValidationError(_("The two password fields didn't match."))
return self.cleaned_data

View File

@ -25,6 +25,7 @@ def base(request):
base_template = request.base_template
except AttributeError:
base_template = 'myhome_base.html'
return {
'seafile_version': SEAFILE_VERSION,
'seahub_title': SEAHUB_TITLE,

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-23 16:30+0800\n"
"POT-Creation-Date: 2012-10-26 16:01+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -62,43 +62,43 @@ msgstr "无法删除自己"
msgid "The group name has been occupied."
msgstr "名称重复,请重新输入。"
#: views.py:563
#: views.py:564
#, python-format
msgid "Failed to add group member, %s is not in current organization."
msgstr "添加成员失败,%s 未在当前团体中。"
#: views.py:597
#: views.py:598
msgid "Failed to send mail."
msgstr "邮件发送失败。"
#: views.py:614
#: views.py:615
#, python-format
msgid "Failed to add group member, %s is not registerd."
msgstr "添加成员失败,%s 未注册。"
#: views.py:627
#: views.py:628
msgid "Successfully added group member(s). An email has been sent to user(s)."
msgstr "添加群组成员成功,邀请邮件已发送。"
#: views.py:629
#: views.py:630
msgid "Successfully added group member(s)."
msgstr "添加群组成员成功。"
#: views.py:795
#: views.py:796
msgid "Recommend error: wrong group id"
msgstr "推荐失败群组id不正确"
#: views.py:803
#: views.py:804
#, python-format
msgid "Recommend to %s error: you are not in that group"
msgstr "推荐到 %s 失败:未参加该群组"
#: views.py:823
#: views.py:824
#, python-format
msgid ""
"Recommend to <a href=\"%(url)s\" target=\"_blank\">%(name)s</a> success。"
msgstr "推荐到<a href=\"%(url)s\" target=\"_blank\">%(name)s</a>成功"
#: views.py:828
#: views.py:829
msgid "Recommend failed"
msgstr "推荐失败"

Binary file not shown.

View File

@ -0,0 +1,27 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-26 17:04+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
#: templates/group/po.js:4
msgid "Confirm to quit group?"
msgstr "确定要退出?"
#: templates/group/po.js:5
msgid "Confirm to unshare this repo?"
msgstr "确定要取消共享?"

View File

@ -1,29 +0,0 @@
{% extends "myhome_base.html" %}
{% load url from future %}
{% block nav_deptgroup_class %}class="cur"{% endblock %}
{% block left_panel %}
<!-- 操作 -->
{% include "group/groups_left_panel.html" %}
{% endblock %}
{% block right_panel %}
<!-- 部门 -->
<h3>部门</h3>
{% include "group/groups_right_panel.html" %}
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
$("#group-add").click(function() {
$("#group-add-form").modal({appendTo: "#main"});
return false;
});
{% url 'dept_group_list' as group_add_url %}
{% with post_url=group_add_url %}
{% include "snippets/group_add_js.html" %}
{% endwith %}
</script>
{% endblock %}

View File

@ -191,8 +191,8 @@
{% block extra_script %}
{% include 'snippets/user_profile_js.html' %}
<script type="text/javascript">
addConfirmTo($('#quit-group'), '确定要退出?');
addConfirmTo($('.cancel-share'), '确定要取消共享该资料库?');
addConfirmTo($('#quit-group'), gettext('Confirm to quit group?'));
addConfirmTo($('.cancel-share'), 'Confirm to unshare this repo?');
addAtAutocomplete('#message', '#group-message-form', {{ group.id }}, "{% url 'group_attention' %}", {'border':'1px solid #ddd', 'width':'600px', 'height': '80px', 'word-wrap':'break-word', 'overflow-y':'auto', 'line-height': '1.5em'}); // remember to add unit (px or em) to line-height, as js in ie will take 1.5 as 1.5, not 1.5em

View File

@ -0,0 +1,6 @@
var msg = '';
// group_info.html
msg = gettext('Confirm to quit group?');
msg = gettext('Confirm to unshare this repo?');

View File

@ -1,6 +1,11 @@
#!/bin/sh
# Ignore all apps
# .py and .html i18n
django-admin.py makemessages -l zh_CN -e py,html -i "thirdpart*" -i "api*" -i "avatar*" -i "base*" -i "contacts*" -i "group*" -i "notifications*" -i "organizations*" -i "profile*" -i "share*"
# js i18n
django-admin.py makemessages -d djangojs -l zh_CN -i "thirdpart*" -i "api*" -i "avatar*" -i "base*" -i "contacts*" -i "group*" -i "notifications*" -i "organizations*" -i "profile*" -i "share*"
django-admin.py compilemessages

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-20 16:19+0800\n"
"POT-Creation-Date: 2012-10-26 18:02+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -26,10 +26,155 @@ msgstr ""
msgid "The two password fields didn't match."
msgstr ""
#: settings.py:93
msgid "English"
msgstr ""
#: settings.py:94
msgid "Simplified Chinese"
msgstr ""
#: templates/base.html:59
msgid "Welcome,"
msgstr "欢迎,"
#: templates/base.html:60
msgid "Profile"
msgstr "设置"
#: templates/base.html:61 templates/registration/logout.html:4
msgid "Log Out"
msgstr "退出"
#: templates/base.html:63 templates/registration/login.html:3
#: templates/registration/login.html:6
msgid "Log In"
msgstr "登录"
#: templates/base.html:64 templates/registration/registration_form.html:3
#: templates/registration/registration_form.html:9
msgid "Register"
msgstr "注册"
#: templates/base.html:106
msgid "Introduction"
msgstr "介绍"
#: templates/base.html:108
msgid "Forum"
msgstr "论坛"
#: templates/base.html:112
msgid "Client"
msgstr "客户端"
#: templates/base.html:118
msgid "Documents"
msgstr "文档"
#: templates/base.html:120
msgid "Help"
msgstr "使用帮助"
#: templates/base.html:126
msgid "Server Version: "
msgstr "服务器版本:"
#: templates/base.html:127
msgid "Seafile"
msgstr "海文互知"
#: templates/base.html:128
msgid "Contact Us"
msgstr "联系我们"
#: templates/myhome.html:9
msgid "My Basic Infos"
msgstr "我的基本信息"
#: templates/myhome.html:15
msgid "Nickname is empty"
msgstr "暂无昵称"
#: templates/myhome.html:15
msgid "Edit"
msgstr "编辑"
#: templates/myhome.html:22
msgid "Reminders..."
msgstr "提醒..."
#: templates/myhome.html:26
msgid "Group"
msgstr "群组"
#: templates/myhome.html:30
msgid "have new message"
msgstr "有新留言"
#: templates/myhome.html:34
msgid "group message has new reply"
msgstr "条群组留言有新回复"
#: templates/myhome.html:37
msgid "org messages"
msgstr "团体消息"
#: templates/myhome.html:44
msgid "Storage Used"
msgstr "已用空间"
#: templates/myhome_base.html:8
msgid "My Home"
msgstr "我的页面"
#: templates/myhome_base.html:12
msgid "Public Repo"
msgstr "公共资料"
#: templates/myhome_base.html:16
msgid "Groups"
msgstr "群组"
#: templates/myhome_base.html:19
msgid "Share Admin"
msgstr "共享管理"
#: templates/myhome_base.html:22
msgid "Contacts"
msgstr "通讯录"
#: templates/myhome_base.html:26
msgid "Public Info"
msgstr "公共信息"
#: templates/registration/login.html:8
#: templates/registration/registration_form.html:11
msgid "Email"
msgstr "邮箱"
#: templates/registration/login.html:10
#: templates/registration/registration_form.html:13
msgid "Password"
msgstr "密码"
#: templates/registration/login.html:13
#: templates/registration/registration_form.html:18
msgid "Submit"
msgstr "提交"
#: templates/registration/login.html:14
msgid "Forgot password?"
msgstr "忘记密码"
#: templates/registration/logout.html:8
msgid "Thanks for your participation! "
msgstr "感谢参与!"
#: templates/registration/logout.html:8
msgid "Log in again"
msgstr "重新登录"
#: templates/registration/password_reset_email.html:2
msgid "You're receiving this e-mail because you requested a password reset"
msgstr ""
@ -55,3 +200,91 @@ msgstr ""
#, python-format
msgid "The %(site_name)s team"
msgstr ""
#: templates/registration/registration_form.html:7
msgid "Welcome back, you are already signed in."
msgstr "欢迎回来,您已登录。"
#: templates/registration/registration_form.html:15
msgid "Confirm Password"
msgstr "确认密码"
#: templates/snippets/my_groups.html:3
msgid "My Groups"
msgstr "我的群组"
#: templates/snippets/my_groups.html:16
msgid "Empty"
msgstr "暂无"
#: templates/snippets/my_owned_repos.html:2
msgid "Repos"
msgstr "资料库"
#: templates/snippets/my_owned_repos.html:6
msgid "I owned"
msgstr "我拥有的"
#: templates/snippets/my_owned_repos.html:7
msgid "Share to me"
msgstr "共享给我的"
#: templates/snippets/my_owned_repos.html:9
msgid "New Repo"
msgstr "新建资料库"
#: templates/snippets/my_owned_repos.html:16
#: templates/snippets/my_owned_repos.html:48
msgid "Name"
msgstr "名字"
#: templates/snippets/my_owned_repos.html:17
#: templates/snippets/my_owned_repos.html:49
msgid "Description"
msgstr "描述"
#: templates/snippets/my_owned_repos.html:18
#: templates/snippets/my_owned_repos.html:50
msgid "Update Time"
msgstr "更新时间"
#: templates/snippets/my_owned_repos.html:19
#: templates/snippets/my_owned_repos.html:52
msgid "Operations"
msgstr "操作"
#: templates/snippets/my_owned_repos.html:23
#: templates/snippets/my_owned_repos.html:59
msgid "Read-Write"
msgstr "可读写"
#: templates/snippets/my_owned_repos.html:32
#: templates/snippets/my_owned_repos.html:74
msgid "Download"
msgstr "下载"
#: templates/snippets/my_owned_repos.html:33
msgid "Share"
msgstr "共享"
#: templates/snippets/my_owned_repos.html:34
msgid "Delete"
msgstr "删除"
#: templates/snippets/my_owned_repos.html:51
msgid "Share From"
msgstr "共享来源"
#: templates/snippets/my_owned_repos.html:61
msgid "Read-Only"
msgstr "只读"
#: templates/snippets/my_owned_repos.html:76
msgid "Remove Share"
msgstr "取消共享"
#~ msgid "Sign out"
#~ msgstr "退出"
#~ msgid "Sign in"
#~ msgstr "登录"

Binary file not shown.

View File

@ -0,0 +1,23 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-26 17:21+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
#: po.js:3
msgid "hello"
msgstr "你好"

4
po.js Normal file
View File

@ -0,0 +1,4 @@
var msg = '';

View File

@ -26,7 +26,7 @@ TIME_ZONE = 'Asia/Shanghai'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'zh_CN'
LANGUAGE_CODE = 'en'
SITE_ID = 1
@ -65,6 +65,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'auth.middleware.AuthenticationMiddleware',
'base.middleware.BaseMiddleware',
@ -85,6 +86,17 @@ TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__),'thirdpart/djangorestframework/templates'),
)
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
gettext_noop = lambda s: s
LANGUAGES = (
('en', gettext_noop('English')),
('zh-cn', gettext_noop('Simplified Chinese')),
)
LOCALE_PATHS = (
os.path.join(os.path.dirname(__file__), 'locale'),
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',

View File

@ -1,4 +1,4 @@
{% load seahub_tags avatar_tags %}
{% load seahub_tags avatar_tags i18n %}
{% load url from future %}
<!DOCTYPE html>
@ -56,16 +56,12 @@
<div class="account fright">
{% if request.user.is_authenticated %}
<span>欢迎,</span> <a href="{% url 'avatar_add' %}" class="avatar-link">{% avatar request.user 16 %}</a> <span>{{ request.user }}</span>
<a href="{{ SITE_ROOT }}profile/">设置</a>
<a href="{{ SITE_ROOT }}accounts/logout/">退出</a>
<span>{% trans "Welcome," %}</span> <a href="{% url 'avatar_add' %}" class="avatar-link">{% avatar request.user 16 %}</a> <span>{{ request.user }}</span>
<a href="{{ SITE_ROOT }}profile/">{% trans "Profile" %}</a>
<a href="{{ SITE_ROOT }}accounts/logout/">{% trans "Log Out" %}</a>
{% else %}
<a href="{{ SITE_ROOT }}accounts/login/">登录</a>
{% if account_type == 'business' %}
<a href="{{ SITE_ROOT }}accounts/business/register/">注册</a>
{% else %}
<a href="{{ SITE_ROOT }}accounts/register/">注册</a>
{% endif %}
<a href="{{ SITE_ROOT }}accounts/login/">{% trans "Log In" %}</a>
<a href="{{ SITE_ROOT }}accounts/register/">{% trans "Register" %}</a>
{% endif %}
</div>
</div>
@ -107,28 +103,39 @@
<div class="item">
<h4>SeaCloud</h4>
<ul>
<li><a href="http://seafile.com/" target="_blank">介绍</a></li>
<li><a href="http://seafile.com/" target="_blank">{% trans "Introduction" %}</a></li>
<li><a href="http://wiki.seafile.com.cn/" target="_blank">Wiki</a></li>
<li><a href="http://gonggeng.org/vanilla/" target="_blank">论坛</a></li>
<li><a href="http://gonggeng.org/vanilla/" target="_blank">{% trans "Forum" %}</a></li>
</ul>
</div>
<div class="item">
<h4>客户端</h4>
<h4>{% trans "Client" %}</h4>
<ul>
<li><a href="http://www.seafile.com/download/">Seafile for Windows</a></li>
</ul>
</div>
<div class="item">
<h4>文档</h4>
<h4>{% trans "Documents" %}</h4>
<ul>
<li><a href="http://www.seafile.com/help/" target="_blank">使用帮助</a></li>
<li><a href="http://www.seafile.com/help/" target="_blank">{% trans "Help" %}</a></li>
</ul>
</div>
</div>
<div class="other-info fright">
<p>服务器版本:{{ seafile_version }}</p>
<p>© 2012 海文互知</p>
<p><a href="http://seafile.com/contact/" target="_blank">联系我们</a>
<div class="fleft">
<p>{% trans "Server Version: " %}{{ seafile_version }}</p>
<p>© 2012 {% trans "Seafile" %}</p>
<p><a href="http://seafile.com/contact/" target="_blank">{% trans "Contact Us" %}</a></p>
</div>
<div class="fright">
<a href="#" id="lang-context" data="no-popup">{{ LANGUAGE_CODE|language_name_local }}<span class="tri-bg tri-down-bg"></span></a>
<ul class="hide" id="lang-context-selector">
{% for LANG in LANGUAGES %}
<li><a href="{% url 'i18n' %}?lang={{ LANG.0 }}">{% trans LANG.1 %}</a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
@ -145,12 +152,34 @@
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.cookie.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.placeholder.min.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/utils.js?t=4884491531236"></script>
<script type="text/javascript" src="{% url 'django.views.i18n.javascript_catalog' %}"></script>
<script type="text/javascript">
$(function() {
$('input, textarea').placeholder();
});
$('.top-bar-con .manage').css('width', $('.top-bar-con').width() - $('.top-bar-con .account').width() - 30);
$('#lang-context').click(function() {
if ($(this).attr('data') == 'no-popup') {
$(this).parent().css('position', 'relative');
$('#lang-context-selector').removeClass('hide');
$(this).attr('data', 'has-popup');
} else {
$('#lang-context-selector').addClass('hide');
$(this).attr('data', 'no-popup');
}
return false;
}).focus(function() { $(this).blur(); });
$(document).click(function(e) {
var element = e.target || e.srcElement;
if (element.id != 'lang-context-selector' && element.attrid != 'lang-context') {
$('#lang-context-selector').addClass('hide');
$('#lang-context').attr('data', 'no-popup');
}
});
{% if request.user.is_authenticated %}
{% if request.cur_note %}
@ -199,6 +228,7 @@ $(document).click(function(e) {
});
{% endif %}
{% endif %}
</script>
{% block extra_script %}{% endblock %}

View File

@ -1,47 +1,47 @@
{% extends "myhome_base.html" %}
{% load seahub_tags avatar_tags group_avatar_tags %}
{% load seahub_tags avatar_tags group_avatar_tags i18n %}
{% load url from future %}
{% block nav_myhome_class %}class="cur"{% endblock %}
{% block left_panel %}
<div class="info-item">
<h3 class="info-item-top">我的基本信息</h3>
<h3 class="info-item-top">{% trans "My Basic Infos" %}</h3>
<div class="info-item-bottom home-profile ovhd">
<a href="{{ SITE_ROOT }}profile/" class="no-deco">{% avatar request.user 48 %}</a>
{% if nickname %}
<p class="fleft">{{ nickname }}</p>
{% else %}
<p class="fleft">暂无昵称 <a href="{{ SITE_ROOT }}profile/"><img src="{{ MEDIA_URL }}img/edit_12.png" alt="编辑" title="编辑" /></a></p>
<p class="fleft">{% trans "Nickname is empty" %} <a href="{{ SITE_ROOT }}profile/"><img src="{{ MEDIA_URL }}img/edit_12.png" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" /></a></p>
{% endif %}
</div>
</div>
{% if grpmsg_list or grpmsg_reply_list or orgmsg_list %}
<div class="info-item">
<h3 class="info-item-top">提醒...</h3>
<h3 class="info-item-top">{% trans "Reminders..." %}</h3>
<ul class="info-item-bottom">
{% if grpmsg_list %}
<li>
群组
{% trans "Group" %}
{% for grp in grpmsg_list %}
<a href="{% url 'group_info' grp.id %}" class="no-bold">{{ grp.group_name }}</a>
{% endfor %}
有新留言
{% trans "have new message" %}
</li>
{% endif %}
{% if grpmsg_reply_list %}
<li><a href="{{ SITE_ROOT }}group/reply/new/" class="no-bold">{{ grpmsg_reply_list|length }}条群组留言有新回复</a></li>
<li><a href="{{ SITE_ROOT }}group/reply/new/" class="no-bold">{{ grpmsg_reply_list|length }}{% trans "group message has new reply" %}</a></li>
{% endif %}
{% if orgmsg_list %}
<li><a href="{% url 'org_msg' %}" class="no-bold">{{ orgmsg_list|length }}条团体消息</a></li>
<li><a href="{% url 'org_msg' %}" class="no-bold">{{ orgmsg_list|length }}{% trans "org messages" %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}
<div class="info-item">
<h3 class="info-item-top">已用空间</h3>
<h3 class="info-item-top">{% trans "Storage Used" %}</h3>
<p class="info-item-bottom">{{ quota_usage|filesizeformat }} {% if cloud_mode %}/ 2 GB {% endif %}</p>
</div>
@ -81,6 +81,5 @@
{% if events %}
{% include "snippets/events_js.html" %}
{% endif %}
</script>
{% endblock %}

View File

@ -9,21 +9,21 @@
</li>
{% if not cloud_mode %}
<li>
<a href="{% url 'public_home' %}" {% block nav_publichome_class %}{% endblock %}>公共资料</a>
<a href="{% url 'public_home' %}" {% block nav_publichome_class %}{% endblock %}>{% trans "Public Repo" %}</a>
</li>
{% endif %}
<li>
<a href="{{ SITE_ROOT }}groups/" {% block nav_group_class %}{% endblock %}>群组</a>
<a href="{{ SITE_ROOT }}groups/" {% block nav_group_class %}{% endblock %}>{% trans "Groups" %}</a>
</li>
<li>
<a href="{{ SITE_ROOT }}shareadmin/" {% block nav_shareadmin_class %}{% endblock %}>共享管理</a>
<a href="{{ SITE_ROOT }}shareadmin/" {% block nav_shareadmin_class %}{% endblock %}>{% trans "Share Admin" %}</a>
</li>
<li>
<a href="{{ SITE_ROOT }}contacts/" {% block nav_contacts_class %}{% endblock %}>通讯录</a>
<a href="{{ SITE_ROOT }}contacts/" {% block nav_contacts_class %}{% endblock %}>{% trans "Contacts" %}</a>
</li>
{% if not cloud_mode %}
<li>
<a href="{% url 'seahub.views.pubinfo' %}" {% block nav_pubinfo_class %}{% endblock %}>公共信息</a>
<a href="{% url 'seahub.views.pubinfo' %}" {% block nav_pubinfo_class %}{% endblock %}>{% trans "Public Info" %}</a>
</li>
{% endif %}
</ul>

View File

@ -1,16 +1,17 @@
{% extends "myhome_base.html" %}
{% block title %}登录{% endblock %}
{% load i18n %}
{% block title %}{% trans "Log In" %}{% endblock %}
{% block main_panel %}
<div class="narrow-panel">
<h2>登录</h2>
<h2>{% trans "Log In" %}</h2>
<form action="" method="post" class="login-form">
<label for="username">邮箱:</label>
<label for="username">{% trans "Email" %}</label>
<input type="text" id="id_email" name="username" value="" />
<label for="password">密码:</label>
<label for="password">{% trans "Password" %}</label>
<input type="password" id="id_password" name="password" value="" />
<p class="error hide"></p>
<input type="submit" value="提交" class="submit" />
<a href="{{ SITE_ROOT }}accounts/password/reset/">忘记密码?</a>
<input type="submit" value="{% trans "Submit" %}" class="submit" />
<a href="{{ SITE_ROOT }}accounts/password/reset/">{% trans "Forgot password?" %}</a>
{% if next %}
<input type="hidden" name="next" value="{{ next|escape }}" />
{% else %}

View File

@ -1,9 +1,10 @@
{% extends "myhome_base.html" %}
{% load i18n %}
{% block title %}退出{% endblock %}
{% block title %}{% trans "Log Out" %}{% endblock %}
{% block main_panel %}
<div class="text-panel">
<p>感谢参与。<a href="{{ SITE_ROOT }}accounts/login/">重新登录</a></p>
<p>{% trans "Thanks for your participation! " %}<a href="{{ SITE_ROOT }}accounts/login/">{% trans "Log in again" %}</a></p>
</div>
{% endblock %}

View File

@ -1,23 +1,21 @@
{% extends "myhome_base.html" %}
{% block title %}注册{% endblock %}
{% load i18n %}
{% block title %}{% trans "Register" %}{% endblock %}
{% block main_panel %}
<div class="narrow-panel">
{% if request.user.is_authenticated %}
<h2>欢迎回来,您已登录。</h2>
<h2>{% trans "Welcome back, you are already signed in." %}</h2>
{% else %}
<h2>注册</h2>
<h2>{% trans "Register" %}</h2>
<form action="" method="post">
<label for="id_email">邮箱:</label>
{{ form.email }}
<label for="id_password1">密码:</label>
{{ form.password1 }}
<label for="id_password2">确认密码:</label>
{{ form.password2 }}
<label for="id_email">{% trans "Email" %}</label>
{{ form.email }} {{ form.email.errors }}
<label for="id_password1">{% trans "Password" %}</label>
{{ form.password1 }} {{ form.password1.errors }}
<label for="id_password2">{% trans "Confirm Password" %}</label>
{{ form.password2 }} {{ form.password2.errors }}
<p class="error hide"></p>
{{ form.email.errors }}
{{ form.password1.errors }}
{{ form.password2.errors }}
<input type="submit" value="提交" class="submit" />
<input type="submit" value="{% trans "Submit" %}" class="submit" />
</form>
{% endif %}
</div>
@ -27,19 +25,19 @@
<script type="text/javascript">
$('input[type="submit"]').click(function(){
if (!$.trim($('input[name="email"]').attr('value'))) {
$('.error').removeClass('hide').html('请输入邮箱。');
$('.error').removeClass('hide').html(gettext('Email can\'t be blank'));
return false;
}
if (!$.trim($('input[name="password1"]').attr('value'))) {
$('.error').removeClass('hide').html('请输入密码。');
$('.error').removeClass('hide').html('Password can\'t be blank');
return false;
}
if (!$.trim($('input[name="password2"]').attr('value'))) {
$('.error').removeClass('hide').html('请确认密码。');
$('.error').removeClass('hide').html('Confirm password can\'t be blank');
return false;
}
if ($.trim($('input[name="password1"]').attr('value')) != $.trim($('input[name="password2"]').attr('value'))) {
$('.error').removeClass('hide').html('两次输入的密码不一致。');
$('.error').removeClass('hide').html('The two password fields did\'t match');
return false;
}
});

View File

@ -1,6 +1,6 @@
{% load group_avatar_tags %}
{% load group_avatar_tags i18n %}
<div class="info-item">
<h3 class="info-item-top">我的群组</h3>
<h3 class="info-item-top">{% trans "My Groups" %}</h3>
{% if groups %}
<ul class="info-item-bottom ovhd">
{% for group in groups %}
@ -13,6 +13,6 @@
{% endfor %}
</ul>
{% else %}
<p class="info-item-bottom">暂无</p>
<p class="info-item-bottom">{% trans "Empty" %}</p>
{% endif %}
</div>

View File

@ -1,26 +1,26 @@
{% load seahub_tags %}
<h3>资料库</h3>
{% load seahub_tags i18n %}
<h3>{% trans "Repos" %}</h3>
<div id="repos-tabs">
<div class="ovhd">
<ul class="fleft">
<li><a href="#my-own-repos" onfocus="this.blur()">我拥有的</a></li>
<li><a href="#repos-shared-to-me" onfocus="this.blur()">共享给我的</a></li>
<li><a href="#my-own-repos" onfocus="this.blur()">{% trans "I owned" %}</a></li>
<li><a href="#repos-shared-to-me" onfocus="this.blur()">{% trans "Share to me" %}</a></li>
</ul>
<button id="repo-create" class="fright">新建资料库</button>
<button id="repo-create" class="fright">{% trans "New Repo" %}</button>
</div>
<div id="my-own-repos">
{% if owned_repos %}
<table>
<tr>
<th width="4%"><!--icon--></th>
<th width="24%">名字</th>
<th width="43%">描述</th>
<th width="15%">更新时间</th>
<th width="14%">操作</th>
<th width="24%">{% trans "Name" %}</th>
<th width="43%">{% trans "Description" %}</th>
<th width="15%">{% trans "Update Time" %}</th>
<th width="14%">{% trans "Operations" %}</th>
</tr>
{% for repo in owned_repos %}
<tr>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="可读写" alt="目录icon" /></td>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="目录icon" /></td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
<td>{{ repo.props.desc }}</td>
{% if repo.latest_modify %}
@ -29,9 +29,9 @@
<td>--</td>
{% endif %}
<td>
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.id }}" class="download-btn op-icon vh" title="下载到本地" alt="下载" />
<img src="{{ MEDIA_URL }}img/share-20.png" data="{{ repo.props.id }}" class="repo-share-btn op-icon vh" title="共享" alt="共享" />
<img src="{{ MEDIA_URL }}img/delete-20.png" data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" class="repo-delete-btn op-icon vh" title="删除" alt="删除" />
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.id }}" class="download-btn op-icon vh" title="{% trans "Download" %}" alt="{% trans "Download" %}" />
<img src="{{ MEDIA_URL }}img/share-20.png" data="{{ repo.props.id }}" class="repo-share-btn op-icon vh" title="{% trans "Share" %}" alt="{% trans "Share" %}" />
<img src="{{ MEDIA_URL }}img/delete-20.png" data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}" alt="{% trans "Delete" %}" />
</td>
</tr>
{% endfor %}
@ -45,20 +45,20 @@
<table>
<tr>
<th width="4%"><!--icon--></th>
<th width="20%">名字</th>
<th width="36%">描述</th>
<th width="15%">更新时间</th>
<th width="15%">共享来源</th>
<th width="10%">操作</th>
<th width="20%">{% trans "Name" %}</th>
<th width="36%">{% trans "Description" %}</th>
<th width="15%">{% trans "Update Time" %}</th>
<th width="15%">{% trans "Share From" %}</th>
<th width="10%">{% trans "Operations" %}</th>
</tr>
{% for repo in in_repos %}
<tr>
<td>
{% if repo.user_perm == 'rw' %}
<img src="{{MEDIA_URL}}img/sync-folder-20.png" title="可读写" alt="目录icon" />
<img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="目录icon" />
{% else %}
<img src="{{MEDIA_URL}}img/folder-no-write-20.png" title="只读" alt="目录icon" />
<img src="{{MEDIA_URL}}img/folder-no-write-20.png" title="{% trans "Read-Only" %}" alt="目录icon" />
{% endif %}
</td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.repo_id }}">{{ repo.props.repo_name }}</a></td>
@ -71,9 +71,9 @@
<td>{{ repo.props.user|email2nickname }}</td>
<td>
{% if repo.user_perm == 'rw' %}
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.repo_id }}" class="download-btn op-icon vh" title="下载到本地" alt="下载" />
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.repo_id }}" class="download-btn op-icon vh" title="{% trans "Download" %}" alt="{% trans "Download" %}" />
{% endif %}
<img src="{{ MEDIA_URL }}img/delete-20.png" data="{{ SITE_ROOT }}shareadmin/removeshare/?repo_id={{ repo.props.repo_id }}&from={{ repo.props.user }}&to={{ request.user }}" class="unshare-btn op-icon vh" title="取消共享" alt="取消共享" />
<img src="{{ MEDIA_URL }}img/delete-20.png" data="{{ SITE_ROOT }}shareadmin/removeshare/?repo_id={{ repo.props.repo_id }}&from={{ repo.props.user }}&to={{ request.user }}" class="unshare-btn op-icon vh" title="{% trans "Remove Share" %}" alt="{% trans "Remove Share" %}" />
</td>
</tr>
{% endfor %}

13
urls.py
View File

@ -74,7 +74,8 @@ urlpatterns = patterns('',
(r'^pdf_full_view/$', pdf_full_view),
url(r'^repo/(?P<repo_id>[^/]+)/(?P<obj_id>[^/]+)/$', repo_access_file, name='repo_access_file'),
(r'^pubinfo/$', pubinfo),
(r'^pubinfo/$', pubinfo),
url(r'^i18n/$', i18n, name='i18n'),
(r'^download/repo/$', repo_download),
(r'^file/move/get_subdir/$', get_subdir),
(r'^file/move/$', file_move),
@ -125,3 +126,13 @@ else:
url(r'^home/public/$', public_home, name='public_home'),
)
# i18n in javascript
js_info_dict = {
'domain': 'djangojs',
'packages': (
'seahub.group',
),
}
urlpatterns += patterns('',
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
)

View File

@ -2710,3 +2710,20 @@ def text_diff(request, repo_id):
'is_new_file': is_new_file,
}, context_instance=RequestContext(request))
def i18n(request):
"""
Set client language preference, lasts for one month
"""
from django.conf import settings
next = request.META.get('HTTP_REFERER', None)
if not next:
next = settings.SITE_ROOT
lang = request.GET.get('lang', 'en')
res = HttpResponseRedirect(next)
res.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang, max_age=30*24*60*60)
return res