diff --git a/base/locale/zh_CN/LC_MESSAGES/django.mo b/base/locale/zh_CN/LC_MESSAGES/django.mo index 9c8b9c3945..6b7ac2f999 100644 Binary files a/base/locale/zh_CN/LC_MESSAGES/django.mo and b/base/locale/zh_CN/LC_MESSAGES/django.mo differ diff --git a/base/locale/zh_CN/LC_MESSAGES/django.po b/base/locale/zh_CN/LC_MESSAGES/django.po index 95ad71cefb..e0ddcc6939 100644 --- a/base/locale/zh_CN/LC_MESSAGES/django.po +++ b/base/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: 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 \n" "Language-Team: LANGUAGE \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 "只读" diff --git a/base/templatetags/seahub_tags.py b/base/templatetags/seahub_tags.py index 3fab5d5e1b..75cb92010d 100644 --- a/base/templatetags/seahub_tags.py +++ b/base/templatetags/seahub_tags.py @@ -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) - -@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) + 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='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 '' diff --git a/group/templates/group/group_info.html b/group/templates/group/group_info.html index 0d44063ff7..5f29c0f056 100644 --- a/group/templates/group/group_info.html +++ b/group/templates/group/group_info.html @@ -89,7 +89,7 @@ {{ repo.props.desc }} {% if repo.latest_modify %} - {{ repo.latest_modify|translate_commit_time }} + {{ repo.latest_modify|translate_seahub_time }} {% else %} —— —— {% endif %} @@ -130,7 +130,7 @@
- {{ msg.timestamp|translate_commit_time }} + {{ msg.timestamp|translate_seahub_time }} {{ msg.from_email|email2nickname }}
diff --git a/group/templates/group/new_msg_reply.html b/group/templates/group/new_msg_reply.html index 55137c377b..7d4f9587bd 100644 --- a/group/templates/group/new_msg_reply.html +++ b/group/templates/group/new_msg_reply.html @@ -12,7 +12,7 @@
- {{ msg.timestamp|translate_commit_time }} + {{ msg.timestamp|translate_seahub_time }} {{ msg.from_email|email2nickname }} {% trans "Group: " %}{{ msg.group_name }}
diff --git a/organizations/templates/organizations/org_public.html b/organizations/templates/organizations/org_public.html index a21b0f6057..b0ca681a9c 100644 --- a/organizations/templates/organizations/org_public.html +++ b/organizations/templates/organizations/org_public.html @@ -40,7 +40,7 @@ {{ repo.props.repo_name }} {{ repo.props.repo_desc }} {% if repo.last_modified %} - {{ repo.last_modified|translate_commit_time }} + {{ repo.last_modified|translate_seahub_time }} {% else %} -- {% endif %} diff --git a/templates/file_comments.html b/templates/file_comments.html index 9e0a17cd7b..44f9d5ca74 100644 --- a/templates/file_comments.html +++ b/templates/file_comments.html @@ -7,7 +7,7 @@
{{ comment.from_email|email2nickname }} - {{ comment.timestamp|translate_commit_time }} + {{ comment.timestamp|translate_seahub_time }}

{{ comment.message|seahub_urlize|find_at|linebreaksbr }}

diff --git a/templates/file_revisions.html b/templates/file_revisions.html index bc5cda3975..2ecd110ab5 100644 --- a/templates/file_revisions.html +++ b/templates/file_revisions.html @@ -28,7 +28,7 @@ {% for commit in commits %} - {{ commit.props.ctime|translate_commit_time }} + {{ commit.props.ctime|translate_seahub_time }} {% if commit.is_current_version %} {% trans '(current version)' %} {% endif %} diff --git a/templates/new_innerpubmsg_reply.html b/templates/new_innerpubmsg_reply.html index f87b3b7f4a..021a671916 100644 --- a/templates/new_innerpubmsg_reply.html +++ b/templates/new_innerpubmsg_reply.html @@ -12,7 +12,7 @@
- {{ msg.timestamp|translate_commit_time }} + {{ msg.timestamp|translate_seahub_time }} {{ msg.from_email|email2nickname }} 留言所属:公共页面
diff --git a/templates/public_home.html b/templates/public_home.html index 77d84b4af9..b85d23076a 100644 --- a/templates/public_home.html +++ b/templates/public_home.html @@ -36,7 +36,7 @@ {{ repo.props.repo_name }} {{ repo.props.repo_desc }} {% if repo.props.last_modified %} - {{ repo.props.last_modified|translate_commit_time }} + {{ repo.props.last_modified|translate_seahub_time }} {% else %} -- {% endif %} diff --git a/templates/repo.html b/templates/repo.html index 765f90464e..0d62216d49 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -58,7 +58,7 @@ {% trans "Unknown"%} {% endif %} - {{ current_commit.props.ctime|translate_commit_time }} + {{ current_commit.props.ctime|translate_seahub_time }}

diff --git a/templates/repo_history.html b/templates/repo_history.html index 0514c45b97..471bc32dde 100644 --- a/templates/repo_history.html +++ b/templates/repo_history.html @@ -20,7 +20,7 @@ {% for commit in commits %} - {{ commit.ctime|translate_commit_time }} + {{ commit.ctime|translate_seahub_time }} {% if commit.creator_name %} {% if not commit.second_parent_id %} diff --git a/templates/repo_history_view.html b/templates/repo_history_view.html index e6a5d3e112..01046832b5 100644 --- a/templates/repo_history_view.html +++ b/templates/repo_history_view.html @@ -20,7 +20,7 @@ {% trans "Unknown"%} {% endif %} - {{ current_commit.props.ctime|translate_commit_time }} + {{ current_commit.props.ctime|translate_seahub_time }}

