mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 22:33:17 +00:00
Fixed time plural display and change tag name
This commit is contained in:
Binary file not shown.
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-10-27 14:27+0800\n"
|
||||
"POT-Creation-Date: 2012-11-05 17:20+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"
|
||||
@@ -50,19 +50,38 @@ msgstr ""
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr ""
|
||||
|
||||
#: templatetags/seahub_tags.py:116
|
||||
#: templatetags/seahub_tags.py:123
|
||||
#, python-format
|
||||
msgid "%d days ago"
|
||||
msgstr "%d 天前"
|
||||
msgid "%(days)d day ago"
|
||||
msgid_plural "%(days)d days ago"
|
||||
msgstr[0] "%(days)d 天前"
|
||||
|
||||
#: templatetags/seahub_tags.py:118
|
||||
msgid "%d hours ago"
|
||||
msgstr "%d 小时前"
|
||||
#: templatetags/seahub_tags.py:130
|
||||
#, python-format
|
||||
msgid "%(hours)d hour ago"
|
||||
msgid_plural "%(hours)d hours ago"
|
||||
msgstr[0] "%(hours)d 小时前"
|
||||
|
||||
#: templatetags/seahub_tags.py:120
|
||||
msgid "%d minutes ago"
|
||||
msgstr "%d 分钟前"
|
||||
#: templatetags/seahub_tags.py:137
|
||||
#, python-format
|
||||
msgid "%(minutes)d minute ago"
|
||||
msgid_plural "%(minutes)d minutes ago"
|
||||
msgstr[0] "%(minutes)d 分钟前"
|
||||
|
||||
#: templatetags/seahub_tags.py:122
|
||||
msgid "%d seconds ago"
|
||||
msgstr "%d 秒前"
|
||||
#: templatetags/seahub_tags.py:143
|
||||
#, python-format
|
||||
msgid "%(seconds)d second ago"
|
||||
msgid_plural "%(seconds)d seconds ago"
|
||||
msgstr[0] "%(seconds)d 秒前"
|
||||
|
||||
#: templatetags/seahub_tags.py:148
|
||||
msgid "0 second ago"
|
||||
msgstr "0 秒前"
|
||||
|
||||
#: templatetags/seahub_tags.py:214
|
||||
msgid "Read-Write"
|
||||
msgstr "可读写"
|
||||
|
||||
#: templatetags/seahub_tags.py:216
|
||||
msgid "Read-Only"
|
||||
msgstr "只读"
|
||||
|
@@ -8,6 +8,7 @@ from django.core.cache import cache
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils import translation
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ungettext
|
||||
|
||||
from profile.models import Profile
|
||||
from profile.settings import NICKNAME_CACHE_TIMEOUT, NICKNAME_CACHE_PREFIX
|
||||
@@ -98,9 +99,9 @@ def translate_commit_desc(value):
|
||||
|
||||
return '\n'.join(ret_list)
|
||||
|
||||
@register.filter(name='translate_commit_time')
|
||||
def translate_commit_time(value):
|
||||
"""Translate commit time to human frindly format instead of timestamp"""
|
||||
@register.filter(name='translate_seahub_time')
|
||||
def translate_seahub_time(value):
|
||||
"""Translate seahub time to human friendly format instead of timestamp"""
|
||||
|
||||
if isinstance(value, int) or isinstance(value, long): # check whether value is int
|
||||
val = datetime.fromtimestamp(value)
|
||||
@@ -118,24 +119,44 @@ def translate_commit_time(value):
|
||||
if days * 24 * 60 * 60 + seconds > limit:
|
||||
return val.strftime("%Y-%m-%d")
|
||||
elif days > 0:
|
||||
return _(u'%d days ago') % (days)
|
||||
ret = ungettext(
|
||||
'%(days)d day ago',
|
||||
'%(days)d days ago',
|
||||
days ) % { 'days': days }
|
||||
return ret
|
||||
elif seconds > 60 * 60:
|
||||
return _(u'%d hours ago') % (seconds/3600)
|
||||
hours = seconds / 3600
|
||||
ret = ungettext(
|
||||
'%(hours)d hour ago',
|
||||
'%(hours)d hours ago',
|
||||
hours ) % { 'hours': hours }
|
||||
return ret
|
||||
elif seconds > 60:
|
||||
return _(u'%d minutes ago') % (seconds/60)
|
||||
minutes = seconds/60
|
||||
ret = ungettext(
|
||||
'%(minutes)d minute ago',
|
||||
'%(minutes)d minutes ago',
|
||||
minutes ) % { 'minutes': minutes }
|
||||
return ret
|
||||
elif seconds > 0:
|
||||
ret = ungettext(
|
||||
'%(seconds)d second ago',
|
||||
'%(seconds)d seconds ago',
|
||||
seconds ) % { 'seconds': seconds }
|
||||
return ret
|
||||
else:
|
||||
return _(u'%d seconds ago') % (seconds)
|
||||
return _(u'0 second ago')
|
||||
|
||||
@register.filter(name='translate_remain_time')
|
||||
def translate_remain_time(value):
|
||||
if value > 24 * 60 * 60:
|
||||
return u'%d 天' % (value/24/3600)
|
||||
elif value > 60 * 60:
|
||||
return u'%d 小时' % (value/3600)
|
||||
elif value > 60:
|
||||
return u'%d 分钟' % (value/60)
|
||||
else:
|
||||
return u'%d 秒' % (value)
|
||||
# @register.filter(name='translate_remain_time')
|
||||
# def translate_remain_time(value):
|
||||
# if value > 24 * 60 * 60:
|
||||
# return u'%d 天' % (value/24/3600)
|
||||
# elif value > 60 * 60:
|
||||
# return u'%d 小时' % (value/3600)
|
||||
# elif value > 60:
|
||||
# return u'%d 分钟' % (value/60)
|
||||
# else:
|
||||
# return u'%d 秒' % (value)
|
||||
|
||||
@register.filter(name='email2nickname')
|
||||
def email2nickname(value):
|
||||
@@ -190,8 +211,8 @@ def char2pinyin(value):
|
||||
@register.filter(name='translate_permission')
|
||||
def translate_permission(value):
|
||||
if value == 'rw':
|
||||
return u'可读写'
|
||||
return _(u'Read-Write')
|
||||
elif value == 'r':
|
||||
return u'只可浏览'
|
||||
return _(u'Read-Only')
|
||||
else:
|
||||
return ''
|
||||
|
@@ -89,7 +89,7 @@
|
||||
<td>{{ repo.props.desc }}</td>
|
||||
<td>
|
||||
{% if repo.latest_modify %}
|
||||
{{ repo.latest_modify|translate_commit_time }}
|
||||
{{ repo.latest_modify|translate_seahub_time }}
|
||||
{% else %}
|
||||
—— ——
|
||||
{% endif %}
|
||||
@@ -130,7 +130,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="msg-hd">
|
||||
<span class="time">{{ msg.timestamp|translate_commit_time }}</span>
|
||||
<span class="time">{{ msg.timestamp|translate_seahub_time }}</span>
|
||||
<a href="{{ SITE_ROOT }}profile/{{ msg.from_email }}/" title="{{ msg.from_email }}">{{ msg.from_email|email2nickname }}</a>
|
||||
</div>
|
||||
<div class="msg-bd">
|
||||
|
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="msg-hd">
|
||||
<span class="time">{{ msg.timestamp|translate_commit_time }}</span>
|
||||
<span class="time">{{ msg.timestamp|translate_seahub_time }}</span>
|
||||
<a href="{% url 'user_profile' msg.from_email %}">{{ msg.from_email|email2nickname }}</a>
|
||||
<span class="group">{% trans "Group: " %}<a href="{% url 'group_info' msg.group_id %}">{{ msg.group_name }}</a></span>
|
||||
</div>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.repo_id }}/">{{ repo.props.repo_name }}</a></td>
|
||||
<td>{{ repo.props.repo_desc }}</td>
|
||||
{% if repo.last_modified %}
|
||||
<td>{{ repo.last_modified|translate_commit_time }}</td>
|
||||
<td>{{ repo.last_modified|translate_seahub_time }}</td>
|
||||
{% else %}
|
||||
<td>--</td>
|
||||
{% endif %}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<div class="txt fright">
|
||||
<div class="comment-hd w100 ovhd">
|
||||
<a href="{% url 'user_profile' comment.from_email %}" title="{{ comment.from_email }}" class="fleft">{{ comment.from_email|email2nickname }}</a>
|
||||
<span class="time fright">{{ comment.timestamp|translate_commit_time }}</span>
|
||||
<span class="time fright">{{ comment.timestamp|translate_seahub_time }}</span>
|
||||
</div>
|
||||
<p class="comment-bd">{{ comment.message|seahub_urlize|find_at|linebreaksbr }}</p>
|
||||
</div>
|
||||
|
@@ -28,7 +28,7 @@
|
||||
{% for commit in commits %}
|
||||
<tr>
|
||||
<td class="time">
|
||||
{{ commit.props.ctime|translate_commit_time }}
|
||||
{{ commit.props.ctime|translate_seahub_time }}
|
||||
{% if commit.is_current_version %}
|
||||
{% trans '(current version)' %}
|
||||
{% endif %}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="msg-hd">
|
||||
<span class="time">{{ msg.timestamp|translate_commit_time }}</span>
|
||||
<span class="time">{{ msg.timestamp|translate_seahub_time }}</span>
|
||||
<a href="{% url 'user_profile' msg.from_email %}">{{ msg.from_email|email2nickname }}</a>
|
||||
<span class="group">留言所属:<a href="{% url 'public_home' %}">公共页面</a></span>
|
||||
</div>
|
||||
|
@@ -36,7 +36,7 @@
|
||||
<td><a href="{% url 'repo' repo.props.repo_id %}">{{ repo.props.repo_name }}</a></td>
|
||||
<td>{{ repo.props.repo_desc }}</td>
|
||||
{% if repo.props.last_modified %}
|
||||
<td>{{ repo.props.last_modified|translate_commit_time }}</td>
|
||||
<td>{{ repo.props.last_modified|translate_seahub_time }}</td>
|
||||
{% else %}
|
||||
<td>--</td>
|
||||
{% endif %}
|
||||
|
@@ -58,7 +58,7 @@
|
||||
{% trans "Unknown"%}
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="time">{{ current_commit.props.ctime|translate_commit_time }}</span>
|
||||
<span class="time">{{ current_commit.props.ctime|translate_seahub_time }}</span>
|
||||
</p>
|
||||
<div id="ls-ch" class="hide"></div><!--list modification details of a commit-->
|
||||
</div>
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
{% for commit in commits %}
|
||||
<tr>
|
||||
<td class="time">{{ commit.ctime|translate_commit_time }}</td>
|
||||
<td class="time">{{ commit.ctime|translate_seahub_time }}</td>
|
||||
<td>
|
||||
{% if commit.creator_name %}
|
||||
{% if not commit.second_parent_id %}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
{% trans "Unknown"%}
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="time">{{ current_commit.props.ctime|translate_commit_time }}</span>
|
||||
<span class="time">{{ current_commit.props.ctime|translate_seahub_time }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
<td class="icon-container"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory" %}" /></td>
|
||||
{% if show_recycle_root %}
|
||||
<td><a href="{% url 'repo_recycle_view' repo.id %}?commit_id={{ dirent.commit_id }}&base={{ dirent.basedir|urlencode }}&p=/{{ dirent.obj_name|urlencode }}">{{ dirent.obj_name }}</a></td>
|
||||
<td>{{ dirent.delete_time|translate_commit_time }}</td>
|
||||
<td>{{ dirent.delete_time|translate_seahub_time }}</td>
|
||||
<td></td>
|
||||
<td><a class="op" href="{% url 'repo_revert_dir' repo.id %}?commit={{ dirent.commit_id }}&p={{ dirent.basedir|urlencode }}{{dirent.obj_name|urlencode}}">{% trans "Restore" %}</a></td>
|
||||
{% else %}
|
||||
@@ -58,7 +58,7 @@
|
||||
<td class="icon-container"><img src="{{ MEDIA_URL }}img/file/{{ dirent.obj_name|file_icon_filter }}" alt="{% trans "File" %}" /></td>
|
||||
{% if show_recycle_root %}
|
||||
<td><a class="op" href="{% url 'repo_view_file' repo.id %}?obj_id={{ dirent.obj_id }}&commit_id={{ dirent.commit_id }}&base={{ dirent.basedir|urlencode }}&p=/{{ dirent.obj_name|urlencode }}&from=recycle">{{ dirent.obj_name }}</a></td>
|
||||
<td>{{ dirent.delete_time|translate_commit_time }}</td>
|
||||
<td>{{ dirent.delete_time|translate_seahub_time }}</td>
|
||||
<td>{{ dirent.file_size|filesizeformat }}</td>
|
||||
<td><a class="op" href="{% url 'repo_revert_file' repo.id %}?commit={{ dirent.commit_id }}&p={{ dirent.basedir|urlencode }}{{dirent.obj_name|urlencode}}&from=recycle">{% trans "Restore" %}</a></td>
|
||||
{% else %}
|
||||
|
@@ -85,7 +85,7 @@
|
||||
<div id="file-commit-info">
|
||||
<div class="latest-commit ovhd">
|
||||
<p class="latest-commit-info fleft">
|
||||
{% avatar latest_contributor 20 %} <a href="{% url 'user_profile' latest_contributor %}" class="name">{{ latest_contributor|email2nickname }}</a><span class="time">{{ last_modified|translate_commit_time}}</span><span>{% trans "updated this file"%}</span>
|
||||
{% avatar latest_contributor 20 %} <a href="{% url 'user_profile' latest_contributor %}" class="name">{{ latest_contributor|email2nickname }}</a><span class="time">{{ last_modified|translate_seahub_time}}</span><span>{% trans "updated this file"%}</span>
|
||||
{% if filetype == 'Text' or filetype == 'Markdown' %}
|
||||
{% if last_commit_id %}
|
||||
<span><a class="file-diff" href="{% url 'text_diff' repo.id %}?p={{path|urlencode}}&commit={{last_commit_id}}">{% trans "Detail"%}</a></span>
|
||||
@@ -176,7 +176,7 @@
|
||||
<div class="txt fright">
|
||||
<div class="comment-hd w100 ovhd">
|
||||
<a href="{% url 'user_profile' comment.from_email %}" title="{{ comment.from_email }}" class="fleft">{{ comment.from_email|email2nickname }}</a>
|
||||
<span class="time fright">{{ comment.timestamp|translate_commit_time }}</span>
|
||||
<span class="time fright">{{ comment.timestamp|translate_seahub_time }}</span>
|
||||
</div>
|
||||
<p class="comment-bd">{{ comment.message|seahub_urlize|find_at|linebreaksbr }}</p>
|
||||
</div>
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
{% for commit in commits %}
|
||||
<tr>
|
||||
<td class="time">{{ commit.ctime|translate_commit_time }}</td>
|
||||
<td class="time">{{ commit.ctime|translate_seahub_time }}</td>
|
||||
<td>
|
||||
{% if commit.creator_name %}
|
||||
{% if not commit.second_parent_id %}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="event-hd">
|
||||
<span class="time">{{ commit.ctime|translate_commit_time }}</span>
|
||||
<span class="time">{{ commit.ctime|translate_seahub_time }}</span>
|
||||
<a href="{% url 'user_profile' author %}" title="{{ author|email2nickname}}">{{ author|email2nickname }}</a>
|
||||
</div>
|
||||
<p>{% trans 'Updated library' %} <a href="{{SITE_ROOT}}repo/{{repo.id}}">{{ repo.name }}</a></p>
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="event-hd">
|
||||
<span class="time">{{ ev.timestamp|translate_commit_time }}</span>
|
||||
<span class="time">{{ ev.timestamp|translate_seahub_time }}</span>
|
||||
<a href="{% url 'user_profile' author %}" title="{{ author|email2nickname}}">{{ author|email2nickname }}</a>
|
||||
</div>
|
||||
<p>{% trans 'Created library' %} <a href="{{SITE_ROOT}}repo/{{repo_id}}">{{ repo_name }}</a></p>
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="event-hd">
|
||||
<span class="time">{{ ev.timestamp|translate_commit_time }}</span>
|
||||
<span class="time">{{ ev.timestamp|translate_seahub_time }}</span>
|
||||
<a href="{% url 'user_profile' author %}" title="{{ author|email2nickname}}">{{ author|email2nickname }}</a>
|
||||
</div>
|
||||
<p>{% trans 'Deleted library' %} {{ repo_name }}</p>
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
||||
<td>{{ repo.props.desc }}</td>
|
||||
{% if repo.latest_modify %}
|
||||
<td>{{ repo.latest_modify|translate_commit_time }}</td>
|
||||
<td>{{ repo.latest_modify|translate_seahub_time }}</td>
|
||||
{% else %}
|
||||
<td>--</td>
|
||||
{% endif %}
|
||||
@@ -72,7 +72,7 @@
|
||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.repo_id }}">{{ repo.props.repo_name }}</a></td>
|
||||
<td>{{ repo.props.repo_desc }}</td>
|
||||
{% if repo.props.last_modified %}
|
||||
<td>{{ repo.props.last_modified|translate_commit_time }}</td>
|
||||
<td>{{ repo.props.last_modified|translate_seahub_time }}</td>
|
||||
{% else %}
|
||||
<td>--</td>
|
||||
{% endif %}
|
||||
@@ -109,7 +109,7 @@
|
||||
<a href="{% url 'repo_view_file' sfile.repo.id %}?p={{ sfile.path|urlencode }}">{{ sfile.formatted_path }}</a>
|
||||
</td>
|
||||
<td>{{ sfile.repo.name }}</td>
|
||||
<td>{{ sfile.last_modified|translate_commit_time }}</td>
|
||||
<td>{{ sfile.last_modified|translate_seahub_time }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
{% load url from future %}
|
||||
|
||||
{% block main_panel %}
|
||||
<h2 class="file-modification-hd"><span class="op-target">{{ u_filename }}</span> {% trans "modification details" %} <a href="{% url 'user_profile' current_commit.creator_name %}">{% avatar current_commit.creator_name 16 %}</a><span class="modifier">{{ current_commit.creator_name|email2nickname }}</span><span class="time">{{ current_commit.ctime|translate_commit_time }}</span></h2>
|
||||
<h2 class="file-modification-hd"><span class="op-target">{{ u_filename }}</span> {% trans "modification details" %} <a href="{% url 'user_profile' current_commit.creator_name %}">{% avatar current_commit.creator_name 16 %}</a><span class="modifier">{{ current_commit.creator_name|email2nickname }}</span><span class="time">{{ current_commit.ctime|translate_seahub_time }}</span></h2>
|
||||
<p class="path">
|
||||
{% trans "Current Path:" %}
|
||||
{% for name, link in zipped %}
|
||||
|
Reference in New Issue
Block a user