1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 07:41:26 +00:00

Modified upload/update and group i18n

This commit is contained in:
zhengxie
2012-11-05 16:55:39 +08:00
parent 8c0b9cd4d8
commit 64b0f182b4
9 changed files with 101 additions and 38 deletions

View File

@@ -3,6 +3,7 @@ import os
from django import forms
from django.utils.translation import ugettext_lazy as _
from seahub.utils import validate_group_name
class MessageForm(forms.Form):
@@ -24,13 +25,13 @@ class GroupAddForm(forms.Form):
A form used to add a new group.
"""
group_name = forms.CharField(max_length=255, error_messages={
'required': u'群组名称不能为空',
'max_length': u'群组名称太长不超过255个字符',
'required': _(u'Group name can\'t be empty'),
'max_length': _(u'Group name is too long (maximum is 255 characters)'),
})
def clean_group_name(self):
group_name = self.cleaned_data['group_name']
if not validate_group_name(group_name):
error_msg = u'群组名称只能包含中英文字符,数字及下划线。'
error_msg = _(u'Group name can only contain letters, numbers or underline')
raise forms.ValidationError(error_msg)
else:
return group_name
@@ -40,7 +41,7 @@ class GroupJoinMsgForm(forms.Form):
A form used to send group join request message.
"""
group_join_msg = forms.CharField(max_length=255, error_messages={
'required': u'验证信息不能为空',
'max_length': u'验证信息太长不超过255个字符',
'required': _(u'Verification message can\'t be empty'),
'max_length': _(u'Verification message is too long (maximun is 255 characters)'),
})

View File

@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-03 11:50+0800\n"
"POT-Creation-Date: 2012-11-05 16:43+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"
@@ -57,6 +57,26 @@ msgstr "只有群组管理员可以删除成员。"
msgid "Can not remove myself"
msgstr "无法删除自己"
#: forms.py:28
msgid "Group name can't be empty"
msgstr "群组名称不能为空"
#: forms.py:29
msgid "Group name is too long (maximum is 255 characters)"
msgstr "群组名称太长不超过255个字符"
#: forms.py:34
msgid "Group name can only contain letters, numbers or underline"
msgstr "群组名称只能包含中英文字符,数字及下划线。"
#: forms.py:44
msgid "Verification message can't be empty"
msgstr "验证信息不能为空"
#: forms.py:45
msgid "Verification message is too long (maximun is 255 characters)"
msgstr "验证信息太长不超过255个字符"
#: views.py:94
msgid "There is already a group with that name."
msgstr "已有同名群组"
@@ -288,7 +308,7 @@ msgstr "取消共享"
msgid "Messages"
msgstr "信息栏"
#: templates/group/group_info.html:120
#: templates/group/group_info.html:120 templates/group/group_pubinfo.html:24
#: templates/group/groups_right_panel.html:33
#: templates/group/grpmember_add_form.html:12
#: templates/group/grpmember_add_form.html:19
@@ -416,6 +436,31 @@ msgstr "添加管理员"
msgid "Really want to dismiss this group?"
msgstr "确定要解散该群组?"
#: templates/group/group_pubinfo.html:9
msgid "Join Group"
msgstr "申请加入"
#: templates/group/group_pubinfo.html:13
msgid "Name: "
msgstr "名字:"
#: templates/group/group_pubinfo.html:14
#: templates/group/groups_right_panel.html:17
msgid "Creator: "
msgstr "创建者:"
#: templates/group/group_pubinfo.html:15
msgid "Create at: "
msgstr "创建于:"
#: templates/group/group_pubinfo.html:16
msgid "Members: "
msgstr "成员数:"
#: templates/group/group_pubinfo.html:21
msgid "Verification Message"
msgstr "验证消息"
#: templates/group/group_reply_list.html:17
msgid "It can not be blank and should be no more than 150 characters."
msgstr "输入不能为空且应少于150个字符。"
@@ -441,10 +486,6 @@ msgstr "我的群组"
msgid "New Group"
msgstr "新建群组"
#: templates/group/groups_right_panel.html:17
msgid "Creator: "
msgstr "创建者:"
#: templates/group/groups_right_panel.html:18
msgid "Time: "
msgstr "创建时间:"

View File