diff --git a/templates/repo_recycle_view.html b/templates/repo_recycle_view.html index accca3c395..32384199b3 100644 --- a/templates/repo_recycle_view.html +++ b/templates/repo_recycle_view.html @@ -41,7 +41,7 @@ {% trans {% if show_recycle_root %} {{ dirent.obj_name }} - {{ dirent.delete_time|translate_commit_time }} + {{ dirent.delete_time|translate_seahub_time }} {% trans "Restore" %} {% else %} @@ -58,7 +58,7 @@ {% trans {% if show_recycle_root %} {{ dirent.obj_name }} - {{ dirent.delete_time|translate_commit_time }} + {{ dirent.delete_time|translate_seahub_time }} {{ dirent.file_size|filesizeformat }} {% trans "Restore" %} {% else %} diff --git a/templates/repo_view_file.html b/templates/repo_view_file.html index 28ec6078fd..1708fb886c 100644 --- a/templates/repo_view_file.html +++ b/templates/repo_view_file.html @@ -85,7 +85,7 @@

- {% avatar latest_contributor 20 %} {{ latest_contributor|email2nickname }}{{ last_modified|translate_commit_time}}{% trans "updated this file"%} + {% avatar latest_contributor 20 %} {{ latest_contributor|email2nickname }}{{ last_modified|translate_seahub_time}}{% trans "updated this file"%} {% if filetype == 'Text' or filetype == 'Markdown' %} {% if last_commit_id %} {% trans "Detail"%} @@ -176,7 +176,7 @@

{{ comment.from_email|email2nickname }} - {{ comment.timestamp|translate_commit_time }} + {{ comment.timestamp|translate_seahub_time }}

{{ comment.message|seahub_urlize|find_at|linebreaksbr }}

diff --git a/templates/repo_view_snapshot.html b/templates/repo_view_snapshot.html index 138ce3c154..67ba9b4f68 100644 --- a/templates/repo_view_snapshot.html +++ b/templates/repo_view_snapshot.html @@ -20,7 +20,7 @@ {% for commit in commits %} - {{ commit.ctime|translate_commit_time }} + {{ commit.ctime|translate_seahub_time }} {% if commit.creator_name %} {% if not commit.second_parent_id %} diff --git a/templates/snippets/events.html b/templates/snippets/events.html index bc2ccdb567..6297b1f58e 100644 --- a/templates/snippets/events.html +++ b/templates/snippets/events.html @@ -11,7 +11,7 @@
- {{ commit.ctime|translate_commit_time }} + {{ commit.ctime|translate_seahub_time }} {{ author|email2nickname }}

{% trans 'Updated library' %} {{ repo.name }}

@@ -37,7 +37,7 @@
- {{ ev.timestamp|translate_commit_time }} + {{ ev.timestamp|translate_seahub_time }} {{ author|email2nickname }}

{% trans 'Created library' %} {{ repo_name }}

@@ -52,7 +52,7 @@
- {{ ev.timestamp|translate_commit_time }} + {{ ev.timestamp|translate_seahub_time }} {{ author|email2nickname }}

{% trans 'Deleted library' %} {{ repo_name }}

diff --git a/templates/snippets/my_owned_repos.html b/templates/snippets/my_owned_repos.html index 481d41c235..0d5a011581 100644 --- a/templates/snippets/my_owned_repos.html +++ b/templates/snippets/my_owned_repos.html @@ -26,7 +26,7 @@ {{ repo.props.name }} {{ repo.props.desc }} {% if repo.latest_modify %} - {{ repo.latest_modify|translate_commit_time }} + {{ repo.latest_modify|translate_seahub_time }} {% else %} -- {% endif %} @@ -72,7 +72,7 @@ {{ repo.props.repo_name }} {{ repo.props.repo_desc }} {% if repo.props.last_modified %} - {{ repo.props.last_modified|translate_commit_time }} + {{ repo.props.last_modified|translate_seahub_time }} {% else %} -- {% endif %} @@ -109,7 +109,7 @@ {{ sfile.formatted_path }} {{ sfile.repo.name }} - {{ sfile.last_modified|translate_commit_time }} + {{ sfile.last_modified|translate_seahub_time }} {% endfor %} diff --git a/templates/text_diff.html b/templates/text_diff.html index 221ec6c019..77104236d0 100644 --- a/templates/text_diff.html +++ b/templates/text_diff.html @@ -3,7 +3,7 @@ {% load url from future %} {% block main_panel %} -

{{ u_filename }} {% trans "modification details" %} {% avatar current_commit.creator_name 16 %}{{ current_commit.creator_name|email2nickname }}{{ current_commit.ctime|translate_commit_time }}

+

{{ u_filename }} {% trans "modification details" %} {% avatar current_commit.creator_name 16 %}{{ current_commit.creator_name|email2nickname }}{{ current_commit.ctime|translate_seahub_time }}

{% trans "Current Path:" %} {% for name, link in zipped %}