@@ -1,27 +1,27 @@
{% extends "myhome_base.html" %}
{% load seahub_tags group_avatar_tags %}
{% load seahub_tags group_avatar_tags i18n %}
{% load url from future %}
{% block main_panel %}
<div class="user-profile narrow-panel ovhd">
<div class="pic fleft">
<img src="{% grp_avatar_url group.id 48 %}" alt="{{ group.group_name }}的图标" title="{{ group.group_name }}" class="avatar" />
<button id="add">申请加入</button>
<button id="add">{% trans "Join Group" %}</button>
</div>
<div class="txt fright">
<p>名称:{{ group.group_name }}</p>
<p>管理员:{{ group.creator_name }}</p>
<p>创建于:{{ group.timestamp|tsstr_sec }}</p>
<p>人数:{{ members|length }}</p>
<p>{% trans "Name: " %}{{ group.group_name }}</p>
<p>{% trans "Creator: " %}{{ group.creator_name }}</p>
<p>{% trans "Create at: " %}{{ group.timestamp|tsstr_sec }}</p>
<p>{% trans "Members: " %}{{ members|length }}</p>
</div>
</div>
<form id="group-join-form" class="hide" action="" method="post">
<label>验证信息:</label><br />
<label>{% trans "Verification Message" %}</label><br />
<textarea id="id_group_join_msg" name="group_join_msg"></textarea><br />
<p class="error hide"></p>
<input type="submit" value="提交" id="group-join-submit" />
<input type="submit" value="{% trans "Submit" %}" id="group-join-submit" />
</form>
{% endblock %}
@@ -32,6 +32,9 @@ $('#add').click(function() {
});
$('#group-join-submit').click(function() {
var self = $(this);
self.attr('disabled', 'disabled');
$.ajax({
url: '{% url 'group_joinrequest' group.id %}',
type: 'POST',
@@ -42,6 +45,7 @@ $('#group-join-submit').click(function() {
'group_join_msg': $('#id_group_join_msg').val(),
},
success: function(data) {
self.removeAttr('disabled');
location.reload(true);
},
error: function(data, textStatus, jqXHR) {
@@ -53,6 +57,7 @@ $('#group-join-submit').click(function() {
apply_form_error('group-join-form', value[0]);
}
});
self.removeAttr('disabled');
}
});

Binary file not shown.

View File

@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-05 14:20+0800\n"
"POT-Creation-Date: 2012-11-05 16:52+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"
@@ -212,8 +212,7 @@ msgstr "未知错误"
#: views.py:842 views.py:858
msgid ""
"Failed to remove library. Only staff or owner can perform this operation."
msgstr ""
"删除资料库失败, 只有团体管理员或资料库创建者有权删除资料库。"
msgstr "删除资料库失败, 只有团体管理员或资料库创建者有权删除资料库。"
#: views.py:1108
msgid "Failed to create repo"
@@ -671,25 +670,25 @@ msgstr "已用空间"
msgid "My Home"
msgstr "我的页面"
#: templates/myhome_base.html:12 templates/org_base.html:12
msgid "Public Library"
msgstr "公共资料"
#: templates/myhome_base.html:16 templates/org_admin_base.html:14
#: templates/myhome_base.html:11 templates/org_admin_base.html:14
#: templates/org_base.html:15 templates/pubinfo.html:22
msgid "Groups"
msgstr "群组"
#: templates/myhome_base.html:19 templates/org_base.html:18
#: templates/myhome_base.html:14 templates/org_base.html:18
#: templates/snippets/my_owned_repos.html:35
msgid "Share"
msgstr "共享"
#: templates/myhome_base.html:22
#: templates/myhome_base.html:17
msgid "Contacts"
msgstr "通讯录"
#: templates/myhome_base.html:26 templates/org_base.html:21
#: templates/myhome_base.html:21 templates/org_base.html:12
msgid "Public Library"
msgstr "公共资料"
#: templates/myhome_base.html:24 templates/org_base.html:21
msgid "Public Info"
msgstr "公共信息"
@@ -731,7 +730,8 @@ msgstr "小提示"
#: templates/public_home.html:10
msgid ""
"Libraries marked as read-only can only be viewing, can not be downloaded."
"Libraries marked as read-only can only be viewed online, can not be "
"downloaded."
msgstr "标记为只读的资料库只能查看,无法整个下载。"
#: templates/public_home.html:15
@@ -1303,6 +1303,22 @@ msgstr "修改前"
msgid "after modification"
msgstr "修改后"
#: templates/update_file_error.html:6
msgid "Update file "
msgstr "更新文件 "
#: templates/update_file_error.html:14 templates/upload_file_error.html:10
msgid "error: "
msgstr "失败:"
#: templates/upload_file_error.html:6
msgid "Upload file"
msgstr "上传文件"
#: templates/upload_file_error.html:6
msgid "to"
msgstr "到"
#: templates/userinfo.html:13
msgid "Profile"
msgstr "设置"

View File

@@ -7,7 +7,7 @@
{% block left_panel %}
<div class="info-item">
<h3 class="info-item-top">{% trans "Tips"%}</h3>
<p class="info-item-bottom">{% trans "Libraries marked as read-only can only be viewing, can not be downloaded."%}</p>
<p class="info-item-bottom">{% trans "Libraries marked as read-only can only be viewed online, can not be downloaded."%}</p>
</div>
{% endblock %}

View File

@@ -1,9 +1,9 @@
{% extends base_template %}
{% load seahub_tags %}
{% load seahub_tags i18n %}
{% block main_panel %}
<div class="narrow-panel">
<h3>更新文件
<h3>{% trans "Update file " %}
{% for name, link in zipped %}
{% if not forloop.last %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> /
@@ -11,7 +11,7 @@
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a>
{% endif %}
{% endfor %}
失败:
{% trans "error: " %}
</h3>
<p>{{ err_msg }}</p>
</div>

View File

@@ -1,13 +1,13 @@
{% extends base_template %}
{% load seahub_tags %}
{% load seahub_tags i18n %}
{% block main_panel %}
<div class="narrow-panel">
<h3>上传文件{% if filename %} {{ filename }} {% endif %}
<h3>{% trans "Upload file" %} {% if filename %} {{ filename }} {% endif %} {% trans "to" %}
{% for name, link in zipped %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> /
{% endfor %}
失败:
{% trans "error: " %}
</h3>
<p>{{ err_msg }}</p>
</div>