summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/404.html27
-rw-r--r--templates/500.html28
-rw-r--r--templates/about.html68
-rw-r--r--templates/allfiles30
-rw-r--r--templates/answer_edit.html83
-rw-r--r--templates/answer_edit_tips.html54
-rw-r--r--templates/ask.html87
-rw-r--r--templates/authopenid/changeemail.html4
-rw-r--r--templates/authopenid/complete.html37
-rw-r--r--templates/authopenid/htmlfiles8
-rw-r--r--templates/authopenid/sendpw.html17
-rw-r--r--templates/authopenid/settings.html10
-rw-r--r--templates/authopenid/signin.html47
-rw-r--r--templates/authopenid/signup.html25
-rw-r--r--templates/badge.html13
-rw-r--r--templates/badges.html33
-rw-r--r--templates/base.html34
-rw-r--r--templates/base_content.html34
-rw-r--r--templates/book.html52
-rw-r--r--templates/close.html18
-rw-r--r--templates/content/js/com.cnprog.i18n.js90
-rw-r--r--templates/content/js/com.cnprog.post.js111
-rw-r--r--templates/content/js/com.cnprog.utils.js24
-rw-r--r--templates/content/js/jquery.i18n.js133
-rw-r--r--templates/content/js/wmd/wmd.js34
-rw-r--r--templates/content/style/default.css12
-rw-r--r--templates/content/style/openid.css2
-rw-r--r--templates/content/style/style.css99
-rw-r--r--templates/faq.html89
-rw-r--r--templates/footer.html21
-rw-r--r--templates/header.html37
-rw-r--r--templates/index.html49
-rw-r--r--templates/logout.html10
-rw-r--r--templates/okfiles30
-rw-r--r--templates/pagesize.html7
-rw-r--r--templates/paginator.html16
-rw-r--r--templates/privacy.html37
-rw-r--r--templates/question.html165
-rw-r--r--templates/question_edit.html85
-rw-r--r--templates/question_edit_tips.html51
-rw-r--r--templates/questions.html73
-rw-r--r--templates/reopen.html15
-rw-r--r--templates/revisions_answer.html18
-rw-r--r--templates/revisions_question.html21
-rw-r--r--templates/tags.html19
-rw-r--r--templates/template.list18
-rw-r--r--templates/tough/faq.html110
-rw-r--r--templates/tough/question_retag.html107
-rw-r--r--templates/tough/unanswered.html115
-rw-r--r--templates/unanswered.html55
-rwxr-xr-xtemplates/upfiles/1245715031297631.pngbin0 -> 3863 bytes
-rwxr-xr-xtemplates/upfiles/12457157052552259.pngbin0 -> 3863 bytes
-rw-r--r--templates/user.html3
-rw-r--r--templates/user_edit.html19
-rw-r--r--templates/user_favorites.html4
-rw-r--r--templates/user_footer.html3
-rw-r--r--templates/user_info.html34
-rw-r--r--templates/user_preferences.html15
-rw-r--r--templates/user_recent.html4
-rw-r--r--templates/user_reputation.html3
-rw-r--r--templates/user_responses.html6
-rw-r--r--templates/user_stats.html27
-rw-r--r--templates/user_tabs.html30
-rw-r--r--templates/user_votes.html9
-rw-r--r--templates/users.html23
-rw-r--r--templates/users_questions.html22
66 files changed, 1672 insertions, 892 deletions
diff --git a/templates/404.html b/templates/404.html
index 02725854..d24edaf0 100644
--- a/templates/404.html
+++ b/templates/404.html
@@ -1,4 +1,6 @@
+<!-- template 404.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% block title %}{% spaceless %}404 Error{% endspaceless %}{% endblock %}
{% block forestyle%}
<style type="text/css">
@@ -19,30 +21,29 @@
</div>
<div id="main-body" class="">
<div style="padding:5px 0px 10px 0;line-height:25px;">
- <h3>对不起,没有找到您请求的页面!</h3>
+ <h3>{% trans "Sorry, could not find the page you requested." %}</h3>
<div style="margin-top:5px">
- 有可能是以下原因导致:<br>
+ {% trans "This might have happened for the following reasons:" %}<br>
<ul>
- <li>你正在查看的问题或者回答已经被删除;</li>
- <li>请求的地址有误 - 请核实原始URL地址;</li>
- <li>访问的页面被保护或你的积分不够,参见<a href="/faq"> faq</a>;</li>
- <li>如果你确信不该出现404错误,请<a href="http://cnprog.uservoice.com/" target="_blank">报告这个问题</a></li>
+ <li>{% trans "this question or answer has been deleted;" %}</li>
+ <li>{% trans "url has error - please check it;" %}</li>
+ <li>{% trans "the page you tried to visit is protected or you don't have sufficient points, see" %} <a href="/faq"> faq</a>;</li>
+ <li>{% trans "if you believe this error 404 should not have occured, please" %}
+ <a href="{{feedback_site_url}}" target="_blank">{% trans "report this problem" %}</a></li>
</u>
</div>
<script type="text/javascript">
var GOOG_FIXURL_LANG = 'zh-cn';
- var GOOG_FIXURL_SITE = 'http://cnprog.com/';
+ var GOOG_FIXURL_SITE = '{{site_url}}';
</script>
<script type="text/javascript" src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
<ul>
- <li><a href="#" id="linkPrevious">返回前页 » </li>
- <li><a href="/questions">查看最新问题 » </a></li>
- <li><a href="/tags/">查看标签列表 » </a></li>
+ <li><a href="#" id="linkPrevious">{% trans "back to previous page" %} » </li>
+ <li><a href="/questions">{% trans "see all questions" %} » </a></li>
+ <li><a href="/tags/">{% trans "see all tags" %} » </a></li>
</u>
</div>
</div>
{% endblock %}
-
-
-
+<!-- end template 404.html -->
diff --git a/templates/500.html b/templates/500.html
index 2e89783a..c99774b3 100644
--- a/templates/500.html
+++ b/templates/500.html
@@ -1,4 +1,6 @@
+<!-- template 500.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% block title %}{% spaceless %}500 Error{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
@@ -9,25 +11,25 @@
</script>
{% endblock %}
{% block content %}
-<div id="main-bar" class="headNormal">
- 500 Server Error
+<div id="main-bar" class="">
+ <h3>
+ 500 Server Error
+ </h3>
+
</div>
-<div id="main-body" class="">
+<div id="main-body" class="headNormal">
<div style="padding:5px 0px 10px 0;line-height:25px">
- <h3>对不起,系统发生了错误,不能响应您的请求!</h3>
+ <h3>{% trans "sorry, system error"</h3>
<br>
- 系统已经记录错误日志,我们会尽快解决此问题。<br>
- 如果这个问题长时间没有被修复,请<span class="darkred"><a title="cnprog.uservoice.com" href="http://cnprog.uservoice.com/" >搜索查看当前问题的状态,或者报告新的bug</a></span>。感谢您的支持!
-
+ {% trans "system error log is recorded, error will be fixed as soon as possible" %}<br>
+ {% trans "please report the error to the site administrators if you wish" %}
<ul>
- <li><a href="#" id="linkPrevious">返回前页</li>
- <li><a href="/questions">查看最新问题</a></li>
- <li><a href="/tags/">查看标签列表</a></li>
+ <li><a href="#" id="linkPrevious">{% trans "back to previous page" %}</li>
+ <li><a href="/questions">{% trans "see latest questions" %}</a></li>
+ <li><a href="/tags/">{% trans "see tags" %}</a></li>
</u>
</div>
</div>
{% endblock %}
-
-
-
+<!-- end template 500.html -->
diff --git a/templates/about.html b/templates/about.html
index 6638060e..4655a641 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -1,71 +1,21 @@
+<!-- template about.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load humanize %}
-{% block title %}{% spaceless %}关于本站{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "About" %}{% endspaceless %}{% endblock %}
{% block forejs %}
{% endblock %}
{% block content %}
<div class="headNormal">
-关于本站
+{% trans "About" %}
</div>
<div class="content">
- <p>
- CNProg 是<strong>一个面向中国程序员的免费技术问答社区</strong>。它是一个介于论坛、博客、维基和Digg之间的社区系统,基于Python和Django开发。<br>
- 创办CNProg的灵感来自于国外知名QA社区<a href="http://www.stackoverflow.com">StackOverflow</a>,但是CNProg不仅仅是一个汉化版的SO。<br>
- 我们通过开源社区来维护和更新源代码,你可以访问<strong><a href="http://code.google.com/p/cnprog/">这里</a></strong>获取本站的所有源代码(请注意源代码使用的授权许可)。<br>
- </p>
- <br>
- <p>
- <strong>我们不运作社区,由你来运作。</strong>CNProg 是<strong><a href="http://blog.cnprog.com/2009/01/%e7%94%a8%e6%88%b7%e9%a9%b1%e5%8a%a8%e7%9a%84%e6%8a%80%e6%9c%af%e7%a4%be%e5%8c%ba/">一个由用户来驱动的社区</a></strong>。每个用户不仅是管理员,也是社区功能需求的提出者。<br>
- 社区内容是协作的,系统越信任你,你就在社区获得更多的管理权限,可以开始编辑问题或回答,
- 帮助我们组织问题和答案,帮助需要帮助的广大程序员用户。<br>
- 透明、开放、全民管理的运作模式是本网站的特点,我们希望通过CNProg让用户能够更加容易地寻求帮助,找到问题答案,解决实际的技术问题。
- </p>
- <p>
- 我们关注国内程序员的成长!
- </p>
-
- <br>
- <h3 class="subtitle">你们是谁?</h3>
- <p>
- 我们是一群奋斗在互联网的编程爱好者,和你一样,也是希望自己编写高质量软件的开发人员。
- 我们的团队:
- </p>
- <table cellspacing="5" cellpadding="3">
- <tr>
- <td width="150px"><img src="/content/images/nophoto.png"></td>
- <td width="150px"><img src="/content/images/nophoto.png"></td>
- <td width="150px"><img src="/content/images/nophoto.png"></td>
- <td width="150px"></td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- <td><a ></a></td>
- </tr>
- <tr>
- <td colspan="4" height="5"></td>
- </tr>
- <tr>
- <td width="150px"><img src="/content/images/nophoto.png"></td>
- <td width="150px"><img src="/content/images/nophoto.png"></td>
- <td width="150px"></td>
- <td width="150px"></td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- </table>
- <p>
- 欢迎访问我们的<strong><a href="http://blog.cnprog.com">团队Blog</a></strong>或查看更多介绍的<a href="/faq" class="big">CNProg FAQ</a>。
- </p>
+ <p>edit file templates/about.html. Below are just suggestions of what can go here</p>
+ <p>what is your site for?</p>
+ <p>how does it work? what are roles of members?</p>
+ <p>is there a place to find out more about this website?</p>
</div>
{% endblock %}
-
-
-
+<!-- end template about.html -->
diff --git a/templates/allfiles b/templates/allfiles
new file mode 100644
index 00000000..3ca0191e
--- /dev/null
+++ b/templates/allfiles
@@ -0,0 +1,30 @@
+404.html
+500.html
+about.html
+ask.html
+badges.html
+base_content.html
+base.html
+book.html
+close.html
+faq.html
+footer.html
+header.html
+index.html
+logout.html
+pagesize.html
+paginator.html
+privacy.html
+question_edit_tips.html
+question.html
+questions.html
+revisions_answer.html
+tags.html
+unanswered.html
+user_edit.html
+user_info.html
+users.html
+users_questions.html
+user_stats.html
+user_tabs.html
+user_votes.html
diff --git a/templates/answer_edit.html b/templates/answer_edit.html
index f914660a..008d9f78 100644
--- a/templates/answer_edit.html
+++ b/templates/answer_edit.html
@@ -1,11 +1,13 @@
+<!-- template answer_edit.html -->
{% extends "base.html" %}
-{% block title %}{% spaceless %}修改回答{% endspaceless %}{% endblock %}
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Edit answer" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
<script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
<script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown-min.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd-min.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
<link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
<script type="text/javascript">
@@ -19,10 +21,10 @@
//toggle preview of editor
var display = true;
- var txt = "禁用预览";
+ var txt = "{% trans "hide preview" %}";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
- txt = display ? "启用预览" : "禁用预览";
+ txt = display ? "{% trans "show preview" %}" : "{% trans "hide preview" %}";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
@@ -42,21 +44,22 @@
{% block content %}
<div id="main-bar" class="headNormal">
- 修改回答 [<a href="{{ answer.question.get_absolute_url }}#{{ answer.id }}">返回</a>]
+ {% trans "Edit answer" %} [<a href="{{ answer.question.get_absolute_url }}#{{ answer.id }}">{% trans "back" %}</a>]
</div>
<div id="main-body" class="ask-body">
<div id="askform">
<form id="fmedit" action="{% url edit_answer answer.id %}" method="post" >
- <label for="id_revision" ><strong>版本:</strong></label> <br>
+ <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br>
{% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
<div style="vertical-align:middle">
- {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="选择版本">
+ {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans "select revision" %}">
</div><br>
<div class="form-item">
<div id="wmd-button-bar" class="wmd-panel"></div>
{{ form.text }}
<span class="form-error"></span>
- <div class="preview-toggle"><span id="pre-collapse" title="打开或者关闭Markdown编辑器的实时预览">预览开关</span></div>
+ <div class="preview-toggle"><span id="pre-collapse"
+ title="{% trans "Toggle the real time Markdown editor preview" %}打">{% trans "toggle preview" %}</span></div>
<div id="previewer" class="wmd-preview"></div>
<br>
</div>
@@ -67,8 +70,8 @@
{{ form.summary.help_text }}
</div>
<br>
- <input type="submit" value="现在修改" class="submit" />
- <input type="button" value="取消" class="submit" onclick="history.back(-1);" />
+ <input type="submit" value="{% trans "Save edit" %}" class="submit" />
+ <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
<br>
<br>
</form>
@@ -77,63 +80,9 @@
{% endblock %}
{% block sidebar %}
-<div class="boxC">
- <p class="subtitle darkred">受欢迎的提问</p>
- <div>
- <ul class="list-item">
- <li>
- <b>您的问题与编程相关吗?</b>
- </li>
- <li>
- 建议您提的问题是可以被答复的,而不仅仅是可以讨论。
- </li>
- <li>
- 请详细描述您的问题。
- </li>
- <li>
- 我们推荐您使用中文描述问题,这样可以得到更多的答复机会。
- </li>
- </ul>
- <a href="/faq/" target="_blank" title="查看常见问题" style="float:right;position:relative">faq »</a>
- <br>
- </div>
-</div>
-
-<div class="boxC">
- <p class="subtitle">Markdown快速参考</p>
- <ul class="list-item">
- <li>
- *斜体* 或者 _斜体_
-
- </li>
- <li>
- **加粗** 或者 __加粗__
-
- </li>
- <li>
- <b>链接</b>:一个[例子](http://url.com/ "标题")
-
- </li>
-
- <li>
- <b>图片</b>:![alt 文本](/path/img.jpg "标题")
-
- </li>
- <li>
- 列表:
- 1. Foo
- 2. Bar
- </li>
- <li>
- 基本的HTML标签也是支持的
- </li>
- </ul>
- <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank" style="float:right;position:relative">有关Markdown详细说明 »</a>
- <br>
-</div>
-
+{% include "answer_edit_tips.html" %}
{% endblock %}
{% block endjs %}
{% endblock %}
-
+<!-- end template answer_edit.html -->
diff --git a/templates/answer_edit_tips.html b/templates/answer_edit_tips.html
new file mode 100644
index 00000000..08d33bc9
--- /dev/null
+++ b/templates/answer_edit_tips.html
@@ -0,0 +1,54 @@
+<!-- template answer_edit_tips.html -->
+{% load i18n %}
+<div class="boxC">
+ <p class="subtitle darkred">{% trans "answer tips" %}</p>
+ <div>
+ <ul class="list-item">
+ <li> <b>{% trans "please make your answer relevant to this community" %}</b>
+ </li>
+ <li>
+ {% trans "try to give an answer, rather than engage into a discussion" %}
+ </li>
+ <li>
+ {% trans "please try to provide details" %}
+ </li>
+ <li>
+ {% trans "be clear and concise" %}
+ </li>
+ </ul>
+ <a href="/faq/" target="_blank" title="{% trans "see frequently asked questions" %}" style="float:right;position:relative">faq »</a>
+ <br>
+ </div>
+</div>
+
+<div class="boxC">
+ <p class="subtitle">{% trans "Markdown tips" %}</p>
+ <ul class="list-item">
+ <li>
+ {% trans "*italic* or __italic__" %}
+ </li>
+ <li>
+ {% trans "**bold** or __bold__" %}
+ </li>
+ <li>
+ <b>{% trans "link" %}</b>:[{% trans "text" %}](http://url.com/ "{% trans "title" %}")
+
+ </li>
+
+ <li>
+ <b>{% trans "image" %}</b>:![alt {% trans "text" %}](/path/img.jpg "{% trans "title" %}")
+
+ </li>
+ <li>
+ {% trans "numbered list:" %}
+ 1. Foo
+ 2. Bar
+ </li>
+ <li>
+ {% trans "basic HTML tags are also supported" %}
+ </li>
+ </ul>
+ <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank" style="float:right;position:relative">{% trans "learn more about Markdown" %} »</a>
+ <br>
+</div>
+<!-- end template answer_edit_tips.html -->
diff --git a/templates/ask.html b/templates/ask.html
index ecd176bc..1b00a701 100644
--- a/templates/ask.html
+++ b/templates/ask.html
@@ -1,11 +1,13 @@
+<!-- template ask.html -->
{% extends "base.html" %}
-{% block title %}{% spaceless %}我要提问{% endspaceless %}{% endblock %}
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/com.cnprog.post.pack.js'></script>
+ <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
<script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown-min.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd-min.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
<link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
<script type="text/javascript">
$().ready(function(){
@@ -18,11 +20,12 @@
captureLength: 5, callback: lanai.highlightSyntax});
//toggle preview of editor
+ //todo remove copy-paste
var display = true;
- var txt = "[禁用预览]";
+ var txt = "[{% trans "hide preview" %}]";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
- txt = display ? "[启用预览]" : "[禁用预览]";
+ txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
@@ -54,7 +57,7 @@
{% block content %}
<div id="main-bar" class="headNormal">
- 我要提问
+ {% trans "Ask a question" %}
</div>
<div id="main-body" class="ask-body">
<div id="askform">
@@ -75,7 +78,7 @@
<table width="100%">
<tr>
<td>
- <span id="pre-collapse" title="打开或者关闭Markdown编辑器的实时预览">预览开关</span>
+ <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
</td>
<td style="text-align:right;">
{{ form.wiki }} <span style="font-weight:normal;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
@@ -100,10 +103,10 @@
<table id="login-box">
<tr>
<td style="vertical-align:middle;">
- <strong>使用 <a href="http://openid.net/" title="了解更多有关OpenID的信息">OpenID</a> 登录:</strong><br>
+ <strong>{% trans "Use" %} <a href="http://openid.net/" title="{% trans "learn more about OpenID" %}">OpenID</a> {% trans "Login" %}:</strong><br>
{{ form.openid }}
<div class="title-desc">
- 获取您自己的<a href="https://www.myopenid.com/" target=="_blank">OpenID</a>。
+ {% trans "Get your own "%} <a href="https://www.myopenid.com/" target=="_blank">OpenID</a>。
</div>
</td>
<td style="vertical-align:middle; padding: 0px 40px 0px 40px">
@@ -111,17 +114,17 @@
<div style="width:1px; border-left:solid 1px #999; height:8em; margin:auto;"></div>
</td>
<td style="vertical-align:middle;">
- <strong>您的大名:</strong><br>
+ <strong>{% trans "User name" %}:</strong><br>
{{ form.user }}
<p>
- <strong>电子邮件:(不会公开显示)</strong><br>
+ <strong>{% trans "Email: (won't be shown to anyone)" %}:</strong><br>
{{ form.email }}
</p>
</td>
</tr>
</table>
{% endif %}
- <input type="submit" value="现在提问" class="submit" />
+ <input type="submit" value="{% trans "Ask your question" %}" class="submit" />
<br><br>
</form>
</div>
@@ -129,63 +132,9 @@
{% endblock %}
{% block sidebar %}
-<div class="boxC">
- <p class="subtitle darkred">受欢迎的提问</p>
- <div>
- <ul class="list-item">
- <li>
- <b>您的问题与编程相关吗?</b>
- </li>
- <li>
- 建议您提的问题是可以被答复的,而不仅仅是可以讨论。
- </li>
- <li>
- 请详细描述您的问题。
- </li>
- <li>
- 我们推荐您使用中文描述问题,这样可以得到更多的答复机会。
- </li>
- </ul>
- <a href="/faq/" target="_blank" title="查看常见问题" style="float:right;position:relative">faq »</a>
- <br>
- </div>
-</div>
-
-<div class="boxC">
- <p class="subtitle">Markdown快速参考</p>
- <ul class="list-item">
- <li>
- *斜体* 或者 _斜体_
-
- </li>
- <li>
- **加粗** 或者 __加粗__
-
- </li>
- <li>
- <b>链接</b>:一个[例子](http://url.com/ "标题")
-
- </li>
-
- <li>
- <b>图片</b>:![alt 文本](/path/img.jpg "标题")
-
- </li>
- <li>
- 列表:
- 1. Foo
- 2. Bar
- </li>
- <li>
- 基本的HTML标签也是支持的
- </li>
- </ul>
- <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank" style="float:right;position:relative">有关Markdown详细说明 »</a>
- <br>
-</div>
-
+{% include "question_edit_tips.html" %}
{% endblock %}
{% block endjs %}
{% endblock %}
-
+<!-- end template ask.html -->
diff --git a/templates/authopenid/changeemail.html b/templates/authopenid/changeemail.html
index a6c53a64..99984b3f 100644
--- a/templates/authopenid/changeemail.html
+++ b/templates/authopenid/changeemail.html
@@ -1,9 +1,5 @@
{% extends "base_content.html" %}
{% load i18n %}
-
-
-
-
{% block content %}
<div id="main-bar" class="">
<h3>
diff --git a/templates/authopenid/complete.html b/templates/authopenid/complete.html
index fd243f28..28c38a04 100644
--- a/templates/authopenid/complete.html
+++ b/templates/authopenid/complete.html
@@ -1,19 +1,19 @@
{% extends "base.html" %}
+{% load i18n %}
{% block head %}{% endblock %}
-{% block title %}{% spaceless %}绑定OpenID{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Connect your OpenID with this site" %}{% endspaceless %}{% endblock %}
{% block content %}
<div id="main-bar" class="headNormal">
- 绑定OpenID帐号
-
+ {% trans "Connect your OpenID with your account on this site" %}
</div>
<p id="completetxt" >
- <h3>您的OpenID帐号已经验证通过! 请完成最后一步 - 绑定OpenID到您的帐号。</h3>
- <p style="display:none">输入您的新帐号或者指定已经存在的帐号。</p>
+ <h3>{% trans "Your OpenID is accepted. Please complete this to finish registration." %}</h3>
+ <p style="display:none">{% trans "This account already exists, please use another." %}</p>
</p>
{% if form1.errors %}
<p class="errors">
- <span class="big">请注意以下错误:</span><br>
+ <span class="big">{% trans "Sorry, looks like we have some errors:" %}</span><br>
<ul class="error-list">
{% if form1.username.errors %}
<li><span class="error">{{ form1.username.errors|join:", " }}</span></li>
@@ -26,7 +26,7 @@
{% endif %}
{% if form2.errors %}
<p class="errors">
- <span class="big">请注意以下错误:</span><br>
+ <span class="big">{% trans "Sorry, looks like we have some errors:" %}</span><br>
<ul class="error-list">
{% if form2.username.errors %}
<li><span class="error">{{ form2.username.errors|join:", " }}</span></li>
@@ -42,10 +42,10 @@
<form name="fregister" action="{% url user_register %}" method="POST">
{{ form.next }}
<fieldset style="padding:10px">
- <legend class="big">新帐号</legend>
- <div class="form-row"><label for="id_username">用户名(<i>在社区显示友好名称,不可更改</i>)</label><br />{{ form1.username }}</div>
- <div class="form-row"><label for="id_email">电子邮件(<i>用于头像显示服务</i>)</label><br />{{ form1.email }}</div>
- <div class="submit-row"><input type="submit" class="submit" name="bnewaccount" value="创建帐号"></div>
+ <legend class="big">{% trans "New account" %}</legend>
+ <div class="form-row"><label for="id_username">{% trans "User name (<i>will be shown to others, cannot be modified</i>)" %}</label><br />{{ form1.username }}</div>
+ <div class="form-row"><label for="id_email">{% trans "Email (<i>not shared with anyone</i>)" %}</label><br />{{ form1.email }}</div>
+ <div class="submit-row"><input type="submit" class="submit" name="bnewaccount" value="{% trans "create account" %}"></div>
</fieldset>
</form>
</div>
@@ -53,14 +53,15 @@
<form name="fverify" action="{% url user_register %}" method="POST">
{{ form.next }}
<fieldset style="padding:10px">
- <legend class="big">已经存在的用户</legend>
- <div class="form-row"><label for="id_username">用户名</label><br />{{ form2.username }}</div>
- <div class="form-row"><label for="id_passwordl">密码</label><br />{{ form2.password }}</div>
- <div class="submit-row"><input type="submit" class="submit" name="bverify" value="确认"> <a href="">忘记密码?</a></div>
+ <legend class="big">{% trans "Existing account" %}</legend>
+ <div class="form-row"><label for="id_username">{% trans "user name" %}</label><br />{{ form2.username }}</div>
+ <div class="form-row"><label for="id_passwordl">{% trans "password" %}</label><br />{{ form2.password }}</div>
+ <!--todo double check translation from chinese 确认 = "Register" -->
+ <div class="submit-row">
+ <input type="submit" class="submit" name="bverify" value="{% trans "Register" %}">
+ <a href="">{% trans "Forgot your password?" %}</a>
+ </div>
</fieldset>
</form>
</div>
{% endblock %}
-
-
-
diff --git a/templates/authopenid/htmlfiles b/templates/authopenid/htmlfiles
new file mode 100644
index 00000000..1b9dccd0
--- /dev/null
+++ b/templates/authopenid/htmlfiles
@@ -0,0 +1,8 @@
+changeemail.html
+changeopenid.html
+changepw.html
+delete.html
+failure.html
+sendpw.html
+settings.html
+signup.html
diff --git a/templates/authopenid/sendpw.html b/templates/authopenid/sendpw.html
index 237a5cf6..a9488c4c 100644
--- a/templates/authopenid/sendpw.html
+++ b/templates/authopenid/sendpw.html
@@ -1,17 +1,18 @@
{% extends "base.html" %}
-{% block title %}{% spaceless %}发送新密码{% endspaceless %}{% endblock %}
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Send new password" %}{% endspaceless %}{% endblock %}
{% block content %}
<div id="main-bar" class="">
- <h3 >发送新密码</h3>
+ <h3>{% trans "Send new password" %}</h3>
</div>
<div class="paragraph">
-丢失了您的密码? 你可以在这里重设密码。<br>
-请输入用户名,新的密码会发送到你注册时候填写的电子邮件。
+{% trans "Lost your password? No problem - here you can reset it." %}<br>
+{% trans "Please enter your username below and new password will be sent to your registered e-mail" %}
</div>
{% if form.errors %}
-<p class="errors"><span class="big">请注意以下错误:</span><br>
+<p class="errors"><span class="big">{% "Sorry, looks like we have some errors:" %}</span><br>
{% if form.username.errors %}
<span class="error">{{ form.username.errors|join:", " }}</span>
{% endif %}
@@ -23,11 +24,11 @@
<div class="aligned">
<form action="." method="post" accept-charset="utf-8">
- <div id="form-row"><label for="id_username">用户名: </label>{{ form.username }}</div>
+ <div id="form-row"><label for="id_username">{% trans "User name" %}:</label>{{ form.username }}</div>
- <p style="padding-top:10px"><input type="submit" value="重设密码"> <a href="{% url user_signin %}">返回登录</a></p>
+ <p style="padding-top:10px"><input type="submit" value="{% trans "Reset password" %}"> <a href="{% url user_signin %}">{% trans "return to login" %}</a></p>
</form>
- <span class="darkred">注意: 新的密码只有您在激活邮件中的链接后才会被激活。</span>
+ <span class="darkred">{% trans "Note: your new password will be activated only after you click the activation link in the email message" %}</span>
</div>
{% endblock %}
diff --git a/templates/authopenid/settings.html b/templates/authopenid/settings.html
index c765b989..ffd5dd8f 100644
--- a/templates/authopenid/settings.html
+++ b/templates/authopenid/settings.html
@@ -17,7 +17,7 @@
{% block content %}
<div id="main-bar">
- <h3><strong>{{ request.user.username }}账户设置</strong></h3>
+ <h3><strong>{{ request.user.username }} {% trans "Profile" %}</strong></h3>
</div>
<div id="settings-options">
{% if msg %}
@@ -25,16 +25,16 @@
{% endif %}
<dl class="list-item">
- <dt>» <a href="{% url user_changepw %}">修改密码</a></dt>
+ <dt>» <a href="{% url user_changepw %}">{% trans "Change password" %}</a></dt>
<dd>{% trans "Give your account a new password." %}</dd>
- <dt>» <a href="{% url user_changeemail %}">更换电子邮件</a></dt>
+ <dt>» <a href="{% url user_changeemail %}">{% trans "Change email " %}</a></dt>
<dd>{% trans "Add or update the email address associated with your account." %}</dd>
{% if is_openid %}
- <dt>» <a href="{% url user_changeopenid %}">更换OpenID地址</a></dt>
+ <dt>» <a href="{% url user_changeopenid %}">{% trans "Change OpenID %}</a></dt>
<dd>{% trans "Change openid associated to your account" %}</dd>
{% endif %}
- <dt>» <a href="{% url user_delete %}">删除帐号</a></dt>
+ <dt>» <a href="{% url user_delete %}">{% trans "Delete account" %}</a></dt>
<dd>{% trans "Erase your username and all your data from website" %}</dd>
</dl>
</div>
diff --git a/templates/authopenid/signin.html b/templates/authopenid/signin.html
index 9c5511f2..aff2f06f 100644
--- a/templates/authopenid/signin.html
+++ b/templates/authopenid/signin.html
@@ -1,5 +1,6 @@
{% extends "base.html" %}
-{% block title %}{% spaceless %}用户登录{% endspaceless %}{% endblock %}
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "User login" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript" src="/content/js/jquery.openid.js?"></script>
<script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
@@ -12,26 +13,26 @@
{% endblock %}
{% block content %}
<div class="headNormal">
- 用户登录
+ {% trans "User login" %}
</div>
<div class="login">
<form name="openid_form" action="{% url user_signin %}" method="post">
{{ form2.next }}
- <p style="display:none">CNProg支持<b>两种</b>登录模式。您可以使用帐号、密码登录,或者使用OpenID登录。</p>
+ <p style="display:none">{% trans "we support two login modes" %}</p>
{% if msg %}
<p class="warning">{{ msg }}</p>
{% endif %}
<fieldset class="fieldset">
- <legend ><strong>使用OpenID登录</strong></legend>
+ <legend ><strong>{% trans "Login with your OpenID" %}</strong></legend>
<div id="openid_choice">
- <p>请选择您的帐号类型并完成正确的OpenID地址(如:替换“{username}”为您的对应帐号):</p>
+ <p>{% trans "select openid provider" %}</p>
<div id="openid_btns">
</div>
+ <br><br><br>
+ <p>{% trans "verify openid link and login" %}</p>
</div>
- <br>
- <br><br>
<p>
- {{ form2.openid_url }} <input id="bsignin" name="bsignin" type="submit" value="登录" class="openid-login-submit" />
+ {{ form2.openid_url }} <input id="bsignin" name="bsignin" type="submit" value="{% trans "Login" %}" class="openid-login-submit" />
</p>
</fieldset>
</form>
@@ -39,7 +40,7 @@
<br>
{% if form1.errors %}
<p class="errors">
- <span class="big">请注意以下错误:</span><br>
+ <span class="big">{% trans "Sorry, looks like we have some errors:" %}</span><br>
<ul class="error-list">
{% if form1.username.errors %}
<li><span class="error">{{ form1.username.errors|join:", " }}</span></li>
@@ -54,11 +55,12 @@
<form name="fauth" action="{% url user_signin %}" method="post">
{{ form1.next }}
<fieldset class="fieldset" >
- <legend class="big">使用帐号密码登录</legend>
- <div class="form-row"><label for="id_username">用户名:</label><br />{{ form1.username }}</div>
- <div class="form-row"><label for="id_password">密码:</label><br />{{ form1.password }}</div>
- <div class="submit-row"><input type="submit" class="submit" name="blogin" value="登录"> <a href="">忘记密码?</a> <a href="">注册新帐号</a></div>
-
+ <legend class="big">{% trans "Use login name and password" %}</legend>
+ <div class="form-row"><label for="id_username">{% trans "Login name" %}:</label><br />{{ form1.username }}</div>
+ <div class="form-row"><label for="id_password">{% trans "Password" %}:</label><br />{{ form1.password }}</div>
+ <div class="submit-row"><input type="submit" class="submit" name="blogin" value="{% trans "Login" %}">
+ <a href="">{% trans "Forgot your password?" %}</a>
+ <a href="">{% trans "Create new acccount" %}</a></div>
</fieldset>
</form>
</div>
@@ -67,28 +69,25 @@
{% block sidebar %}
<div class="boxC">
- <h3 class="subtitle">为什么需要OpenID登录?</h3>
+ <h3 class="subtitle">{% trans "Why use OpenID?" %}</h3>
<p>
<ul class="list-item">
<li>
- 构建在OpenID网络认证上的本系统,不需要你注册新的帐号,即可使用我们系统的所有功能
+ {% trans "with openid it is easier" %}
</li>
<li>
- 用同一个帐号可登录互联网所有激活OpenID的网站
-
+ {% trans "reuse openid" %}
</li>
<li>
- 全世界有1.6亿OpenID帐号,和10,000个支持OpenID的站点
-
+ {% trans "openid is widely adopted" %}
</li>
<li>
- OpenID是有开放标准,并且有相关的基金组织提供支持
-
+ {% trans "openid is supported open standard" %}
</li>
</ul>
- <a href="http://openid.net/what/" target="_blank" style="float:right;position:relative">查看更多 »</a><br>
- <a href="http://openid.net/get/" target="_blank" style="float:right;position:relative">获取OpenID »</a>
+ <a href="http://openid.net/what/" target="_blank" style="float:right;position:relative">{% trans "Find out more" %} »</a><br>
+ <a href="http://openid.net/get/" target="_blank" style="float:right;position:relative">{% trans "Get OpenID" %} »</a>
</p>
<br>
</div>
diff --git a/templates/authopenid/signup.html b/templates/authopenid/signup.html
index e51544f7..a4460aa3 100644
--- a/templates/authopenid/signup.html
+++ b/templates/authopenid/signup.html
@@ -1,18 +1,18 @@
{% extends "base.html" %}
-{% block title %}{% spaceless %}注册帐号{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Signup" %}{% endspaceless %}{% endblock %}
{% block content %}
<div id="main-bar" class="">
- <h3 >注册帐号</h3>
+ <h3 >{% trans "Signup" %}</h3>
</div>
<div class="jointxt">
- <p>我们支持两种注册方式,你可以使用常规的用户名、密码方式注册,或者<a href="{% url user_signin %}">使用OpenID帐号注册</a>。</p>
+ <p>{% trans "We support two types of user registration: conventional username/password, and" %} <a href="{% url user_signin %}">{% trans "the OpenID method" %}</a>.</p>
{% if form.errors %}
<p class="errors">
- <span class="big">请注意以下错误:</span><br>
+ <span class="big">{% trans "Sorry, looks like we have some errors" %}</span><br>
<ul class="error-list">
{% if form.username.errors %}
<li><span class="error">{{ form.username.errors|join:", " }}</span></li>
@@ -30,22 +30,23 @@
</div>
<form action="{% url user_signup %}" method="post" accept-charset="utf-8">
<fieldset class="fieldset">
- <legend class="big">常规注册</legend>
- <div class="form-row"><label for="id_username">选择一个用户名:</label><br>{{ form.username }}</div>
+ <legend class="big">{% trans "Conventional registration" %}</legend>
+ <div class="form-row"><label for="id_username">{% trans "choose a user name" %}:</label><br>{{ form.username }}</div>
- <div class="form-row"><label for="id_email">您的电子邮件地址:</label><br>{{ form.email }}</div>
- <div class="form-row"><label for="id_password1">密码:</label><br />{{ form.password1 }}</div>
- <div class="form-row"><label for="id_password2">确认密码:</label><br>{{ form.password2 }}</div>
- <div class="submit-row"><input type="submit" class="submit" value="注册" > <a href="{% url user_signin %}">返回登录</a></div>
+ <div class="form-row"><label for="id_email">{% trans "your email address" %}:</label><br>{{ form.email }}</div>
+ <div class="form-row"><label for="id_password1">{% trans "choose password" %}:</label><br />{{ form.password1 }}</div>
+ <div class="form-row"><label for="id_password2">{% trans "retype password" %}:</label><br>{{ form.password2 }}</div>
+ <div class="submit-row"><input type="submit" class="submit" value="{% trans "login" %}" >
+ <a href="{% url user_signin %}">{% trans "back to login" %}</a></div>
</fieldset>
<br >
</form>
<br >
<div style="display:none">
- <h2 class="signup">使用OpenID注册</h2>
+ <h2 class="signup">{% trans "Register with your OpenID" %}</h2>
<form name="fopenid" action="{% url user_signin %}" method="post">
<div class="form-row">{{ form2.openid_url }}</div>
- <div class="submit-row "><input name="bsignin" class="submit" type="submit" value="使用OpenID登录"></div>
+ <div class="submit-row "><input name="bsignin" class="submit" type="submit" value="{% trans "Login with your OpenID" %}"></div>
</form>
</div>
{% endblock %}
diff --git a/templates/badge.html b/templates/badge.html
index 4ffedfa6..d0906918 100644
--- a/templates/badge.html
+++ b/templates/badge.html
@@ -1,7 +1,9 @@
+<!-- template badge.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load humanize %}
-{% block title %}{% spaceless %}{{ badge.name }}-奖牌{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{{ badge.name }} - {% trans "Badge" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -12,7 +14,7 @@
{% endblock %}
{% block content %}
<div id="main-bar" class="headNormal">
- 奖牌
+ {% trans "Badge" %}
</div>
<div id="main-body" style="width:100%;margin-bottom:20px">
<p>
@@ -21,7 +23,7 @@
<div>
{% if badge.awarded_count %}
<p style="float:left"><span class="count">{{ awards|length|intcomma }}</span>
- <strong>用户已被授予该奖牌:</strong></p>
+ <strong>{% trans "The users have been awarded with badges:" %}</strong></p>
{% endif %}
</div>
<div id="award-list" style="clear:both;margin-left:20px;line-height:25px;">
@@ -32,7 +34,4 @@
</div>
{% endblock %}
-
-
-
-
+<!-- end template badge.html -->
diff --git a/templates/badges.html b/templates/badges.html
index e8033f13..8a3b7eab 100644
--- a/templates/badges.html
+++ b/templates/badges.html
@@ -1,8 +1,9 @@
+<!-- template badges.html -->
{% extends "base.html" %}
{% load extra_tags %}
{% load humanize %}
{% load i18n %}
-{% block title %}{% spaceless %}{% trans "Badges" %}{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Badges summary" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -13,12 +14,12 @@
{% endblock %}
{% block content %}
<div class="headlineA">
- <span class="headMedals">{% trans "Badges"%}</span>
+ <span class="headMedals">{% trans "Badges" %}</span>
</div>
<div id="main-body" style="width:100%">
<p>
- 提出问题,给予回答,投出你的票 - CNProg 会针对你在社区的表现,授予你各类奖牌。<br>
- 这里列出社区所有的奖牌,以及到目前为此,每个奖牌被授予的用户人数。
+ {% trans "Community gives you awards for your questions, answers and votes." %}<br>
+ {% trans "Below is the list of available badges and number of times each type of badge has been awarded." %}
</p>
<br>
<div id="medalList">
@@ -45,29 +46,33 @@
{% block sidebar %}
<div class="boxB">
- <h3>社区奖牌</h3>
+ <h3>{% trans "Community badges" %}</h3>
<div class="body">
<p>
- <a style="cursor:default;" title="金牌:十分罕见之最高荣耀" class="medal"><span class="badge1">&#9679;</span>&nbsp;金牌</a>
+ <a style="cursor:default;" title="gold badge: the highest honor and is very rare" class="medal"><span class="badge1">&#9679;</span>&nbsp;{% trans "gold" %}</a>
</p>
<p>
- 金牌是十分罕见的。你不仅要参与社区的提问、回答、投票等活动,而且需要有高深的知识和能力才能获得。获得金牌意味着你在某个层次上已经达到了顶峰。
+ {% trans "Gold badge is very rare." %}
+ {% trans "To obtain it you have to show profound knowledge and ability in addition to actively participating in the community." %}
+ {% trans "Gold badge is the highest award in this community." %}
</p>
<p>
- <a style="cursor:default;" title="银牌:偶尔颁发之优质奖章" class="medal"><span class="badge2">&#9679;</span>&nbsp;银牌</a>
+ <a style="cursor:default;"
+ title="silver badge: occasionally awarded for the very high quality contributions"
+ class="medal"><span class="badge2">&#9679;</span>&nbsp;{% trans "silver" %}</a>
</p>
<p>
- 银牌需要经过长时间的奋斗才能获得。它是不同寻常的荣誉,只要你付出足够的努力就会得到。
+ {% trans "Obtaining silver badge requires significant patience." %}
+ {% trans "If you got one, you've very significantly contributed to this community" %}
</p>
<p>
- <a style="cursor:default;" title="铜牌:时常授予之特殊荣誉" class="medal"><span class="badge3">&#9679;</span>&nbsp;铜牌</a>
+ <a style="cursor:default;" title="{% trans "bronze badge: often given as a special honor" %}" class="medal">
+ <span class="badge3">&#9679;</span>&nbsp;{% trans "bronze" %}</a>
</p>
<p>
- 铜牌会在你活跃于社区时产生,它相对容易获得,但也是一种特殊的荣誉。
+ {% trans "If you are active in this community, you will will get this medal - still it is a special honor." %}
</p>
</div>
</div>
{% endblock %}
-
-
-
+<!-- end template badges.html -->
diff --git a/templates/base.html b/templates/base.html
index 90b40612..dca312e3 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,27 +1,34 @@
-{% load extra_filters %}
-{% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- template base.html -->
+{% load extra_filters %}
+{% load i18n %}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{% block title %}{% endblock %} - {{ APP_TITLE }}</title>
+ <title>{% block title %}{% endblock %} - {% trans "site title" %} - {% trans "site slogan" %}</title>
{% spaceless %}
{% block meta %}{% endblock %}
{% endspaceless %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="verify-v1" content="55uGNnQVJW8p1bbXeF/Xbh9I7nZBM/wLhRz6N/I1kkA=" />
+ <meta name="verify-v1" content="{{verify_v1_code}}" />
<link rel="shortcut icon" href="/content/images/favicon.ico" >
<link href="/content/style/style.css" rel="stylesheet" type="text/css" />
- <script type='text/javascript' src='/content/js/com.cnprog.utils.js'></script>
<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1.2.6");</script>
- <script type="text/javascript">
+ <script type="text/javascript">
+ var i18nLang = 'en';
+ </script>
+ <script type='text/javascript' src='/content/js/com.cnprog.i18n.js'></script>
+ <script type='text/javascript' src='/content/js/jquery.i18n.js'></script>
+ <script type='text/javascript' src='/content/js/com.cnprog.utils.js'></script>
+ <!--<script type="text/javascript">
var uservoiceJsHost = ("https:" == document.location.protocol) ? "https://uservoice.com" : "http://cdn.uservoice.com";
document.write(unescape("%3Cscript src='" + uservoiceJsHost + "/javascripts/widgets/tab.js' type='text/javascript'%3E%3C/script%3E"))
</script>
<script type="text/javascript">
UserVoice.Tab.show({
- key: 'cnprog',
- host: 'cnprog.uservoice.com',
+ //EDIT!!!
+ key: 'key',
+ host: 'where.uservoice.com',
forum: 'general',
alignment: 'left', /* 'left', 'right' */
background_color:'#777',
@@ -29,7 +36,8 @@
hover_color: '#06C',
lang: 'en' /* 'en', 'de', 'nl', 'es', 'fr' */
})
- </script>
+ </script>-->
+ <!-- todo move this to settings -->
{% with request.user.get_messages as messages%}
{% if messages %}
<style type="text/css">
@@ -40,7 +48,6 @@
notify.show();
});
</script>
-
{% endif %}
{% endwith %}
@@ -50,9 +57,9 @@
<body>
<div class="notify" style="display:none">
<span>{% if request.user.get_messages %}
- {% trans "Congratulations! You have new badges: " %}{% for message in request.user.get_messages %}
- <font class="darkred">{{ message }}</font>, {% endfor %}{% trans "go to see" %}
- <a href="{{ request.user.get_profile_url }}">{% trans "Profile" %}</a>{% endif %}</span>
+ {% trans "congratulations, community gave you a badge" %}: {% for message in request.user.get_messages %}
+ <font class="darkred">{{ message }}</font>, {% endfor %}查看
+ <a href="{{ request.user.get_profile_url }}">{% trans "profile" %}</a>{% endif %}</span>
<a class="close-notify" onclick="notify.close(true)">&times;</a>
</div>
{% include "header.html" %}
@@ -81,3 +88,4 @@
{% endblock %}
</body>
</html>
+<!-- end template base.html -->
diff --git a/templates/base_content.html b/templates/base_content.html
index 6dec6cae..98a09150 100644
--- a/templates/base_content.html
+++ b/templates/base_content.html
@@ -1,8 +1,9 @@
-{% load i18n %}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!-- template base_content.html -->
+{% load i18n %}
<html>
<head>
- <title>{% block title %}{% endblock %} - {{ APP_TITLE }}</title>
+ <title>{% block title %}{% endblock %} - {% trans "site title" %} - {% trans "site slogan" %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="verify-v1" content="55uGNnQVJW8p1bbXeF/Xbh9I7nZBM/wLhRz6N/I1kkA=" />
<link rel="shortcut icon" href="/content/images/favicon.ico" >
@@ -10,17 +11,24 @@
{% spaceless %}
{% block forestyle %}{% endblock %}
{% endspaceless %}
- <script type='text/javascript' src='/content/js/com.cnprog.utils.js'></script>
<script src="http://www.google.com/jsapi"></script>
- <script>google.load("jquery", "1.2.6");</script>
- <script type="text/javascript">
+ <script>google.load("jquery", "1.2.6");</script>
+ <script type="text/javascript">
+ var i18nLang = 'en';
+ </script>
+ <script type='text/javascript' src='/content/js/com.cnprog.i18n.js'></script>
+ <script type='text/javascript' src='/content/js/jquery.i18n.js'></script>
+ <script type='text/javascript' src='/content/js/com.cnprog.utils.js'></script>
+
+ <!-- <script type="text/javascript">
var uservoiceJsHost = ("https:" == document.location.protocol) ? "https://uservoice.com" : "http://cdn.uservoice.com";
document.write(unescape("%3Cscript src='" + uservoiceJsHost + "/javascripts/widgets/tab.js' type='text/javascript'%3E%3C/script%3E"))
</script>
<script type="text/javascript">
UserVoice.Tab.show({
- key: 'cnprog',
- host: 'cnprog.uservoice.com',
+ //EDIT!!!
+ key: 'uservoicekey',
+ host: 'where.uservoice.com',
forum: 'general',
alignment: 'left', /* 'left', 'right' */
background_color:'#777',
@@ -28,7 +36,8 @@
hover_color: '#06C',
lang: 'en' /* 'en', 'de', 'nl', 'es', 'fr' */
})
- </script>
+ </script>-->
+ <!-- todo move this to settings-->
{% with request.user.get_messages as messages%}
{% if messages %}
@@ -49,10 +58,10 @@
<body>
<div class="notify" style="display:none">
<span>{% if request.user.get_messages %}
- {% trans "Congratulations! You have new badges: " %}{% for message in request.user.get_messages %}
- <font class="darkred">{{ message }}</font>, {% endfor %}{% trans "go to see" %}
- <a href="{{ request.user.get_profile_url }}">{% trans "Profile" %}</a>{% endif %}</span>
- <a class="close-notify" onclick="notify.close(true)">&times;</a>
+ {% trans "congratulations, community gave you a badge" %}:{% for message in request.user.get_messages %}
+ <font class="darkred">{{ message }}</font>, {% endfor %}{% trans "see" %}
+ <a href="{{ request.user.get_profile_url }}">{% trans "profile" %}</a>{% endif %}</span>
+ <a class="close-notify" onclick="notify.close(true)">&times;</a>
</div>
{% include "header.html" %}
<div id="wrapper">
@@ -74,3 +83,4 @@
{% endblock %}
</body>
</html>
+<!-- end template base_content.html -->
diff --git a/templates/book.html b/templates/book.html
index e5d4396b..a58a09f2 100644
--- a/templates/book.html
+++ b/templates/book.html
@@ -1,8 +1,10 @@
+<!-- template book.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load extra_filters %}
{% load humanize %}
-{% block title %}{% spaceless %}{{ book.title }}-读书频道{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{{ book.title }}-{% trans "reading channel" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -21,27 +23,27 @@
<div class="bookSummary">
<table>
<tr>
- <td>【作者】</td>
+ <td>{% trans "[author]" %}</td>
<td><b><a href="{% url user book.user.id %}" rel="nofollow" >{{ book.author }}</a></b></td>
</tr>
<tr>
- <td>【出版社】</td>
+ <td>{% trans "[publisher]" %}</td>
<td>{{ book.publication }}</td>
</tr>
<tr>
- <td>【出版日期】</td>
+ <td>{% trans "[publication date]" %}</td>
<td>{{ book.published_at|date:"Y-m" }}</td>
</tr>
<tr>
- <td>【价格】</td>
- <td>{{ book.price }} 元</td>
+ <td>{% trans "[price]" %}</td>
+ <td>{{ book.price }} {% trans "currency unit" %}</td>
</tr>
<tr>
- <td>【页数】</td>
- <td>{{ book.pages }} 页</td>
+ <td>{% trans "[pages]" %}</td>
+ <td>{{ book.pages }} {% trans "pages abbreviation" %}</td>
</tr>
<tr>
- <td>【标签】</td>
+ <td>{% trans "[tags]" %}</td>
<td>{{ book.tagnames }}</td>
</tr>
<tr>
@@ -51,17 +53,17 @@
{% if author_info.blog_url %}
<tr>
<td></td>
- <td><a href="{{ author_info.blog_url }}" rel="nofollow" >作者博客 »</a></td>
+ <td><a href="{{ author_info.blog_url }}" rel="nofollow" >{% trans "author blog" %} »</a></td>
</tr>
{% endif %}
<tr>
<td> </td>
- <td><a href="#" rel="nofollow">书籍目录 »</a></td>
+ <td><a href="#" rel="nofollow">{% trans "book directory" %} »</a></td>
</tr>
<tr>
<td> </td>
- <td><a href="#" rel="nofollow">网上购买 »</a></td>
+ <td><a href="#" rel="nofollow">{% trans "buy online" %} »</a></td>
</tr>
</table>
</div>
@@ -74,21 +76,21 @@
<div class="tabBar">
<div class="tabsB">
- <a id="qa" class="on" title="图书相关的技术答疑" href="#">答读者问</a>
+ <a id="qa" class="on" title="{% trans "book technical Q&A %}" href="#">{% trans "reader questions" %}</a>
</div>
</div>
- <div class="bookAsk"><a href="{% url ask_book book.short_name %}">向作者提问</div>
+ <div class="bookAsk"><a href="{% url ask_book book.short_name %}">{% trans "ask the author" %}</div>
<div class="user-stats-table">
{% for question in questions.object_list %}
{% if question.favourite_count %}
{% if question.favorited_myself %}
<div class="favorites-count">
- <img title="这个问题被 {{question.favourite_count}} 位用户收藏" src="/content/images/vote-favorite-on.png">
+ <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="/content/images/vote-favorite-on.png">
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% else %}
<div class="favorites-count-off">
- <img title="这个问题被 {{question.favourite_count}} 位用户收藏" src="/content/images/vote-favorite-off.png">
+ <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="/content/images/vote-favorite-off.png">
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% endif %}
@@ -100,17 +102,17 @@
<div class="stats">
<div class="votes">
<div class="vote-count-post">{{question.score|intcomma}}</div>
- 票
+ {% trans "votes" %}
</div>
- <div title="{% if question.answer_accepted %}有答案已被接受为正确答案{% endif %}" class="status {% if question.answer_accepted %}answered-accepted{% endif %} {% ifequal question.answer_count 0 %}unanswered{% endifequal %}{% ifnotequal question.answer_count 0 %}answered{% endifnotequal %}">
+ <div title="{% if question.answer_accepted %}{% trans "the answer has been accepted to be correct" %}{% endif %}" class="status {% if question.answer_accepted %}answered-accepted{% endif %} {% ifequal question.answer_count 0 %}unanswered{% endifequal %}{% ifnotequal question.answer_count 0 %}answered{% endifnotequal %}">
<div class="answer-count-post">{{question.answer_count|intcomma}}</div>
- 回答
-
+ {% trans "answer" %}
+
</div>
<div class="views">
<div class="views-count-post">{{question.view_count|cnprog_intword|safe}}</div>
- 浏览
+ {% trans "views" %}
</div>
</div>
</a>
@@ -120,7 +122,7 @@
</h3>
<div class="tags">
{% for tag in question.tagname_list %}
- <a href="{% url forum.views.tag tag|urlencode %}" title="查看有关'{{ tag }}'的问题" rel="tag">{{ tag }}</a>
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% "see questions tagged with" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
{% endfor %}
</div>
<div class="started">
@@ -136,15 +138,15 @@
</div>
{% endblock %}
{% block tail %}
-
<div class="pager">
{% cnprog_paginator context %}
</div>
<div class="bookFeed">
<div id="feeds">
- <a href="/feeds/rss" title="RSS订阅该图书最新问题">订阅最新问题</a>
+ <a href="/feeds/rss" title="{% trans "subscribe to book RSS feed" %}">{% trans "subscribe to the questions feed" %}</a>
</div>
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}
+<!-- end template book.html -->
diff --git a/templates/close.html b/templates/close.html
index 04a22f18..32df3e82 100644
--- a/templates/close.html
+++ b/templates/close.html
@@ -1,7 +1,9 @@
+<!-- template close.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load humanize %}
-{% block title %}{% spaceless %}关闭问题{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Close question" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -11,26 +13,24 @@
{% endblock %}
{% block content %}
<div id="main-bar" class="headNormal">
- 关闭问题
+ {% trans "Close question" %}
</div>
<div id="main-body" style="width:100%;margin-bottom:10px">
- <p>由于以下原因,你要关闭这个问题: <a href="{{ question.get_absolute_url }}">
+ <p>{% trans "Close the question" %}: <a href="{{ question.get_absolute_url }}">
<strong>{{ question.get_question_title }}</strong></a>
</p>
<form id="fmclose" action="{% url close question.id %}" method="post" >
<p>
- <strong>原因:</strong> {{ form.reason }}
+ <strong>{% trans "Reasons" %}:</strong> {{ form.reason }}
</p>
<div id="" style="padding-top:20px">
- <input type="submit" value="确定关闭" class="submit" />
- <input id="btBack" type="button" class="submit" value="取消" />
+ <input type="submit" value="{% trans "OK to close" %}" class="submit" />
+ <input id="btBack" type="button" class="submit" value="{% trans "Cancel" %}" />
</div>
</form>
</div>
{% endblock %}
-
-
-
+<!-- end template close.html -->
diff --git a/templates/content/js/com.cnprog.i18n.js b/templates/content/js/com.cnprog.i18n.js
new file mode 100644
index 00000000..2d8c90a6
--- /dev/null
+++ b/templates/content/js/com.cnprog.i18n.js
@@ -0,0 +1,90 @@
+// Evgeny Fadeev evgeny.fadeev@gmail.com localized for english and chinese
+// i18nLang variable must be set in html header to extract correct language
+var i18nZh = {
+ 'insufficient privilege':'用户权限不在操作范围',
+ 'cannot pick own answer as best':'不能设置自己的回答为最佳答案',
+ 'anonymous users cannot select favorite questions':'匿名用户不能收藏问题,请先',
+ 'please login':'注册或者登录',
+ 'anonymous users cannot vote':'匿名用户不能投票',
+ '>15 points requried to upvote':'需要+15积分才能投支持票。',
+ '>100 points required to downvote':'需要+100积分才能投反对票。',
+ 'please see': '查看',
+ 'cannot vote for own posts':'不能给自己的帖子投票',
+ 'daily vote cap exhausted':'对不起,您已用完今日所有的投票。',
+ 'cannot revoke old vote':'这个投票已经过时,不能撤销。',
+ 'please confirm offensive':"确定要归类该帖为广告、人身攻击、恶意言论吗?",
+ 'anonymous users cannot flag offensive posts':'匿名用户不能操作,请先',
+ 'cannot flag message as offensive twice':'不能重复操作。',
+ 'flag offensive cap exhausted':'对不起,您已用完今日所有的5次‘水帖’操作。',
+ 'need >15 points to report spam':"需要+15积分才能归类‘垃圾帖’。",
+ 'confirm delete':"确定要删除/撤销删除该帖吗?",
+ 'anonymous users cannot delete/undelete':"匿名用户不能删除或撤销删除帖子",
+ 'post recovered':"操作成功!该帖子已被恢复。",
+ 'post deleted':"操作成功!该帖子已删除。",
+ 'add comment':'添加评论',
+ 'community reputation points':'社区积分',
+ 'to comment, need':'评论需要',
+ 'delete this comment':'删除此评论',
+ 'hide comments':"隐藏评论",
+ 'add a comment':"添加评论",
+ 'comments':"评论",
+ 'confirm delete comment':"真要删除此评论吗?",
+ 'characters':'字符',
+ 'can write':'还可写',
+ 'click to close':'点击消息框关闭',
+ 'loading...':'读取中...',
+ 'tags cannot be empty':'标签不能为空。',
+ 'tablimits info':"最多5个标签,每个标签长度小于20个字符。",
+ 'content cannot be empty':'内容不能为空。',
+ 'content minchars': '请输入至少 {0} 字符。',
+ 'please enter title':'请输入标题。',
+ 'title minchars':"请输入至少 {0} 字符。",
+ 'delete':'删除',
+ 'undelete': '取消',
+ 'bold':'粗体',
+ 'italic':'斜体',
+ 'link':'超链接',
+ 'quote':'引用',
+ 'preformatted text':'代码',
+ 'image':'图片',
+ 'numbered list':'数字编号列表',
+ 'bulleted list':'项目符号列表',
+ 'heading':'标题',
+ 'horizontal bar':'水平线',
+ 'undo':'撤销',
+ 'redo':'重做',
+ 'enter image url':'<b>输入图片地址</b></p><p>示例:<br />http://www.example.com/image.jpg \"我的截图\"',
+ 'enter url':'<b>输入Web地址</b></p><p>示例:<br />http://www.cnprog.com/ \"我的网站\"</p>"',
+ 'upload image':'或者上传本地图片:',
+};
+
+var i18nEn = {
+ 'to comment, need': 'to comment, need reputation ',
+ 'please see':'please see ',
+ 'community reputation points':' ',
+ 'upload image':'Upload image:',
+ 'enter image url':'enter URL of the image, e.g. http://www.example.com/image.jpg \"image title\"',
+ 'enter url':'enter Web address, e.g. http://www.example.com \"page title\"',
+ 'daily vote cap exhausted':'sorry, you\'ve used up todays vote cap',
+ 'cannot pick own answer as best':'cannot accept own answer',
+ 'cannot revoke old vote':'older votes cannot be revoked',
+ 'please confirm offensive':'are you sure this post is offensive, contains spam, advertising, malicious remarks, etc.?',
+ 'flag offensive cap exhausted':'sorry, you\'ve used up todays cap of flagging offensive messages',
+ 'confirm delete':'are you sure you want to delete this?',
+ 'anonymous users cannot delete/undelete':'anonymous users cannot delete or undelete posts',
+ 'post recovered':'your post is now restored!',
+ 'post deleted':'your post has been deleted',
+ 'confirm delete comment':'do you really want to delete this comment?',
+ 'can write':'have ',
+ 'tablimits info':'up to 5 tags, no more than 20 characters each',
+ 'content minchars': 'please enter more than {0} characters',
+ 'title minchars':"please enter at least {0} characters",
+ 'characters':'characters left',
+};
+
+var i18n = {
+ 'en':i18nEn,
+ 'zh':i18nZh
+};
+
+var i18n_dict = i18n[i18nLang];
diff --git a/templates/content/js/com.cnprog.post.js b/templates/content/js/com.cnprog.post.js
index dbf5d128..bd4b00fd 100644
--- a/templates/content/js/com.cnprog.post.js
+++ b/templates/content/js/com.cnprog.post.js
@@ -49,24 +49,37 @@ var Vote = function(){
var removeQuestionLinkIdPrefix = 'question-delete-link-';
var removeAnswerLinkIdPrefix = 'answer-delete-link-';
- var acceptAnonymousMessage = "用户权限不在操作范围";
- var acceptOwnAnswerMessage = "不能设置自己的回答为最佳答案";
- var favoriteAnonymousMessage = "匿名用户不能收藏问题,请先<a href='/account/signin/?next=/questions/{{QuestionID}}'>注册或者登录</a>";
- var voteAnonymousMessage = "匿名用户不能投票,请先<a href='/account/signin/?next=/questions/{{QuestionID}}'>注册或者登录</a>";
- var upVoteRequiredScoreMessage = "需要+15积分才能投支持票。查看<a href='/faq'>faq</a>";
- var downVoteRequiredScoreMessage = "需要+100积分才能投反对票。查看<a href='/faq'>faq</a>";
- var voteOwnDeniedMessage = "不能给自己的帖子投票";
- var voteRequiredMoreVotes = "对不起,您已用完今日所有的投票。查看<a href='/faq'>faq</a>";
- var voteDenyCancelMessage = "这个投票已经过时,不能撤销。查看<a href='/faq'>faq</a>";
- var offensiveConfirmation = "确定要归类该帖为广告、人身攻击、恶意言论吗?";
- var offensiveAnonymousMessage = "匿名用户不能操作,请先<a href='/account/signin/?next=/questions/{{QuestionID}}'>注册或者登录</a>";
- var offensiveTwiceMessage = "不能重复操作。查看<a href='/faq'>faq</a>";
- var offensiveNoFlagsLeftMessage = "对不起,您已用完今日所有的5次‘水帖’操作。查看<a href='/faq'>faq</a>";
- var offensiveNoPermissionMessage = "需要+15积分才能归类‘垃圾帖’。查看<a href='/faq'>faq</a>";
- var removeConfirmation = "确定要删除/撤销删除该帖吗?";
- var removeAnonymousMessage = "匿名用户不能删除或撤销删除帖子";
- var recoveredMessage = "操作成功!该帖子已被恢复。";
- var deletedMessage = "操作成功!该帖子已删除。"
+ var acceptAnonymousMessage = $.i18n._('insufficient privilege');
+ var acceptOwnAnswerMessage = $.i18n._('cannot pick own answer as best');
+ var favoriteAnonymousMessage = $.i18n._('anonymous user cannot select favorite questions')
+ + "<a href='/account/signin/?next=/questions/{{QuestionID}}'>"
+ + $.i18n._('please login') + "</a>";
+ var voteAnonymousMessage = $.i18n._('anonymous users cannot vote')
+ + "<a href='/account/signin/?next=/questions/{{QuestionID}}'>"
+ + $.i18n._('please login') + "</a>";
+ var upVoteRequiredScoreMessage = $.i18n._('>15 points requried to upvote')
+ + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var downVoteRequiredScoreMessage = $.i18n._('>100 points requried to downvote')
+ + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var voteOwnDeniedMessage = $.i18n._('cannot vote for own posts');
+ var voteRequiredMoreVotes = $.i18n._('daily vote cap exhausted')
+ + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var voteDenyCancelMessage = $.i18n._('cannot revoke old vote')
+ + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var offensiveConfirmation = $.i18n._('please confirm offensive');
+ var offensiveAnonymousMessage = $.i18n._('anonymous users cannot flag offensive posts')
+ + "<a href='/account/signin/?next=/questions/{{QuestionID}}'>"
+ + $.i18n._('please login') + "</a>";
+ var offensiveTwiceMessage = $.i18n._('cannot flag message as offensive twice')
+ + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var offensiveNoFlagsLeftMessage = $.i18n._('flag offensive cap exhausted')
+ + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var offensiveNoPermissionMessage = $.i18n._('need >15 points to report spam')
+ + $.i18n._('please see') + "<a href='/faq'>faq</a>";
+ var removeConfirmation = $.i18n._('confirm delete');
+ var removeAnonymousMessage = $.i18n._('anonymous users cannot delete/undelete');
+ var recoveredMessage = $.i18n._('post recovered');
+ var deletedMessage = $.i18n._('post deleted');
var VoteType = {
acceptAnswer : 0,
@@ -201,7 +214,7 @@ var Vote = function(){
});
getremoveQuestionLink().unbind('click').click(function(event){
- Vote.remove(this, VoteType.removeQuestion)
+ Vote.remove(this, VoteType.removeQuestion);
});
getremoveAnswersLinks().unbind('click').click(function(event){
@@ -330,15 +343,22 @@ var Vote = function(){
};
var callback_remove = function(object, voteType, data){
+ alert(data.status);
if(data.allowed == "0" && data.success == "0"){
showMessage(object, removeAnonymousMessage.replace("{{QuestionID}}", questionId));
}
- else if(data.status == "1"){
- showMessage(object, recoveredMessage);
- }
- else if(data.success == "1"){
- showMessage(object, deletedMessage);
- }
+ else if (data.success == "1"){
+ if (removeActionType == 'delete'){
+ postNode.addClass('deleted');
+ postRemoveLink.innerHTML = $.i18n._('undelete');
+ showMessage(object, deletedMessage);
+ }
+ else if (removeActionType == 'undelete') {
+ postNode.removeClass('deleted');
+ postRemoveLink.innerHTML = $.i18n._('delete');
+ showMessage(object, recoveredMessage);
+ }
+ }
};
return {
@@ -395,8 +415,23 @@ var Vote = function(){
return false;
}
if(confirm(removeConfirmation)){
- postId = object.id.substr(object.id.lastIndexOf('-') + 1);
+ bits = object.id.split('-');
+ postId = bits.pop();/* this seems to be used within submit! */
+ postType = bits.shift();
+
+ if (postType == 'answer'){
+ postNode = $('#answer-container-' + postId);
+ postRemoveLink = object;
+ if (postNode.hasClass('deleted')){
+ removeActionType = 'undelete';
+ }
+ else {
+ removeActionType = 'delete';
+ }
+ }
submit($(object), voteType, callback_remove);
+
+
}
}
}
@@ -426,7 +461,8 @@ function createComments(type) {
var form = '<form id="' + formId + '" class="post-comments"><div>';
form += '<textarea name="comment" cols="60" rows="5" maxlength="300" onblur="'+ objectType +'Comments.updateTextCounter(this)" ';
form += 'onfocus="' + objectType + 'Comments.updateTextCounter(this)" onkeyup="'+ objectType +'Comments.updateTextCounter(this)"></textarea>';
- form += '<input type="submit" value="添加评论" /><br><span class="text-counter"></span>';
+ form += '<input type="submit" value="'
+ + $.i18n._('add comment') + '" /><br><span class="text-counter"></span>';
form += '<span class="form-error"></span></div></form>';
jDiv.append(form);
@@ -439,7 +475,10 @@ function createComments(type) {
else {
var divId = "comments-rep-needed-" + objectType + '-' + id;
if (jDiv.find("#" + divId).length == 0) {
- jDiv.append('<div id="' + divId + '" style="color:red">评论需要 ' + repNeededForComments + ' 社区积分 - <a href="/faq" class="comment-user">查看faq</a></span>');
+ jDiv.append('<div id="' + divId + '" style="color:red">'
+ + $.i18n._('to comment, need') + ' ' +
+ + repNeededForComments + ' ' + $.i18n._('community reputation points')
+ + '<a href="/faq" class="comment-user">' + $.i18n._('please see') + 'faq</a></span>');
}
}
};
@@ -477,7 +516,7 @@ function createComments(type) {
var imgHover = "/content/images/close-small-hover.png";
html += '<img onclick="' + objectType + 'Comments.deleteComment($(this), ' + json.object_id + ', \'' + json.delete_url + '\')" src="' + img;
html += '" onmouseover="$(this).attr(\'src\', \'' + imgHover + '\')" onmouseout="$(this).attr(\'src\', \'' + img
- html += '\')" title="删除此评论" />';
+ html += '\')" title="' + $.i18n._('delete this comment') + '" />';
}
html += '</div>';
@@ -524,13 +563,15 @@ function createComments(type) {
renderForm(id, jDiv);
jDiv.show();
if (canPostComments(id, jDiv)) jDiv.find("textarea").get(0).focus();
- jDiv.siblings("a").unbind("click").click(function() { commentsFactory[objectType].hide(id); }).text("隐藏评论");
+ jDiv.siblings("a").unbind("click").click(function(){
+ commentsFactory[objectType].hide(id);
+ }).text($.i18n._('hide comments'));
},
hide: function(id) {
var jDiv = jDivInit(id);
var len = jDiv.children("div.comments").children().length;
- var anchorText = len == 0 ? "添加评论" : "评论 (<b>" + len + "</b>)";
+ var anchorText = len == 0 ? $.i18n._('add a comment') : $.i18n._('comments') + ' (<b>' + len + "</b>)";
jDiv.hide();
jDiv.siblings("a").unbind("click").click(function() { commentsFactory[objectType].show(id); }).html(anchorText);
@@ -538,7 +579,7 @@ function createComments(type) {
},
deleteComment: function(jImg, id, deleteUrl) {
- if (confirm("真要删除此评论吗?")) {
+ if (confirm($.i18n._('confirm delete comment'))) {
jImg.hide();
appendLoaderImg(id);
$.post(deleteUrl, { dataNeeded: "forIIS7" }, function(json) {
@@ -551,7 +592,9 @@ function createComments(type) {
var length = textarea.value ? textarea.value.length : 0;
var color = length > 270 ? "#f00" : length > 200 ? "#f60" : "#999";
var jSpan = $(textarea).siblings("span.text-counter");
- jSpan.html('还可写' + (300 - length) + ' 字符').css("color", color);
+ jSpan.html($.i18n._('can write')
+ + (300 - length) + ' '
+ + $.i18n._('characters')).css("color", color);
}
};
}
@@ -570,4 +613,4 @@ var commentsFactory = {'question' : questionComments, 'answer' : answerComments}
Prettify
http://www.apache.org/licenses/LICENSE-2.0
*/
-var PR_SHOULD_USE_CONTINUATION = true; var PR_TAB_WIDTH = 8; var PR_normalizedHtml; var PR; var prettyPrintOne; var prettyPrint; function _pr_isIE6() { var isIE6 = navigator && navigator.userAgent && /\bMSIE 6\./.test(navigator.userAgent); _pr_isIE6 = function() { return isIE6; }; return isIE6; } (function() { function wordSet(words) { words = words.split(/ /g); var set = {}; for (var i = words.length; --i >= 0; ) { var w = words[i]; if (w) { set[w] = null; } } return set; } var FLOW_CONTROL_KEYWORDS = "break continue do else for if return while "; var C_KEYWORDS = FLOW_CONTROL_KEYWORDS + "auto case char const default " + "double enum extern float goto int long register short signed sizeof " + "static struct switch typedef union unsigned void volatile "; var COMMON_KEYWORDS = C_KEYWORDS + "catch class delete false import " + "new operator private protected public this throw true try "; var CPP_KEYWORDS = COMMON_KEYWORDS + "alignof align_union asm axiom bool " + "concept concept_map const_cast constexpr decltype " + "dynamic_cast explicit export friend inline late_check " + "mutable namespace nullptr reinterpret_cast static_assert static_cast " + "template typeid typename typeof using virtual wchar_t where "; var JAVA_KEYWORDS = COMMON_KEYWORDS + "boolean byte extends final finally implements import instanceof null " + "native package strictfp super synchronized throws transient "; var CSHARP_KEYWORDS = JAVA_KEYWORDS + "as base by checked decimal delegate descending event " + "fixed foreach from group implicit in interface internal into is lock " + "object out override orderby params readonly ref sbyte sealed " + "stackalloc string select uint ulong unchecked unsafe ushort var "; var JSCRIPT_KEYWORDS = COMMON_KEYWORDS + "debugger eval export function get null set undefined var with " + "Infinity NaN "; var PERL_KEYWORDS = "caller delete die do dump elsif eval exit foreach for " + "goto if import last local my next no our print package redo require " + "sub undef unless until use wantarray while BEGIN END "; var PYTHON_KEYWORDS = FLOW_CONTROL_KEYWORDS + "and as assert class def del " + "elif except exec finally from global import in is lambda " + "nonlocal not or pass print raise try with yield " + "False True None "; var RUBY_KEYWORDS = FLOW_CONTROL_KEYWORDS + "alias and begin case class def" + " defined elsif end ensure false in module next nil not or redo rescue " + "retry self super then true undef unless until when yield BEGIN END "; var SH_KEYWORDS = FLOW_CONTROL_KEYWORDS + "case done elif esac eval fi " + "function in local set then until "; var ALL_KEYWORDS = (CPP_KEYWORDS + CSHARP_KEYWORDS + JSCRIPT_KEYWORDS + PERL_KEYWORDS + PYTHON_KEYWORDS + RUBY_KEYWORDS + SH_KEYWORDS); var PR_STRING = 'str'; var PR_KEYWORD = 'kwd'; var PR_COMMENT = 'com'; var PR_TYPE = 'typ'; var PR_LITERAL = 'lit'; var PR_PUNCTUATION = 'pun'; var PR_PLAIN = 'pln'; var PR_TAG = 'tag'; var PR_DECLARATION = 'dec'; var PR_SOURCE = 'src'; var PR_ATTRIB_NAME = 'atn'; var PR_ATTRIB_VALUE = 'atv'; var PR_NOCODE = 'nocode'; function isWordChar(ch) { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); } function spliceArrayInto(inserted, container, containerPosition, countReplaced) { inserted.unshift(containerPosition, countReplaced || 0); try { container.splice.apply(container, inserted); } finally { inserted.splice(0, 2); } } var REGEXP_PRECEDER_PATTERN = function() { var preceders = ["!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=", "&=", "(", "*", "*=", "+=", ",", "-=", "->", "/", "/=", ":", "::", ";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[", "^", "^=", "^^", "^^=", "{", "|", "|=", "||", "||=", "~", "break", "case", "continue", "delete", "do", "else", "finally", "instanceof", "return", "throw", "try", "typeof"]; var pattern = '(?:' + '(?:(?:^|[^0-9.])\\.{1,3})|' + '(?:(?:^|[^\\+])\\+)|' + '(?:(?:^|[^\\-])-)'; for (var i = 0; i < preceders.length; ++i) { var preceder = preceders[i]; if (isWordChar(preceder.charAt(0))) { pattern += '|\\b' + preceder; } else { pattern += '|' + preceder.replace(/([^=<>:&])/g, '\\$1'); } } pattern += '|^)\\s*$'; return new RegExp(pattern); } (); var pr_amp = /&/g; var pr_lt = /</g; var pr_gt = />/g; var pr_quot = /\"/g; function attribToHtml(str) { return str.replace(pr_amp, '&amp;').replace(pr_lt, '&lt;').replace(pr_gt, '&gt;').replace(pr_quot, '&quot;'); } function textToHtml(str) { return str.replace(pr_amp, '&amp;').replace(pr_lt, '&lt;').replace(pr_gt, '&gt;'); } var pr_ltEnt = /&lt;/g; var pr_gtEnt = /&gt;/g; var pr_aposEnt = /&apos;/g; var pr_quotEnt = /&quot;/g; var pr_ampEnt = /&amp;/g; var pr_nbspEnt = /&nbsp;/g; function htmlToText(html) { var pos = html.indexOf('&'); if (pos < 0) { return html; } for (--pos; (pos = html.indexOf('&#', pos + 1)) >= 0; ) { var end = html.indexOf(';', pos); if (end >= 0) { var num = html.substring(pos + 3, end); var radix = 10; if (num && num.charAt(0) === 'x') { num = num.substring(1); radix = 16; } var codePoint = parseInt(num, radix); if (!isNaN(codePoint)) { html = (html.substring(0, pos) + String.fromCharCode(codePoint) + html.substring(end + 1)); } } } return html.replace(pr_ltEnt, '<').replace(pr_gtEnt, '>').replace(pr_aposEnt, "'").replace(pr_quotEnt, '"').replace(pr_ampEnt, '&').replace(pr_nbspEnt, ' '); } function isRawContent(node) { return 'XMP' === node.tagName; } function normalizedHtml(node, out) { switch (node.nodeType) { case 1: var name = node.tagName.toLowerCase(); out.push('<', name); for (var i = 0; i < node.attributes.length; ++i) { var attr = node.attributes[i]; if (!attr.specified) { continue; } out.push(' '); normalizedHtml(attr, out); } out.push('>'); for (var child = node.firstChild; child; child = child.nextSibling) { normalizedHtml(child, out); } if (node.firstChild || !/^(?:br|link|img)$/.test(name)) { out.push('<\/', name, '>'); } break; case 2: out.push(node.name.toLowerCase(), '="', attribToHtml(node.value), '"'); break; case 3: case 4: out.push(textToHtml(node.nodeValue)); break; } } var PR_innerHtmlWorks = null; function getInnerHtml(node) { if (null === PR_innerHtmlWorks) { var testNode = document.createElement('PRE'); testNode.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />')); PR_innerHtmlWorks = !/</.test(testNode.innerHTML); } if (PR_innerHtmlWorks) { var content = node.innerHTML; if (isRawContent(node)) { content = textToHtml(content); } return content; } var out = []; for (var child = node.firstChild; child; child = child.nextSibling) { normalizedHtml(child, out); } return out.join(''); } function makeTabExpander(tabWidth) { var SPACES = ' '; var charInLine = 0; return function(plainText) { var out = null; var pos = 0; for (var i = 0, n = plainText.length; i < n; ++i) { var ch = plainText.charAt(i); switch (ch) { case '\t': if (!out) { out = []; } out.push(plainText.substring(pos, i)); var nSpaces = tabWidth - (charInLine % tabWidth); charInLine += nSpaces; for (; nSpaces >= 0; nSpaces -= SPACES.length) { out.push(SPACES.substring(0, nSpaces)); } pos = i + 1; break; case '\n': charInLine = 0; break; default: ++charInLine; } } if (!out) { return plainText; } out.push(plainText.substring(pos)); return out.join(''); }; } var pr_chunkPattern = /(?:[^<]+|<!--[\s\S]*?-->|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g; var pr_commentPrefix = /^<!--/; var pr_cdataPrefix = /^<\[CDATA\[/; var pr_brPrefix = /^<br\b/i; var pr_tagNameRe = /^<(\/?)([a-zA-Z]+)/; function extractTags(s) { var matches = s.match(pr_chunkPattern); var sourceBuf = []; var sourceBufLen = 0; var extractedTags = []; if (matches) { for (var i = 0, n = matches.length; i < n; ++i) { var match = matches[i]; if (match.length > 1 && match.charAt(0) === '<') { if (pr_commentPrefix.test(match)) { continue; } if (pr_cdataPrefix.test(match)) { sourceBuf.push(match.substring(9, match.length - 3)); sourceBufLen += match.length - 12; } else if (pr_brPrefix.test(match)) { sourceBuf.push('\n'); ++sourceBufLen; } else { if (match.indexOf(PR_NOCODE) >= 0 && isNoCodeTag(match)) { var name = match.match(pr_tagNameRe)[2]; var depth = 1; end_tag_loop: for (var j = i + 1; j < n; ++j) { var name2 = matches[j].match(pr_tagNameRe); if (name2 && name2[2] === name) { if (name2[1] === '/') { if (--depth === 0) { break end_tag_loop; } } else { ++depth; } } } if (j < n) { extractedTags.push(sourceBufLen, matches.slice(i, j + 1).join('')); i = j; } else { extractedTags.push(sourceBufLen, match); } } else { extractedTags.push(sourceBufLen, match); } } } else { var literalText = htmlToText(match); sourceBuf.push(literalText); sourceBufLen += literalText.length; } } } return { source: sourceBuf.join(''), tags: extractedTags }; } function isNoCodeTag(tag) { return !!tag.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g, ' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/); } function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) { var shortcuts = {}; (function() { var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns); for (var i = allPatterns.length; --i >= 0; ) { var patternParts = allPatterns[i]; var shortcutChars = patternParts[3]; if (shortcutChars) { for (var c = shortcutChars.length; --c >= 0; ) { shortcuts[shortcutChars.charAt(c)] = patternParts; } } } })(); var nPatterns = fallthroughStylePatterns.length; var notWs = /\S/; return function(sourceCode, opt_basePos) { opt_basePos = opt_basePos || 0; var decorations = [opt_basePos, PR_PLAIN]; var lastToken = ''; var pos = 0; var tail = sourceCode; while (tail.length) { var style; var token = null; var match; var patternParts = shortcuts[tail.charAt(0)]; if (patternParts) { match = tail.match(patternParts[1]); token = match[0]; style = patternParts[0]; } else { for (var i = 0; i < nPatterns; ++i) { patternParts = fallthroughStylePatterns[i]; var contextPattern = patternParts[2]; if (contextPattern && !contextPattern.test(lastToken)) { continue; } match = tail.match(patternParts[1]); if (match) { token = match[0]; style = patternParts[0]; break; } } if (!token) { style = PR_PLAIN; token = tail.substring(0, 1); } } decorations.push(opt_basePos + pos, style); pos += token.length; tail = tail.substring(token.length); if (style !== PR_COMMENT && notWs.test(token)) { lastToken = token; } } return decorations; }; } var PR_MARKUP_LEXER = createSimpleLexer([], [[PR_PLAIN, /^[^<]+/, null], [PR_DECLARATION, /^<!\w[^>]*(?:>|$)/, null], [PR_COMMENT, /^<!--[\s\S]*?(?:-->|$)/, null], [PR_SOURCE, /^<\?[\s\S]*?(?:\?>|$)/, null], [PR_SOURCE, /^<%[\s\S]*?(?:%>|$)/, null], [PR_SOURCE, /^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i, null], [PR_TAG, /^<\/?\w[^<>]*>/, null]]); var PR_SOURCE_CHUNK_PARTS = /^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/; function tokenizeMarkup(source) { var decorations = PR_MARKUP_LEXER(source); for (var i = 0; i < decorations.length; i += 2) { if (decorations[i + 1] === PR_SOURCE) { var start, end; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var sourceChunk = source.substring(start, end); var match = sourceChunk.match(PR_SOURCE_CHUNK_PARTS); if (match) { decorations.splice(i, 2, start, PR_TAG, start + match[1].length, PR_SOURCE, start + match[1].length + (match[2] || '').length, PR_TAG); } } } return decorations; } var PR_TAG_LEXER = createSimpleLexer([[PR_ATTRIB_VALUE, /^\'[^\']*(?:\'|$)/, null, "'"], [PR_ATTRIB_VALUE, /^\"[^\"]*(?:\"|$)/, null, '"'], [PR_PUNCTUATION, /^[<>\/=]+/, null, '<>/=']], [[PR_TAG, /^[\w:\-]+/, /^</], [PR_ATTRIB_VALUE, /^[\w\-]+/, /^=/], [PR_ATTRIB_NAME, /^[\w:\-]+/, null], [PR_PLAIN, /^\s+/, null, ' \t\r\n']]); function splitTagAttributes(source, decorations) { for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; if (style === PR_TAG) { var start, end; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var chunk = source.substring(start, end); var subDecorations = PR_TAG_LEXER(chunk, start); spliceArrayInto(subDecorations, decorations, i, 2); i += subDecorations.length - 2; } } return decorations; } function sourceDecorator(options) { var shortcutStylePatterns = [], fallthroughStylePatterns = []; if (options.tripleQuotedStrings) { shortcutStylePatterns.push([PR_STRING, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, '\'"']); } else if (options.multiLineStrings) { shortcutStylePatterns.push([PR_STRING, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, '\'"`']); } else { shortcutStylePatterns.push([PR_STRING, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, '"\'']); } fallthroughStylePatterns.push([PR_PLAIN, /^(?:[^\'\"\`\/\#]+)/, null, ' \r\n']); if (options.hashComments) { shortcutStylePatterns.push([PR_COMMENT, /^#[^\r\n]*/, null, '#']); } if (options.cStyleComments) { fallthroughStylePatterns.push([PR_COMMENT, /^\/\/[^\r\n]*/, null]); fallthroughStylePatterns.push([PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null]); } if (options.regexLiterals) { var REGEX_LITERAL = ('^/(?=[^/*])' + '(?:[^/\\x5B\\x5C]' + '|\\x5C[\\s\\S]' + '|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+' + '(?:/|$)'); fallthroughStylePatterns.push([PR_STRING, new RegExp(REGEX_LITERAL), REGEXP_PRECEDER_PATTERN]); } var keywords = wordSet(options.keywords); options = null; var splitStringAndCommentTokens = createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns); var styleLiteralIdentifierPuncRecognizer = createSimpleLexer([], [[PR_PLAIN, /^\s+/, null, ' \r\n'], [PR_PLAIN, /^[a-z_$@][a-z_$@0-9]*/i, null], [PR_LITERAL, /^0x[a-f0-9]+[a-z]/i, null], [PR_LITERAL, /^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i, null, '123456789'], [PR_PUNCTUATION, /^[^\s\w\.$@]+/, null]]); function splitNonStringNonCommentTokens(source, decorations) { for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; if (style === PR_PLAIN) { var start, end, chunk, subDecs; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; chunk = source.substring(start, end); subDecs = styleLiteralIdentifierPuncRecognizer(chunk, start); for (var j = 0, m = subDecs.length; j < m; j += 2) { var subStyle = subDecs[j + 1]; if (subStyle === PR_PLAIN) { var subStart = subDecs[j]; var subEnd = j + 2 < m ? subDecs[j + 2] : chunk.length; var token = source.substring(subStart, subEnd); if (token === '.') { subDecs[j + 1] = PR_PUNCTUATION; } else if (token in keywords) { subDecs[j + 1] = PR_KEYWORD; } else if (/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(token)) { subDecs[j + 1] = token.charAt(0) === '@' ? PR_LITERAL : PR_TYPE; } } } spliceArrayInto(subDecs, decorations, i, 2); i += subDecs.length - 2; } } return decorations; } return function(sourceCode) { var decorations = splitStringAndCommentTokens(sourceCode); decorations = splitNonStringNonCommentTokens(sourceCode, decorations); return decorations; }; } var decorateSource = sourceDecorator({ keywords: ALL_KEYWORDS, hashComments: true, cStyleComments: true, multiLineStrings: true, regexLiterals: true }); function splitSourceNodes(source, decorations) { for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; if (style === PR_SOURCE) { var start, end; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var subDecorations = decorateSource(source.substring(start, end)); for (var j = 0, m = subDecorations.length; j < m; j += 2) { subDecorations[j] += start; } spliceArrayInto(subDecorations, decorations, i, 2); i += subDecorations.length - 2; } } return decorations; } function splitSourceAttributes(source, decorations) { var nextValueIsSource = false; for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; var start, end; if (style === PR_ATTRIB_NAME) { start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; nextValueIsSource = /^on|^style$/i.test(source.substring(start, end)); } else if (style === PR_ATTRIB_VALUE) { if (nextValueIsSource) { start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var attribValue = source.substring(start, end); var attribLen = attribValue.length; var quoted = (attribLen >= 2 && /^[\"\']/.test(attribValue) && attribValue.charAt(0) === attribValue.charAt(attribLen - 1)); var attribSource; var attribSourceStart; var attribSourceEnd; if (quoted) { attribSourceStart = start + 1; attribSourceEnd = end - 1; attribSource = attribValue; } else { attribSourceStart = start + 1; attribSourceEnd = end - 1; attribSource = attribValue.substring(1, attribValue.length - 1); } var attribSourceDecorations = decorateSource(attribSource); for (var j = 0, m = attribSourceDecorations.length; j < m; j += 2) { attribSourceDecorations[j] += attribSourceStart; } if (quoted) { attribSourceDecorations.push(attribSourceEnd, PR_ATTRIB_VALUE); spliceArrayInto(attribSourceDecorations, decorations, i + 2, 0); } else { spliceArrayInto(attribSourceDecorations, decorations, i, 2); } } nextValueIsSource = false; } } return decorations; } function decorateMarkup(sourceCode) { var decorations = tokenizeMarkup(sourceCode); decorations = splitTagAttributes(sourceCode, decorations); decorations = splitSourceNodes(sourceCode, decorations); decorations = splitSourceAttributes(sourceCode, decorations); return decorations; } function recombineTagsAndDecorations(sourceText, extractedTags, decorations) { var html = []; var outputIdx = 0; var openDecoration = null; var currentDecoration = null; var tagPos = 0; var decPos = 0; var tabExpander = makeTabExpander(PR_TAB_WIDTH); var adjacentSpaceRe = /([\r\n ]) /g; var startOrSpaceRe = /(^| ) /gm; var newlineRe = /\r\n?|\n/g; var trailingSpaceRe = /[ \r\n]$/; var lastWasSpace = true; function emitTextUpTo(sourceIdx) { if (sourceIdx > outputIdx) { if (openDecoration && openDecoration !== currentDecoration) { html.push('</span>'); openDecoration = null; } if (!openDecoration && currentDecoration) { openDecoration = currentDecoration; html.push('<span class="', openDecoration, '">'); } var htmlChunk = textToHtml(tabExpander(sourceText.substring(outputIdx, sourceIdx))).replace(lastWasSpace ? startOrSpaceRe : adjacentSpaceRe, '$1&nbsp;'); lastWasSpace = trailingSpaceRe.test(htmlChunk); html.push(htmlChunk.replace(newlineRe, '<br />')); outputIdx = sourceIdx; } } while (true) { var outputTag; if (tagPos < extractedTags.length) { if (decPos < decorations.length) { outputTag = extractedTags[tagPos] <= decorations[decPos]; } else { outputTag = true; } } else { outputTag = false; } if (outputTag) { emitTextUpTo(extractedTags[tagPos]); if (openDecoration) { html.push('</span>'); openDecoration = null; } html.push(extractedTags[tagPos + 1]); tagPos += 2; } else if (decPos < decorations.length) { emitTextUpTo(decorations[decPos]); currentDecoration = decorations[decPos + 1]; decPos += 2; } else { break; } } emitTextUpTo(sourceText.length); if (openDecoration) { html.push('</span>'); } return html.join(''); } var langHandlerRegistry = {}; function registerLangHandler(handler, fileExtensions) { for (var i = fileExtensions.length; --i >= 0; ) { var ext = fileExtensions[i]; if (!langHandlerRegistry.hasOwnProperty(ext)) { langHandlerRegistry[ext] = handler; } else if ('console' in window) { console.log('cannot override language handler %s', ext); } } } registerLangHandler(decorateSource, ['default-code']); registerLangHandler(decorateMarkup, ['default-markup', 'html', 'htm', 'xhtml', 'xml', 'xsl']); registerLangHandler(sourceDecorator({ keywords: CPP_KEYWORDS, hashComments: true, cStyleComments: true }), ['c', 'cc', 'cpp', 'cs', 'cxx', 'cyc']); registerLangHandler(sourceDecorator({ keywords: JAVA_KEYWORDS, cStyleComments: true }), ['java']); registerLangHandler(sourceDecorator({ keywords: SH_KEYWORDS, hashComments: true, multiLineStrings: true }), ['bsh', 'csh', 'sh']); registerLangHandler(sourceDecorator({ keywords: PYTHON_KEYWORDS, hashComments: true, multiLineStrings: true, tripleQuotedStrings: true }), ['cv', 'py']); registerLangHandler(sourceDecorator({ keywords: PERL_KEYWORDS, hashComments: true, multiLineStrings: true, regexLiterals: true }), ['perl', 'pl', 'pm']); registerLangHandler(sourceDecorator({ keywords: RUBY_KEYWORDS, hashComments: true, multiLineStrings: true, regexLiterals: true }), ['rb']); registerLangHandler(sourceDecorator({ keywords: JSCRIPT_KEYWORDS, cStyleComments: true, regexLiterals: true }), ['js']); function prettyPrintOne(sourceCodeHtml, opt_langExtension) { try { var sourceAndExtractedTags = extractTags(sourceCodeHtml); var source = sourceAndExtractedTags.source; var extractedTags = sourceAndExtractedTags.tags; if (!langHandlerRegistry.hasOwnProperty(opt_langExtension)) { opt_langExtension = /^\s*</.test(source) ? 'default-markup' : 'default-code'; } var decorations = langHandlerRegistry[opt_langExtension].call({}, source); return recombineTagsAndDecorations(source, extractedTags, decorations); } catch (e) { if ('console' in window) { console.log(e); console.trace(); } return sourceCodeHtml; } } function prettyPrint(opt_whenDone) { var isIE6 = _pr_isIE6(); var codeSegments = [document.getElementsByTagName('pre'), document.getElementsByTagName('code'), document.getElementsByTagName('xmp')]; var elements = []; for (var i = 0; i < codeSegments.length; ++i) { for (var j = 0; j < codeSegments[i].length; ++j) { elements.push(codeSegments[i][j]); } } codeSegments = null; var k = 0; function doWork() { var endTime = (PR_SHOULD_USE_CONTINUATION ? new Date().getTime() + 250 : Infinity); for (; k < elements.length && new Date().getTime() < endTime; k++) { var cs = elements[k]; if (cs.className && cs.className.indexOf('prettyprint') >= 0) { var langExtension = cs.className.match(/\blang-(\w+)\b/); if (langExtension) { langExtension = langExtension[1]; } var nested = false; for (var p = cs.parentNode; p; p = p.parentNode) { if ((p.tagName === 'pre' || p.tagName === 'code' || p.tagName === 'xmp') && p.className && p.className.indexOf('prettyprint') >= 0) { nested = true; break; } } if (!nested) { var content = getInnerHtml(cs); content = content.replace(/(?:\r\n?|\n)$/, ''); var newContent = prettyPrintOne(content, langExtension); if (!isRawContent(cs)) { cs.innerHTML = newContent; } else { var pre = document.createElement('PRE'); for (var i = 0; i < cs.attributes.length; ++i) { var a = cs.attributes[i]; if (a.specified) { var aname = a.name.toLowerCase(); if (aname === 'class') { pre.className = a.value; } else { pre.setAttribute(a.name, a.value); } } } pre.innerHTML = newContent; cs.parentNode.replaceChild(pre, cs); cs = pre; } if (isIE6 && cs.tagName === 'PRE') { var lineBreaks = cs.getElementsByTagName('br'); for (var j = lineBreaks.length; --j >= 0; ) { var lineBreak = lineBreaks[j]; lineBreak.parentNode.replaceChild(document.createTextNode('\r\n'), lineBreak); } } } } } if (k < elements.length) { setTimeout(doWork, 250); } else if (opt_whenDone) { opt_whenDone(); } } doWork(); } window['PR_normalizedHtml'] = normalizedHtml; window['prettyPrintOne'] = prettyPrintOne; window['prettyPrint'] = prettyPrint; window['PR'] = { 'createSimpleLexer': createSimpleLexer, 'registerLangHandler': registerLangHandler, 'sourceDecorator': sourceDecorator, 'PR_ATTRIB_NAME': PR_ATTRIB_NAME, 'PR_ATTRIB_VALUE': PR_ATTRIB_VALUE, 'PR_COMMENT': PR_COMMENT, 'PR_DECLARATION': PR_DECLARATION, 'PR_KEYWORD': PR_KEYWORD, 'PR_LITERAL': PR_LITERAL, 'PR_NOCODE': PR_NOCODE, 'PR_PLAIN': PR_PLAIN, 'PR_PUNCTUATION': PR_PUNCTUATION, 'PR_SOURCE': PR_SOURCE, 'PR_STRING': PR_STRING, 'PR_TAG': PR_TAG, 'PR_TYPE': PR_TYPE }; })(); \ No newline at end of file
+var PR_SHOULD_USE_CONTINUATION = true; var PR_TAB_WIDTH = 8; var PR_normalizedHtml; var PR; var prettyPrintOne; var prettyPrint; function _pr_isIE6() { var isIE6 = navigator && navigator.userAgent && /\bMSIE 6\./.test(navigator.userAgent); _pr_isIE6 = function() { return isIE6; }; return isIE6; } (function() { function wordSet(words) { words = words.split(/ /g); var set = {}; for (var i = words.length; --i >= 0; ) { var w = words[i]; if (w) { set[w] = null; } } return set; } var FLOW_CONTROL_KEYWORDS = "break continue do else for if return while "; var C_KEYWORDS = FLOW_CONTROL_KEYWORDS + "auto case char const default " + "double enum extern float goto int long register short signed sizeof " + "static struct switch typedef union unsigned void volatile "; var COMMON_KEYWORDS = C_KEYWORDS + "catch class delete false import " + "new operator private protected public this throw true try "; var CPP_KEYWORDS = COMMON_KEYWORDS + "alignof align_union asm axiom bool " + "concept concept_map const_cast constexpr decltype " + "dynamic_cast explicit export friend inline late_check " + "mutable namespace nullptr reinterpret_cast static_assert static_cast " + "template typeid typename typeof using virtual wchar_t where "; var JAVA_KEYWORDS = COMMON_KEYWORDS + "boolean byte extends final finally implements import instanceof null " + "native package strictfp super synchronized throws transient "; var CSHARP_KEYWORDS = JAVA_KEYWORDS + "as base by checked decimal delegate descending event " + "fixed foreach from group implicit in interface internal into is lock " + "object out override orderby params readonly ref sbyte sealed " + "stackalloc string select uint ulong unchecked unsafe ushort var "; var JSCRIPT_KEYWORDS = COMMON_KEYWORDS + "debugger eval export function get null set undefined var with " + "Infinity NaN "; var PERL_KEYWORDS = "caller delete die do dump elsif eval exit foreach for " + "goto if import last local my next no our print package redo require " + "sub undef unless until use wantarray while BEGIN END "; var PYTHON_KEYWORDS = FLOW_CONTROL_KEYWORDS + "and as assert class def del " + "elif except exec finally from global import in is lambda " + "nonlocal not or pass print raise try with yield " + "False True None "; var RUBY_KEYWORDS = FLOW_CONTROL_KEYWORDS + "alias and begin case class def" + " defined elsif end ensure false in module next nil not or redo rescue " + "retry self super then true undef unless until when yield BEGIN END "; var SH_KEYWORDS = FLOW_CONTROL_KEYWORDS + "case done elif esac eval fi " + "function in local set then until "; var ALL_KEYWORDS = (CPP_KEYWORDS + CSHARP_KEYWORDS + JSCRIPT_KEYWORDS + PERL_KEYWORDS + PYTHON_KEYWORDS + RUBY_KEYWORDS + SH_KEYWORDS); var PR_STRING = 'str'; var PR_KEYWORD = 'kwd'; var PR_COMMENT = 'com'; var PR_TYPE = 'typ'; var PR_LITERAL = 'lit'; var PR_PUNCTUATION = 'pun'; var PR_PLAIN = 'pln'; var PR_TAG = 'tag'; var PR_DECLARATION = 'dec'; var PR_SOURCE = 'src'; var PR_ATTRIB_NAME = 'atn'; var PR_ATTRIB_VALUE = 'atv'; var PR_NOCODE = 'nocode'; function isWordChar(ch) { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); } function spliceArrayInto(inserted, container, containerPosition, countReplaced) { inserted.unshift(containerPosition, countReplaced || 0); try { container.splice.apply(container, inserted); } finally { inserted.splice(0, 2); } } var REGEXP_PRECEDER_PATTERN = function() { var preceders = ["!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=", "&=", "(", "*", "*=", "+=", ",", "-=", "->", "/", "/=", ":", "::", ";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[", "^", "^=", "^^", "^^=", "{", "|", "|=", "||", "||=", "~", "break", "case", "continue", "delete", "do", "else", "finally", "instanceof", "return", "throw", "try", "typeof"]; var pattern = '(?:' + '(?:(?:^|[^0-9.])\\.{1,3})|' + '(?:(?:^|[^\\+])\\+)|' + '(?:(?:^|[^\\-])-)'; for (var i = 0; i < preceders.length; ++i) { var preceder = preceders[i]; if (isWordChar(preceder.charAt(0))) { pattern += '|\\b' + preceder; } else { pattern += '|' + preceder.replace(/([^=<>:&])/g, '\\$1'); } } pattern += '|^)\\s*$'; return new RegExp(pattern); } (); var pr_amp = /&/g; var pr_lt = /</g; var pr_gt = />/g; var pr_quot = /\"/g; function attribToHtml(str) { return str.replace(pr_amp, '&amp;').replace(pr_lt, '&lt;').replace(pr_gt, '&gt;').replace(pr_quot, '&quot;'); } function textToHtml(str) { return str.replace(pr_amp, '&amp;').replace(pr_lt, '&lt;').replace(pr_gt, '&gt;'); } var pr_ltEnt = /&lt;/g; var pr_gtEnt = /&gt;/g; var pr_aposEnt = /&apos;/g; var pr_quotEnt = /&quot;/g; var pr_ampEnt = /&amp;/g; var pr_nbspEnt = /&nbsp;/g; function htmlToText(html) { var pos = html.indexOf('&'); if (pos < 0) { return html; } for (--pos; (pos = html.indexOf('&#', pos + 1)) >= 0; ) { var end = html.indexOf(';', pos); if (end >= 0) { var num = html.substring(pos + 3, end); var radix = 10; if (num && num.charAt(0) === 'x') { num = num.substring(1); radix = 16; } var codePoint = parseInt(num, radix); if (!isNaN(codePoint)) { html = (html.substring(0, pos) + String.fromCharCode(codePoint) + html.substring(end + 1)); } } } return html.replace(pr_ltEnt, '<').replace(pr_gtEnt, '>').replace(pr_aposEnt, "'").replace(pr_quotEnt, '"').replace(pr_ampEnt, '&').replace(pr_nbspEnt, ' '); } function isRawContent(node) { return 'XMP' === node.tagName; } function normalizedHtml(node, out) { switch (node.nodeType) { case 1: var name = node.tagName.toLowerCase(); out.push('<', name); for (var i = 0; i < node.attributes.length; ++i) { var attr = node.attributes[i]; if (!attr.specified) { continue; } out.push(' '); normalizedHtml(attr, out); } out.push('>'); for (var child = node.firstChild; child; child = child.nextSibling) { normalizedHtml(child, out); } if (node.firstChild || !/^(?:br|link|img)$/.test(name)) { out.push('<\/', name, '>'); } break; case 2: out.push(node.name.toLowerCase(), '="', attribToHtml(node.value), '"'); break; case 3: case 4: out.push(textToHtml(node.nodeValue)); break; } } var PR_innerHtmlWorks = null; function getInnerHtml(node) { if (null === PR_innerHtmlWorks) { var testNode = document.createElement('PRE'); testNode.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />')); PR_innerHtmlWorks = !/</.test(testNode.innerHTML); } if (PR_innerHtmlWorks) { var content = node.innerHTML; if (isRawContent(node)) { content = textToHtml(content); } return content; } var out = []; for (var child = node.firstChild; child; child = child.nextSibling) { normalizedHtml(child, out); } return out.join(''); } function makeTabExpander(tabWidth) { var SPACES = ' '; var charInLine = 0; return function(plainText) { var out = null; var pos = 0; for (var i = 0, n = plainText.length; i < n; ++i) { var ch = plainText.charAt(i); switch (ch) { case '\t': if (!out) { out = []; } out.push(plainText.substring(pos, i)); var nSpaces = tabWidth - (charInLine % tabWidth); charInLine += nSpaces; for (; nSpaces >= 0; nSpaces -= SPACES.length) { out.push(SPACES.substring(0, nSpaces)); } pos = i + 1; break; case '\n': charInLine = 0; break; default: ++charInLine; } } if (!out) { return plainText; } out.push(plainText.substring(pos)); return out.join(''); }; } var pr_chunkPattern = /(?:[^<]+|<!--[\s\S]*?-->|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g; var pr_commentPrefix = /^<!--/; var pr_cdataPrefix = /^<\[CDATA\[/; var pr_brPrefix = /^<br\b/i; var pr_tagNameRe = /^<(\/?)([a-zA-Z]+)/; function extractTags(s) { var matches = s.match(pr_chunkPattern); var sourceBuf = []; var sourceBufLen = 0; var extractedTags = []; if (matches) { for (var i = 0, n = matches.length; i < n; ++i) { var match = matches[i]; if (match.length > 1 && match.charAt(0) === '<') { if (pr_commentPrefix.test(match)) { continue; } if (pr_cdataPrefix.test(match)) { sourceBuf.push(match.substring(9, match.length - 3)); sourceBufLen += match.length - 12; } else if (pr_brPrefix.test(match)) { sourceBuf.push('\n'); ++sourceBufLen; } else { if (match.indexOf(PR_NOCODE) >= 0 && isNoCodeTag(match)) { var name = match.match(pr_tagNameRe)[2]; var depth = 1; end_tag_loop: for (var j = i + 1; j < n; ++j) { var name2 = matches[j].match(pr_tagNameRe); if (name2 && name2[2] === name) { if (name2[1] === '/') { if (--depth === 0) { break end_tag_loop; } } else { ++depth; } } } if (j < n) { extractedTags.push(sourceBufLen, matches.slice(i, j + 1).join('')); i = j; } else { extractedTags.push(sourceBufLen, match); } } else { extractedTags.push(sourceBufLen, match); } } } else { var literalText = htmlToText(match); sourceBuf.push(literalText); sourceBufLen += literalText.length; } } } return { source: sourceBuf.join(''), tags: extractedTags }; } function isNoCodeTag(tag) { return !!tag.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g, ' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/); } function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) { var shortcuts = {}; (function() { var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns); for (var i = allPatterns.length; --i >= 0; ) { var patternParts = allPatterns[i]; var shortcutChars = patternParts[3]; if (shortcutChars) { for (var c = shortcutChars.length; --c >= 0; ) { shortcuts[shortcutChars.charAt(c)] = patternParts; } } } })(); var nPatterns = fallthroughStylePatterns.length; var notWs = /\S/; return function(sourceCode, opt_basePos) { opt_basePos = opt_basePos || 0; var decorations = [opt_basePos, PR_PLAIN]; var lastToken = ''; var pos = 0; var tail = sourceCode; while (tail.length) { var style; var token = null; var match; var patternParts = shortcuts[tail.charAt(0)]; if (patternParts) { match = tail.match(patternParts[1]); token = match[0]; style = patternParts[0]; } else { for (var i = 0; i < nPatterns; ++i) { patternParts = fallthroughStylePatterns[i]; var contextPattern = patternParts[2]; if (contextPattern && !contextPattern.test(lastToken)) { continue; } match = tail.match(patternParts[1]); if (match) { token = match[0]; style = patternParts[0]; break; } } if (!token) { style = PR_PLAIN; token = tail.substring(0, 1); } } decorations.push(opt_basePos + pos, style); pos += token.length; tail = tail.substring(token.length); if (style !== PR_COMMENT && notWs.test(token)) { lastToken = token; } } return decorations; }; } var PR_MARKUP_LEXER = createSimpleLexer([], [[PR_PLAIN, /^[^<]+/, null], [PR_DECLARATION, /^<!\w[^>]*(?:>|$)/, null], [PR_COMMENT, /^<!--[\s\S]*?(?:-->|$)/, null], [PR_SOURCE, /^<\?[\s\S]*?(?:\?>|$)/, null], [PR_SOURCE, /^<%[\s\S]*?(?:%>|$)/, null], [PR_SOURCE, /^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i, null], [PR_TAG, /^<\/?\w[^<>]*>/, null]]); var PR_SOURCE_CHUNK_PARTS = /^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/; function tokenizeMarkup(source) { var decorations = PR_MARKUP_LEXER(source); for (var i = 0; i < decorations.length; i += 2) { if (decorations[i + 1] === PR_SOURCE) { var start, end; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var sourceChunk = source.substring(start, end); var match = sourceChunk.match(PR_SOURCE_CHUNK_PARTS); if (match) { decorations.splice(i, 2, start, PR_TAG, start + match[1].length, PR_SOURCE, start + match[1].length + (match[2] || '').length, PR_TAG); } } } return decorations; } var PR_TAG_LEXER = createSimpleLexer([[PR_ATTRIB_VALUE, /^\'[^\']*(?:\'|$)/, null, "'"], [PR_ATTRIB_VALUE, /^\"[^\"]*(?:\"|$)/, null, '"'], [PR_PUNCTUATION, /^[<>\/=]+/, null, '<>/=']], [[PR_TAG, /^[\w:\-]+/, /^</], [PR_ATTRIB_VALUE, /^[\w\-]+/, /^=/], [PR_ATTRIB_NAME, /^[\w:\-]+/, null], [PR_PLAIN, /^\s+/, null, ' \t\r\n']]); function splitTagAttributes(source, decorations) { for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; if (style === PR_TAG) { var start, end; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var chunk = source.substring(start, end); var subDecorations = PR_TAG_LEXER(chunk, start); spliceArrayInto(subDecorations, decorations, i, 2); i += subDecorations.length - 2; } } return decorations; } function sourceDecorator(options) { var shortcutStylePatterns = [], fallthroughStylePatterns = []; if (options.tripleQuotedStrings) { shortcutStylePatterns.push([PR_STRING, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, '\'"']); } else if (options.multiLineStrings) { shortcutStylePatterns.push([PR_STRING, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, '\'"`']); } else { shortcutStylePatterns.push([PR_STRING, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, '"\'']); } fallthroughStylePatterns.push([PR_PLAIN, /^(?:[^\'\"\`\/\#]+)/, null, ' \r\n']); if (options.hashComments) { shortcutStylePatterns.push([PR_COMMENT, /^#[^\r\n]*/, null, '#']); } if (options.cStyleComments) { fallthroughStylePatterns.push([PR_COMMENT, /^\/\/[^\r\n]*/, null]); fallthroughStylePatterns.push([PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null]); } if (options.regexLiterals) { var REGEX_LITERAL = ('^/(?=[^/*])' + '(?:[^/\\x5B\\x5C]' + '|\\x5C[\\s\\S]' + '|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+' + '(?:/|$)'); fallthroughStylePatterns.push([PR_STRING, new RegExp(REGEX_LITERAL), REGEXP_PRECEDER_PATTERN]); } var keywords = wordSet(options.keywords); options = null; var splitStringAndCommentTokens = createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns); var styleLiteralIdentifierPuncRecognizer = createSimpleLexer([], [[PR_PLAIN, /^\s+/, null, ' \r\n'], [PR_PLAIN, /^[a-z_$@][a-z_$@0-9]*/i, null], [PR_LITERAL, /^0x[a-f0-9]+[a-z]/i, null], [PR_LITERAL, /^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i, null, '123456789'], [PR_PUNCTUATION, /^[^\s\w\.$@]+/, null]]); function splitNonStringNonCommentTokens(source, decorations) { for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; if (style === PR_PLAIN) { var start, end, chunk, subDecs; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; chunk = source.substring(start, end); subDecs = styleLiteralIdentifierPuncRecognizer(chunk, start); for (var j = 0, m = subDecs.length; j < m; j += 2) { var subStyle = subDecs[j + 1]; if (subStyle === PR_PLAIN) { var subStart = subDecs[j]; var subEnd = j + 2 < m ? subDecs[j + 2] : chunk.length; var token = source.substring(subStart, subEnd); if (token === '.') { subDecs[j + 1] = PR_PUNCTUATION; } else if (token in keywords) { subDecs[j + 1] = PR_KEYWORD; } else if (/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(token)) { subDecs[j + 1] = token.charAt(0) === '@' ? PR_LITERAL : PR_TYPE; } } } spliceArrayInto(subDecs, decorations, i, 2); i += subDecs.length - 2; } } return decorations; } return function(sourceCode) { var decorations = splitStringAndCommentTokens(sourceCode); decorations = splitNonStringNonCommentTokens(sourceCode, decorations); return decorations; }; } var decorateSource = sourceDecorator({ keywords: ALL_KEYWORDS, hashComments: true, cStyleComments: true, multiLineStrings: true, regexLiterals: true }); function splitSourceNodes(source, decorations) { for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; if (style === PR_SOURCE) { var start, end; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var subDecorations = decorateSource(source.substring(start, end)); for (var j = 0, m = subDecorations.length; j < m; j += 2) { subDecorations[j] += start; } spliceArrayInto(subDecorations, decorations, i, 2); i += subDecorations.length - 2; } } return decorations; } function splitSourceAttributes(source, decorations) { var nextValueIsSource = false; for (var i = 0; i < decorations.length; i += 2) { var style = decorations[i + 1]; var start, end; if (style === PR_ATTRIB_NAME) { start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; nextValueIsSource = /^on|^style$/i.test(source.substring(start, end)); } else if (style === PR_ATTRIB_VALUE) { if (nextValueIsSource) { start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var attribValue = source.substring(start, end); var attribLen = attribValue.length; var quoted = (attribLen >= 2 && /^[\"\']/.test(attribValue) && attribValue.charAt(0) === attribValue.charAt(attribLen - 1)); var attribSource; var attribSourceStart; var attribSourceEnd; if (quoted) { attribSourceStart = start + 1; attribSourceEnd = end - 1; attribSource = attribValue; } else { attribSourceStart = start + 1; attribSourceEnd = end - 1; attribSource = attribValue.substring(1, attribValue.length - 1); } var attribSourceDecorations = decorateSource(attribSource); for (var j = 0, m = attribSourceDecorations.length; j < m; j += 2) { attribSourceDecorations[j] += attribSourceStart; } if (quoted) { attribSourceDecorations.push(attribSourceEnd, PR_ATTRIB_VALUE); spliceArrayInto(attribSourceDecorations, decorations, i + 2, 0); } else { spliceArrayInto(attribSourceDecorations, decorations, i, 2); } } nextValueIsSource = false; } } return decorations; } function decorateMarkup(sourceCode) { var decorations = tokenizeMarkup(sourceCode); decorations = splitTagAttributes(sourceCode, decorations); decorations = splitSourceNodes(sourceCode, decorations); decorations = splitSourceAttributes(sourceCode, decorations); return decorations; } function recombineTagsAndDecorations(sourceText, extractedTags, decorations) { var html = []; var outputIdx = 0; var openDecoration = null; var currentDecoration = null; var tagPos = 0; var decPos = 0; var tabExpander = makeTabExpander(PR_TAB_WIDTH); var adjacentSpaceRe = /([\r\n ]) /g; var startOrSpaceRe = /(^| ) /gm; var newlineRe = /\r\n?|\n/g; var trailingSpaceRe = /[ \r\n]$/; var lastWasSpace = true; function emitTextUpTo(sourceIdx) { if (sourceIdx > outputIdx) { if (openDecoration && openDecoration !== currentDecoration) { html.push('</span>'); openDecoration = null; } if (!openDecoration && currentDecoration) { openDecoration = currentDecoration; html.push('<span class="', openDecoration, '">'); } var htmlChunk = textToHtml(tabExpander(sourceText.substring(outputIdx, sourceIdx))).replace(lastWasSpace ? startOrSpaceRe : adjacentSpaceRe, '$1&nbsp;'); lastWasSpace = trailingSpaceRe.test(htmlChunk); html.push(htmlChunk.replace(newlineRe, '<br />')); outputIdx = sourceIdx; } } while (true) { var outputTag; if (tagPos < extractedTags.length) { if (decPos < decorations.length) { outputTag = extractedTags[tagPos] <= decorations[decPos]; } else { outputTag = true; } } else { outputTag = false; } if (outputTag) { emitTextUpTo(extractedTags[tagPos]); if (openDecoration) { html.push('</span>'); openDecoration = null; } html.push(extractedTags[tagPos + 1]); tagPos += 2; } else if (decPos < decorations.length) { emitTextUpTo(decorations[decPos]); currentDecoration = decorations[decPos + 1]; decPos += 2; } else { break; } } emitTextUpTo(sourceText.length); if (openDecoration) { html.push('</span>'); } return html.join(''); } var langHandlerRegistry = {}; function registerLangHandler(handler, fileExtensions) { for (var i = fileExtensions.length; --i >= 0; ) { var ext = fileExtensions[i]; if (!langHandlerRegistry.hasOwnProperty(ext)) { langHandlerRegistry[ext] = handler; } else if ('console' in window) { console.log('cannot override language handler %s', ext); } } } registerLangHandler(decorateSource, ['default-code']); registerLangHandler(decorateMarkup, ['default-markup', 'html', 'htm', 'xhtml', 'xml', 'xsl']); registerLangHandler(sourceDecorator({ keywords: CPP_KEYWORDS, hashComments: true, cStyleComments: true }), ['c', 'cc', 'cpp', 'cs', 'cxx', 'cyc']); registerLangHandler(sourceDecorator({ keywords: JAVA_KEYWORDS, cStyleComments: true }), ['java']); registerLangHandler(sourceDecorator({ keywords: SH_KEYWORDS, hashComments: true, multiLineStrings: true }), ['bsh', 'csh', 'sh']); registerLangHandler(sourceDecorator({ keywords: PYTHON_KEYWORDS, hashComments: true, multiLineStrings: true, tripleQuotedStrings: true }), ['cv', 'py']); registerLangHandler(sourceDecorator({ keywords: PERL_KEYWORDS, hashComments: true, multiLineStrings: true, regexLiterals: true }), ['perl', 'pl', 'pm']); registerLangHandler(sourceDecorator({ keywords: RUBY_KEYWORDS, hashComments: true, multiLineStrings: true, regexLiterals: true }), ['rb']); registerLangHandler(sourceDecorator({ keywords: JSCRIPT_KEYWORDS, cStyleComments: true, regexLiterals: true }), ['js']); function prettyPrintOne(sourceCodeHtml, opt_langExtension) { try { var sourceAndExtractedTags = extractTags(sourceCodeHtml); var source = sourceAndExtractedTags.source; var extractedTags = sourceAndExtractedTags.tags; if (!langHandlerRegistry.hasOwnProperty(opt_langExtension)) { opt_langExtension = /^\s*</.test(source) ? 'default-markup' : 'default-code'; } var decorations = langHandlerRegistry[opt_langExtension].call({}, source); return recombineTagsAndDecorations(source, extractedTags, decorations); } catch (e) { if ('console' in window) { console.log(e); console.trace(); } return sourceCodeHtml; } } function prettyPrint(opt_whenDone) { var isIE6 = _pr_isIE6(); var codeSegments = [document.getElementsByTagName('pre'), document.getElementsByTagName('code'), document.getElementsByTagName('xmp')]; var elements = []; for (var i = 0; i < codeSegments.length; ++i) { for (var j = 0; j < codeSegments[i].length; ++j) { elements.push(codeSegments[i][j]); } } codeSegments = null; var k = 0; function doWork() { var endTime = (PR_SHOULD_USE_CONTINUATION ? new Date().getTime() + 250 : Infinity); for (; k < elements.length && new Date().getTime() < endTime; k++) { var cs = elements[k]; if (cs.className && cs.className.indexOf('prettyprint') >= 0) { var langExtension = cs.className.match(/\blang-(\w+)\b/); if (langExtension) { langExtension = langExtension[1]; } var nested = false; for (var p = cs.parentNode; p; p = p.parentNode) { if ((p.tagName === 'pre' || p.tagName === 'code' || p.tagName === 'xmp') && p.className && p.className.indexOf('prettyprint') >= 0) { nested = true; break; } } if (!nested) { var content = getInnerHtml(cs); content = content.replace(/(?:\r\n?|\n)$/, ''); var newContent = prettyPrintOne(content, langExtension); if (!isRawContent(cs)) { cs.innerHTML = newContent; } else { var pre = document.createElement('PRE'); for (var i = 0; i < cs.attributes.length; ++i) { var a = cs.attributes[i]; if (a.specified) { var aname = a.name.toLowerCase(); if (aname === 'class') { pre.className = a.value; } else { pre.setAttribute(a.name, a.value); } } } pre.innerHTML = newContent; cs.parentNode.replaceChild(pre, cs); cs = pre; } if (isIE6 && cs.tagName === 'PRE') { var lineBreaks = cs.getElementsByTagName('br'); for (var j = lineBreaks.length; --j >= 0; ) { var lineBreak = lineBreaks[j]; lineBreak.parentNode.replaceChild(document.createTextNode('\r\n'), lineBreak); } } } } } if (k < elements.length) { setTimeout(doWork, 250); } else if (opt_whenDone) { opt_whenDone(); } } doWork(); } window['PR_normalizedHtml'] = normalizedHtml; window['prettyPrintOne'] = prettyPrintOne; window['prettyPrint'] = prettyPrint; window['PR'] = { 'createSimpleLexer': createSimpleLexer, 'registerLangHandler': registerLangHandler, 'sourceDecorator': sourceDecorator, 'PR_ATTRIB_NAME': PR_ATTRIB_NAME, 'PR_ATTRIB_VALUE': PR_ATTRIB_VALUE, 'PR_COMMENT': PR_COMMENT, 'PR_DECLARATION': PR_DECLARATION, 'PR_KEYWORD': PR_KEYWORD, 'PR_LITERAL': PR_LITERAL, 'PR_NOCODE': PR_NOCODE, 'PR_PLAIN': PR_PLAIN, 'PR_PUNCTUATION': PR_PUNCTUATION, 'PR_SOURCE': PR_SOURCE, 'PR_STRING': PR_STRING, 'PR_TAG': PR_TAG, 'PR_TYPE': PR_TYPE }; })();
diff --git a/templates/content/js/com.cnprog.utils.js b/templates/content/js/com.cnprog.utils.js
index a5f0e982..e271ed78 100644
--- a/templates/content/js/com.cnprog.utils.js
+++ b/templates/content/js/com.cnprog.utils.js
@@ -1,5 +1,6 @@
var showMessage = function(object, msg) {
- var div = $('<div class="vote-notification"><h3>' + msg + '</h3>(点击消息框关闭)</div>');
+ var div = $('<div class="vote-notification"><h3>' + msg + '</h3>('
+ + $.i18n._('click to close') + ')</div>');
div.click(function(event) {
$(".vote-notification").fadeOut("fast", function() { $(this).remove(); });
@@ -33,7 +34,12 @@ var notify = function() {
} ();
function appendLoader(containerSelector) {
- $(containerSelector).append('<img class="ajax-loader" src="/content/images/indicator.gif" title="读取中..." alt="读取中..." />');
+ $(containerSelector).append('<img class="ajax-loader" '
+ +'src="/content/images/indicator.gif" title="'
+ +$.i18n._('loading...')
+ +'" alt="'
+ +$.i18n._('loading...')
+ +'" />');
}
function removeLoader() {
@@ -96,16 +102,16 @@ var CPValidator = function(){
getQuestionFormMessages: function(){
return {
tags: {
- required: " 标签不能为空。",
- maxlength: " 最多5个标签,每个标签长度小于20个字符。"
+ required: " " + $.i18n._('tags cannot be empty'),
+ maxlength: " " + $.i18n._('tablimits info'),
},
text: {
- required: " 内容不能为空。",
- minlength: jQuery.format(" 请输入至少 {0} 字符。")
+ required: " " + $.i18n._('content cannot be empty'),
+ minlength: jQuery.format(' ' + $.i18n._('content minchars'))
},
title: {
- required: " 请输入标题。",
- minlength: jQuery.format(" 请输入至少 {0} 字符。")
+ required: " " + $.i18n._('please enter title'),
+ minlength: jQuery.format(' ' + $.i18n._('title minchars'))
}
};
}
@@ -113,4 +119,4 @@ var CPValidator = function(){
}();
//Search Engine Keyword Highlight with Javascript
//http://scott.yang.id.au/code/se-hilite/
-Hilite={elementid:"content",exact:true,max_nodes:1000,onload:true,style_name:"hilite",style_name_suffix:true,debug_referrer:""};Hilite.search_engines=[["local","q"],["cnprog\\.","q"],["google\\.","q"],["search\\.yahoo\\.","p"],["search\\.msn\\.","q"],["search\\.live\\.","query"],["search\\.aol\\.","userQuery"],["ask\\.com","q"],["altavista\\.","q"],["feedster\\.","q"],["search\\.lycos\\.","q"],["alltheweb\\.","q"],["technorati\\.com/search/([^\\?/]+)",1],["dogpile\\.com/info\\.dogpl/search/web/([^\\?/]+)",1,true]];Hilite.decodeReferrer=function(d){var g=null;var e=new RegExp("");for(var c=0;c<Hilite.search_engines.length;c++){var f=Hilite.search_engines[c];e.compile("^http://(www\\.)?"+f[0],"i");var b=d.match(e);if(b){var a;if(isNaN(f[1])){a=Hilite.decodeReferrerQS(d,f[1])}else{a=b[f[1]+1]}if(a){a=decodeURIComponent(a);if(f.length>2&&f[2]){a=decodeURIComponent(a)}a=a.replace(/\'|"/g,"");a=a.split(/[\s,\+\.]+/);return a}break}}return null};Hilite.decodeReferrerQS=function(f,d){var b=f.indexOf("?");var c;if(b>=0){var a=new String(f.substring(b+1));b=0;c=0;while((b>=0)&&((c=a.indexOf("=",b))>=0)){var e,g;e=a.substring(b,c);b=a.indexOf("&",c)+1;if(e==d){if(b<=0){return a.substring(c+1)}else{return a.substring(c+1,b-1)}}else{if(b<=0){return null}}}}return null};Hilite.hiliteElement=function(f,e){if(!e||f.childNodes.length==0){return}var c=new Array();for(var b=0;b<e.length;b++){e[b]=e[b].toLowerCase();if(Hilite.exact){c.push("\\b"+e[b]+"\\b")}else{c.push(e[b])}}c=new RegExp(c.join("|"),"i");var a={};for(var b=0;b<e.length;b++){if(Hilite.style_name_suffix){a[e[b]]=Hilite.style_name+(b+1)}else{a[e[b]]=Hilite.style_name}}var d=function(m){var j=c.exec(m.data);if(j){var n=j[0];var i="";var h=m.splitText(j.index);var g=h.splitText(n.length);var l=m.ownerDocument.createElement("SPAN");m.parentNode.replaceChild(l,h);l.className=a[n.toLowerCase()];l.appendChild(h);return l}else{return m}};Hilite.walkElements(f.childNodes[0],1,d)};Hilite.hilite=function(){var a=Hilite.debug_referrer?Hilite.debug_referrer:document.referrer;var b=null;a=Hilite.decodeReferrer(a);if(a&&((Hilite.elementid&&(b=document.getElementById(Hilite.elementid)))||(b=document.body))){Hilite.hiliteElement(b,a)}};Hilite.walkElements=function(d,f,e){var a=/^(script|style|textarea)/i;var c=0;while(d&&f>0){c++;if(c>=Hilite.max_nodes){var b=function(){Hilite.walkElements(d,f,e)};setTimeout(b,50);return}if(d.nodeType==1){if(!a.test(d.tagName)&&d.childNodes.length>0){d=d.childNodes[0];f++;continue}}else{if(d.nodeType==3){d=e(d)}}if(d.nextSibling){d=d.nextSibling}else{while(f>0){d=d.parentNode;f--;if(d.nextSibling){d=d.nextSibling;break}}}}};if(Hilite.onload){if(window.attachEvent){window.attachEvent("onload",Hilite.hilite)}else{if(window.addEventListener){window.addEventListener("load",Hilite.hilite,false)}else{var __onload=window.onload;window.onload=function(){Hilite.hilite();__onload()}}}}; \ No newline at end of file
+Hilite={elementid:"content",exact:true,max_nodes:1000,onload:true,style_name:"hilite",style_name_suffix:true,debug_referrer:""};Hilite.search_engines=[["local","q"],["cnprog\\.","q"],["google\\.","q"],["search\\.yahoo\\.","p"],["search\\.msn\\.","q"],["search\\.live\\.","query"],["search\\.aol\\.","userQuery"],["ask\\.com","q"],["altavista\\.","q"],["feedster\\.","q"],["search\\.lycos\\.","q"],["alltheweb\\.","q"],["technorati\\.com/search/([^\\?/]+)",1],["dogpile\\.com/info\\.dogpl/search/web/([^\\?/]+)",1,true]];Hilite.decodeReferrer=function(d){var g=null;var e=new RegExp("");for(var c=0;c<Hilite.search_engines.length;c++){var f=Hilite.search_engines[c];e.compile("^http://(www\\.)?"+f[0],"i");var b=d.match(e);if(b){var a;if(isNaN(f[1])){a=Hilite.decodeReferrerQS(d,f[1])}else{a=b[f[1]+1]}if(a){a=decodeURIComponent(a);if(f.length>2&&f[2]){a=decodeURIComponent(a)}a=a.replace(/\'|"/g,"");a=a.split(/[\s,\+\.]+/);return a}break}}return null};Hilite.decodeReferrerQS=function(f,d){var b=f.indexOf("?");var c;if(b>=0){var a=new String(f.substring(b+1));b=0;c=0;while((b>=0)&&((c=a.indexOf("=",b))>=0)){var e,g;e=a.substring(b,c);b=a.indexOf("&",c)+1;if(e==d){if(b<=0){return a.substring(c+1)}else{return a.substring(c+1,b-1)}}else{if(b<=0){return null}}}}return null};Hilite.hiliteElement=function(f,e){if(!e||f.childNodes.length==0){return}var c=new Array();for(var b=0;b<e.length;b++){e[b]=e[b].toLowerCase();if(Hilite.exact){c.push("\\b"+e[b]+"\\b")}else{c.push(e[b])}}c=new RegExp(c.join("|"),"i");var a={};for(var b=0;b<e.length;b++){if(Hilite.style_name_suffix){a[e[b]]=Hilite.style_name+(b+1)}else{a[e[b]]=Hilite.style_name}}var d=function(m){var j=c.exec(m.data);if(j){var n=j[0];var i="";var h=m.splitText(j.index);var g=h.splitText(n.length);var l=m.ownerDocument.createElement("SPAN");m.parentNode.replaceChild(l,h);l.className=a[n.toLowerCase()];l.appendChild(h);return l}else{return m}};Hilite.walkElements(f.childNodes[0],1,d)};Hilite.hilite=function(){var a=Hilite.debug_referrer?Hilite.debug_referrer:document.referrer;var b=null;a=Hilite.decodeReferrer(a);if(a&&((Hilite.elementid&&(b=document.getElementById(Hilite.elementid)))||(b=document.body))){Hilite.hiliteElement(b,a)}};Hilite.walkElements=function(d,f,e){var a=/^(script|style|textarea)/i;var c=0;while(d&&f>0){c++;if(c>=Hilite.max_nodes){var b=function(){Hilite.walkElements(d,f,e)};setTimeout(b,50);return}if(d.nodeType==1){if(!a.test(d.tagName)&&d.childNodes.length>0){d=d.childNodes[0];f++;continue}}else{if(d.nodeType==3){d=e(d)}}if(d.nextSibling){d=d.nextSibling}else{while(f>0){d=d.parentNode;f--;if(d.nextSibling){d=d.nextSibling;break}}}}};if(Hilite.onload){if(window.attachEvent){window.attachEvent("onload",Hilite.hilite)}else{if(window.addEventListener){window.addEventListener("load",Hilite.hilite,false)}else{var __onload=window.onload;window.onload=function(){Hilite.hilite();__onload()}}}};
diff --git a/templates/content/js/jquery.i18n.js b/templates/content/js/jquery.i18n.js
new file mode 100644
index 00000000..0a155a31
--- /dev/null
+++ b/templates/content/js/jquery.i18n.js
@@ -0,0 +1,133 @@
+/*
+ * jQuery i18n plugin
+ * @requires jQuery v1.1 or later
+ *
+ * Examples at: http://recurser.com/articles/2008/02/21/jquery-i18n-translation-plugin/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Based on 'javascript i18n that almost doesn't suck' by markos
+ * http://markos.gaivo.net/blog/?p=100
+ *
+ * Revision: $Id$
+ * Version: 1.0.0 Feb-10-2008
+ */
+ (function($) {
+/**
+ * i18n provides a mechanism for translating strings using a jscript dictionary.
+ *
+ */
+
+
+/*
+ * i18n property list
+ */
+$.i18n = {
+
+/**
+ * setDictionary()
+ * Initialise the dictionary and translate nodes
+ *
+ * @param property_list i18n_dict : The dictionary to use for translation
+ */
+ setDictionary: function(i18n_dict) {
+ i18n_dict = i18n_dict;
+ },
+
+/**
+ * _()
+ * The actual translation function. Looks the given string up in the
+ * dictionary and returns the translation if one exists. If a translation
+ * is not found, returns the original word
+ *
+ * @param string str : The string to translate
+ * @param property_list params : params for using printf() on the string
+ * @return string : Translated word
+ *
+ */
+ _: function (str, params) {
+ var transl = str;
+ if (i18n_dict&& i18n_dict[str]) {
+ transl = i18n_dict[str];
+ }
+ return this.printf(transl, params);
+ },
+
+/**
+ * toEntity()
+ * Change non-ASCII characters to entity representation
+ *
+ * @param string str : The string to transform
+ * @return string result : Original string with non-ASCII content converted to entities
+ *
+ */
+ toEntity: function (str) {
+ var result = '';
+ for (var i=0;i<str.length; i++) {
+ if (str.charCodeAt(i) > 128)
+ result += "&#"+str.charCodeAt(i)+";";
+ else
+ result += str.charAt(i);
+ }
+ return result;
+ },
+
+/**
+ * stripStr()
+ *
+ * @param string str : The string to strip
+ * @return string result : Stripped string
+ *
+ */
+ stripStr: function(str) {
+ return str.replace(/^\s*/, "").replace(/\s*$/, "");
+ },
+
+/**
+ * stripStrML()
+ *
+ * @param string str : The multi-line string to strip
+ * @return string result : Stripped string
+ *
+ */
+ stripStrML: function(str) {
+ // Split because m flag doesn't exist before JS1.5 and we need to
+ // strip newlines anyway
+ var parts = str.split('\n');
+ for (var i=0; i<parts.length; i++)
+ parts[i] = stripStr(parts[i]);
+
+ // Don't join with empty strings, because it "concats" words
+ // And strip again
+ return stripStr(parts.join(" "));
+ },
+
+/*
+ * printf()
+ * C-printf like function, which substitutes %s with parameters
+ * given in list. %%s is used to escape %s.
+ *
+ * Doesn't work in IE5.0 (splice)
+ *
+ * @param string S : string to perform printf on.
+ * @param string L : Array of arguments for printf()
+ */
+ printf: function(S, L) {
+ if (!L) return S;
+
+ var nS = "";
+ var tS = S.split("%s");
+
+ for(var i=0; i<L.length; i++) {
+ if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != L.length-1)
+ tS[i] += "s"+tS.splice(i+1,1)[0];
+ nS += tS[i] + L[i];
+ }
+ return nS + tS[tS.length-1];
+ }
+
+};
+
+
+})(jQuery);
diff --git a/templates/content/js/wmd/wmd.js b/templates/content/js/wmd/wmd.js
index d83780d6..7b611dba 100644
--- a/templates/content/js/wmd/wmd.js
+++ b/templates/content/js/wmd/wmd.js
@@ -27,18 +27,18 @@ Attacklab.wmdBase = function(){
global.isOpera = /opera/.test(nav.userAgent.toLowerCase());
global.isKonqueror = /konqueror/.test(nav.userAgent.toLowerCase());
- var toolbar_strong_label = "粗体 <strong> Ctrl-B";
- var toolbar_emphasis_label = "斜体 <em> Ctrl-I";
- var toolbar_hyperlink_label = "超链接 <a> Ctrl-L";
- var toolbar_blockquote_label = "引用 <blockquote> Ctrl-.";
- var toolbar_code_label = "代码 <pre><code> Ctrl-K";
- var toolbar_image_label = "图片 <img> Ctrl-G";
- var toolbar_numbered_label = "数字编号列表 <ol> Ctrl-O";
- var toolbar_bulleted_label = "项目符号列表 <ul> Ctrl-U";
- var toolbar_heading_label = "标题 <h1>/<h2> Ctrl-H";
- var toolbar_horizontal_label = "水平线 <hr> Ctrl-R";
- var toolbar_undo_label = "撤销 Ctrl-Z";
- var toolbar_redo_label = "重做 Ctrl-Y";
+ var toolbar_strong_label = $.i18n._('bold') + " <strong> Ctrl-B";
+ var toolbar_emphasis_label = $.i18n._('italic') + " <em> Ctrl-I";
+ var toolbar_hyperlink_label = $.i18n._('link') + " <a> Ctrl-L";
+ var toolbar_blockquote_label = $.i18n._('quote') + " <blockquote> Ctrl-.";
+ var toolbar_code_label = $.i18n._('preformatted text') + " <pre><code> Ctrl-K";
+ var toolbar_image_label = $.i18n._('image') + " <img> Ctrl-G";
+ var toolbar_numbered_label = $.i18n._('numbered list') + " <ol> Ctrl-O";
+ var toolbar_bulleted_label = $.i18n._('bulleted list') + " <ul> Ctrl-U";
+ var toolbar_heading_label = $.i18n._('heading') + " <h1>/<h2> Ctrl-H";
+ var toolbar_horizontal_label = $.i18n._('horizontal bar') + " <hr> Ctrl-R";
+ var toolbar_undo_label = $.i18n._('undo') + " Ctrl-Z";
+ var toolbar_redo_label = $.i18n._('redo') + " Ctrl-Y";
// -------------------------------------------------------------------
// YOUR CHANGES GO HERE
@@ -49,11 +49,9 @@ Attacklab.wmdBase = function(){
// The text that appears on the upper part of the dialog box when
// entering links.
- var imageDialogText = "<p style='margin-top: 0px'><b>输入图片地址</b></p><p>示例:<br />"+
- "http://www.cnprog.com/images/temp.jpg \"我的截图\"</p>";
- var linkDialogText = "<p style='margin-top: 0px'><b>输入Web地址</b></p><p>示例:<br />"+
- "http://www.cnprog.com/ \"我的网站\"</p>";
- var uploadImageHTML ="<div>或者上传本地图片:</div>" +
+ var imageDialogText = "<p style='margin-top: 0px'>" + $.i18n._('enter image url') + '</p>';
+ var linkDialogText = "<p style='margin-top: 0px'>" + $.i18n._('enter url') + '</p>';
+ var uploadImageHTML ="<div>" + $.i18n._('upload image') + "</div>" +
"<input type=\"file\" name=\"file-upload\" id=\"file-upload\" size=\"26\" "+
"onchange=\"return ajaxFileUpload($('#image-url'));\"/><br>" +
"<img id=\"loading\" src=\"/content/images/indicator.gif\" style=\"display:none;\"/>";
@@ -1079,7 +1077,7 @@ Attacklab.wmdBase = function(){
}
else {
// mac and other non-Windows platforms
- redoButton.title = "重做 - Ctrl+Shift+Z";
+ redoButton.title = $.i18n._('redo') + " - Ctrl+Shift+Z";
}
redoButton.XShift = "-220px";
redoButton.execute = function(manager){
diff --git a/templates/content/style/default.css b/templates/content/style/default.css
index 9b561803..0221cc03 100644
--- a/templates/content/style/default.css
+++ b/templates/content/style/default.css
@@ -164,7 +164,7 @@ h4 {display:block;font-size:90%; font-family:Verdana;color:#ccc;}
color:darkred;
font-weight:400;
font-size:100%;
- letter-spacing:1px;
+ /*letter-spacing:1px;*/
}
@@ -198,7 +198,7 @@ h4 {display:block;font-size:90%; font-family:Verdana;color:#ccc;}
float: left;
font-size: 140%;
font-weight:700;
- letter-spacing:3px;
+ /*letter-spacing:3px;*/
margin-top:8px;
padding:5px 0 0 3px ;
height:20px;
@@ -329,7 +329,7 @@ h4 {display:block;font-size:90%; font-family:Verdana;color:#ccc;}
font-size:120%;
font-weight:bold;
width:120px;
- letter-spacing:1px;
+ /*letter-spacing:1px;*/
background-color:#D4D0C8;
}
.notify
@@ -461,7 +461,7 @@ h4 {display:block;font-size:90%; font-family:Verdana;color:#ccc;}
}
.highlight-box{
- letter-spacing:1px;
+ /*letter-spacing:1px;*/
color:#735005;
}
@@ -890,7 +890,7 @@ h4 {display:block;font-size:90%; font-family:Verdana;color:#ccc;}
margin-bottom:-10px;
width:600px;
color:#aaa;
- letter-spacing:1px;
+ /*letter-spacing:1px;*/
}
@@ -1750,4 +1750,4 @@ a.comment-user:hover {
.error{color:red;}
.error-list li{padding:5px;}
.login{margin-bottom:10px;}
-.fieldset{border:solid 1px #777;margin-top:10px;padding:10px;} \ No newline at end of file
+.fieldset{border:solid 1px #777;margin-top:10px;padding:10px;}
diff --git a/templates/content/style/openid.css b/templates/content/style/openid.css
index 7a892840..0d201df2 100644
--- a/templates/content/style/openid.css
+++ b/templates/content/style/openid.css
@@ -42,4 +42,4 @@
}
.openid_selected {
border: 4px solid #DDD;
- } \ No newline at end of file
+ }
diff --git a/templates/content/style/style.css b/templates/content/style/style.css
index d0fac81c..165903ba 100644
--- a/templates/content/style/style.css
+++ b/templates/content/style/style.css
@@ -8,7 +8,7 @@ div{margin:0 auto; padding:0;}
h1,h2,h3,h4,h5,h6,ul,li,dl,dt,dd,form,img,p{margin:0; padding:0; border:none; }
input, select {font-family:Trebuchet MS,"segoe ui",Helvetica,"Microsoft YaHei",宋体,Tahoma,Verdana,MingLiu,PMingLiu,Arial,sans-serif;}
p{margin-bottom:4px; font-size:13px; line-height:160%;}
-a {color:#663333; text-decoration:none;}
+a {color:#333333; text-decoration:none;}
a:hover {text-decoration:underline;}
.block{width:960px; height:auto;}
.fleft{float:left;}
@@ -81,27 +81,46 @@ blockquote
#CALeft{width:700px; float:left; position:relative;padding-left:5px}
#CARight{width:240px; float:right; padding-right:5px}
#CAFull{float:left;padding:0 5px 0 5px;width:950px;}
-#ground {clear:both;border-top:6px solid #000; padding-top:6px; padding-bottom:50px; text-align:center;background:#777;}
+#ground {width:100%;border-top:1px solid #000; padding-top:6px; padding-bottom:10px; text-align:center;background:#777;}
+/*#licenseLogo {top:10px;right:10px;}*/
/*顶部及导航栏*/
-#top {height:20px; text-align:right; padding:3px;background-color:#eee;}
+#top {height:20px; text-align:right; padding:3px;background-color:#ffffff;}
#header {width:960px;}
-#top a {height:35px; text-align:right;letter-spacing:1px; margin-left:20px;text-decoration:underline; font-size:12px; color:#666;}
+#top a {height:35px; text-align:right;
+ /*letter-spacing:1px; */
+ margin-left:20px;text-decoration:underline; font-size:12px; color:#333333;}
#logo {padding:5px;}
#navBar {float:clear;position:relative;display:block;width:960px;}
-#navBar .nav {margin:20px 0px 0px 16px;letter-spacing:1px; }
-#navBar .nav a {color:#333; background-color:#F9F7ED; padding:0px 12px 3px 12px; height:25px; line-height:30px;margin-left:10px; font-size:15px; font-weight:400; text-decoration:none;display: block;float: left;}
+#navBar .nav {margin:20px 0px 0px 16px;
+ /*letter-spacing:1px; */
+ }
+#navBar .nav a {color:#333; background-color:#F9F7ED;
+ border-bottom: none;
+ border-left: 1px solid #aaaaaa;
+ border-right: 1px solid #aaaaaa;
+ border-top: 1px solid #aaaaaa;
+ padding:0px 12px 3px 12px; height:25px; line-height:30px;margin-left:10px; font-size:15px; font-weight:400; text-decoration:none;display: block;float: left;}
#navBar .nav a:hover {text-decoration:underline}
-#navBar .nav a.on {height:24px;line-height:28px;border:1px solid #B02B2C; background:#B02B2C; color:#FFF; font-weight:600; text-decoration:none}
+#navBar .nav a.on {height:24px;line-height:28px;
+ border-top:1px solid #e66222;
+ border-bottom: 1px solid #d64000;
+ border-right:1px solid #e66222;
+ border-left:1px solid #e66222;
+ /*background:#A31E39; */
+ background:#d64000;
+ color:#FFF; font-weight:600; text-decoration:none}
#navBar .nav a.special {font-size:15px; color:#B02B2C; font-weight:bold; text-decoration:none; }
#navBar .nav a.special:hover {text-decoration:underline;}
#navBar .nav div.focus {float:right; padding-right:0px;}
/*搜索栏*/
-#searchBar {background-color:#B02B2C;padding:5px;}
+#searchBar {background-color:#9db2b1;padding:5px;} /* #B02B2C */
#searchBar .content { }
#searchBar .searchInput {font-size:13px; height:18px; width:400px;}
#searchBar .searchBtn {font-size:14px; height:26px; width:80px;}
-#searchBar .options {padding-top:5px; font-size:100%;color:#EEE;letter-spacing:1px;}
+#searchBar .options {padding-top:5px; font-size:100%;color:#EEE;
+ /*letter-spacing:1px;*/
+ }
#searchBar .options INPUT {margin-left:15px;}
#searchBar .options INPUT:hover {cursor:pointer}
@@ -111,7 +130,9 @@ blockquote
#listA .qstA thumb {float:left; }
#listA .qstA H2 {font-size:15px; font-weight:800; margin:8px auto;padding:0px;}
#listA .qstA H2 a {color:#663333; }
-#listA .qstA .stat {font-size:13px;letter-spacing:1px;float:right;}
+#listA .qstA .stat {font-size:13px;
+ /*letter-spacing:1px;*/
+ float:right;}
#listA .qstA .stat span {margin-right:5px;}
#listA .qstA .stat td {min-width:40px;text-align:center;}
#listA .qstA .stat .num {font-family:arial;color:#905213; font-size:20px; font-weight:800;}
@@ -270,7 +291,9 @@ a:hover.medal {color:#333; text-decoration:none; background:url(/content/images
.headMedals {float:left; height:23px; line-height:23px; margin:5px 0 0 5px;padding:0px 6px 0px 15px; font-size:15px; font-weight:700; border-bottom:0px solid #777; border-left:0px solid #darkred; background-color:#FFF;background:url(/content/images/dot-list.gif) no-repeat left center;}
.headLogin {float:left; padding:3px; font-size:15px; font-weight:800; background:url(/content/images/ico_login.gif) no-repeat; padding-left:24px;}
.headNormal {text-align:left;padding:3px; font-size:15px; margin-bottom:12px; font-weight:800;border-bottom:1px solid #777;}
-.headUser {text-align:left;padding:5px; font-size:20px; letter-spacing:1px;margin-bottom:12px; font-weight:800;border-bottom:1px solid #777;}
+.headUser {text-align:left;padding:5px; font-size:20px;
+ /*letter-spacing:1px;*/
+ margin-bottom:12px; font-weight:800;border-bottom:1px solid #777;}
/*RSS订阅*/
#feeds {margin:10px 0; }
#feeds a {background:url(/content/images/feed-icon-small.png) no-repeat 0; padding-left:18px; font-weight:700; font-size:13px; }
@@ -330,6 +353,7 @@ a:hover.medal {color:#333; text-decoration:none; background:url(/content/images
padding: 15px;
color: White;
background-color: darkred;
+ text-align: center;
}
.vote-notification a
{
@@ -446,9 +470,6 @@ a.comment-user, a.comment-user:hover {
a.comment-user:hover {
text-decoration:underline;
}
-.deleted{
- background:#F4E7E7 none repeat scroll 0 0;
-}
/*回答*/
#answers {}
.answer{
@@ -521,6 +542,10 @@ a.comment-user:hover {
.answer-img-accept:hover{background:url(/content/images/vote-accepted-on.png)}
+.deleted{
+ background:#F4E7E7 none repeat scroll 0 0;
+}
+
/*标签列表*/
.tagsbox {}
.tagsbox a {color:#000;line-height:30px;margin-right:10px;font-size:100%;background-color:#F9F7ED;padding:3px;}
@@ -616,7 +641,7 @@ span.form-error {
font-weight:600;
width:100%;
color:#aaa;
- letter-spacing:1px;
+ /*letter-spacing:1px;*/
text-align:left;
}
@@ -699,7 +724,9 @@ background-color: #97ff97;
/*用户资料页面*/
.count {font-family:Arial;font-size:200%;font-weight:700;color:#777}
-.scoreNumber{font-family:Arial;font-size:35px;font-weight:800;color:#777;line-height:40px;letter-spacing:0px}
+.scoreNumber{font-family:Arial;font-size:35px;font-weight:800;color:#777;line-height:40px;
+ /*letter-spacing:0px*/
+ }
.user-details{font-size:13px;}
.user-about{background-color:#EEEEEE;height:200px;line-height:20px; overflow:auto;padding:10px;width:90%;}
.user-edit-link {background:url(/content/images/edit.png) no-repeat; padding-left:20px; font-weight:600;}
@@ -747,13 +774,18 @@ width:950;margin-bottom:10px;
font-family:Arial;
}
+.stats div {
+ font-size:11px;
+ text-align:center;
+}
+
.narrow .votes {
background:#EEEEEE none repeat scroll 0 0;
float:left;
- height:38px;
+ height:42px;
margin:0 3px 0 0;
padding:5px;
- width:40px;
+ width:46px;
text-align:center;
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
@@ -771,10 +803,11 @@ width:950;margin-bottom:10px;
.narrow .views {
float:left;
- height:38px;
+ height:42px;
margin:0 7px 0 0;
- padding:5px 0 5px 4px;
- width:40px;
+ /*padding:5px 0 5px 4px;*/
+ padding: 5px;
+ width:46px;
text-align:center;
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
@@ -784,10 +817,10 @@ width:950;margin-bottom:10px;
.narrow .status {
float:left;
- height:38px;
+ height:42px;
margin:0 3px 0 0;
padding:5px;
- width:40px;
+ width:46px;
text-align:center;
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
@@ -928,7 +961,9 @@ div.started .reputation-score {
.blogRss {float:right;margin:0 10px 0 0;width:460px;height:240px;background-color:#EEE; padding:5px;}
.bookQuestions {margin-bottom:10px;}
.bookFeed {float:right;}
-.bookAsk{letter-spacing:1px; float:right;margin:-30px 10px 0 0; padding:3px 5px 3px 5px;}
+.bookAsk{
+ /*letter-spacing:1px; */
+ float:right;margin:-30px 10px 0 0; padding:3px 5px 3px 5px;}
.bookAsk a {font-size:15px; color:#FFF; font-weight:bold; text-decoration:none;background-color:#EC7000;padding:3px 6px 3px 6px; }
.bookAsk a:hover {text-decoration:underline;}
@@ -944,7 +979,9 @@ div.started .reputation-score {
.silver, .badge2 {color:#CCCCCC;}
.bronze, .badge3 {color:#CC9933;}
.score {font-weight:800; color:#333;}
-.footerLinks {color:#EEE; font-size:13px; letter-spacing:1px;}
+.footerLinks {color:#EEE; font-size:13px;
+ /* letter-spacing:1px;*/
+ }
.footerLinks a {color:#FFF; font-size:13px;}
.subSearch {margin-bottom:12px; padding:4px;}
a.comment {background:#EEE; color:#993300; padding:4px;}
@@ -959,7 +996,15 @@ ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2p
.message{padding:5px;font-weight:bold;background-color:#eee;margin:10px 0 10px 0;}
.warning{color:red;}
.darkred{color:darkred;}
-.submit{cursor:pointer;letter-spacing:1px;background-color:#D4D0C8;height:40px;border:1px solid #777;width:100px;font-weight:bold;font-size:120%;}
+.submit{
+ cursor:pointer;
+ /*letter-spacing:1px;*/
+ background-color:#D4D0C8;
+ height:40px;
+ border:1px solid #777;
+/* width:100px; */
+ font-weight:bold;
+ font-size:120%;}
.submit:hover{text-decoration:underline;}
.ask-body{padding-right:10px;}
.thousand{color:orange;}
@@ -996,4 +1041,4 @@ ul.bulleta li {background:url(/content/images/bullet_green.gif) no-repeat 0px 2p
padding-left: 3px;
padding-right: 3px;
cursor:pointer;
-} \ No newline at end of file
+}
diff --git a/templates/faq.html b/templates/faq.html
index e9650c3e..31ee444a 100644
--- a/templates/faq.html
+++ b/templates/faq.html
@@ -1,47 +1,47 @@
+<!-- template faq.html -->
{% extends "base_content.html" %}
{% load extra_tags %}
{% load humanize %}
+{% load i18n %}
{% block title %}{% spaceless %}FAQ{% endspaceless %}{% endblock %}
{% block forejs %}
{% endblock %}
{% block content %}
<div class="headNormal">
- 常见问题(FAQ)
+ {% trans "Frequently Asked Questions " %}(FAQ)
</div>
<div id="main-body" style="width:100%">
- <h3 class="subtitle">我可以在这里提问什么样的问题?</h3>
- <p>毫无疑问,首先必须是<span class="yellowbg">技术编程问题!</span>
- 提问之前,充分利用系统的自动查找、标签和搜索,看看是否已经有一样的问题并有了答案。<br>
- 避免问相同的问题,减少后有问题的朋友的疑惑,以后能够清晰地找到唯一问题和答案。
+ <h3 class="subtitle">{% trans "What kinds of questions can I ask here?" %}</h3>
+ <p>{% trans "Most importanly - questions should be <strong>relevant</strong> to this community." %}<br>
+ {% trans "Before asking the question - please make sure to use search to see whether your question has alredy been answered."%}<br>
</p><br>
- <h3 class="subtitle">什么样的问题我不该在这里提问?</h3>
- <p> <span class="yellowbg">与程序员或技术无关的,引起争吵或太过于主观性等违背社区宗旨的内容。</span>本站建立是为了帮助大众程序员解决实际技术问题,我们需要实际的问题!
- </p><p>
- 同样,在社区建立之初,很多用户可能对社区有各种各样的疑问。我们希望能够通过更多的faq或者文档去解释这些疑问,如果用户没有找到答案,希望你在社区提出此类问题,并引用“faq”或者“cnprog”等相关的标签。毕竟,访问社区的用户,是关心他们要寻找的答案,不是来学习如何使用复杂的社区功能的。
- </p><p>
- 如果还没有拜读过Eric S. Raymond的<a href="http://www.catb.org/~esr/faqs/smart-questions.html">《How To Ask Questions The Smart Way》</a>的朋友,推荐先读一下大师的箴言。另外,这里有一<a href="http://www.dianbo.org/9238/stone/tiwendezhihui.htm">中文版本</a>,可以参考浏览。
- </p><p><span class="yellowbg">管理运行社区的是你们,而不是我们。</span></p>
+ <h3 class="subtitle">{% trans "What questions should I avoid asking?" %}</h3>
+ <p>{% trans "Please avoid asking questions that are not relevant to this community, too subjective and argumentative." %}</p>
</p><br>
- <h3 class="subtitle">什么样的回答是不受欢迎的?</h3>
- <p> CNProg 希望用户提供针对提问的技术回答,可以是进一步了解问题实质,给予参考方案,或完全解决问题的回答。我们希望通过问答的形式解决用户的实际问题。因此,<span class="yellowbg">我们不欢迎在回答中出现不是回答问题的内容,包括针对他人回答的讨论,和其他无意义的浪费网络资源行为</span>。CNProg建议您使用<span class="yellowbg">评论</span>功能来讨论你的意见和想法。
-
+ <h3 class="subtitle">{% trans "What should I avoid in my answers?" %}</h3>
+ <p>{% trans "site title" %} {% trans "is a Q&A site, not a discussion group. Therefore - please avoid having discussions in your answers, comment facility allows some space for brief discussions." %}
</p><br>
- <h3 class="subtitle">谁是社区的管理员?</h3>
- <p> 答案是:<span class="yellowbg">每个用户。</span><br>
-
- 社区没有严格意义上的管理员身份。
- 通过积分运作,<span class="yellowbg">每个用户都有权限创建标签,进行对所有问题、回答的投票、编辑、关闭等操作。</span>
+ <h3 class="subtitle">{% trans "Who moderates this community?" %}</h3>
+ <p>{% trans "The short answer is: <strong>you</strong>." %}<br>
+ {% trans "This website is moderated by the users." %}
+ {% trans "The reputation system allows users earn the authorization to perform a variety of moderation tasks." %}
</p><br>
- <h3 class="subtitle">什么是社区积分?</h3>
- <p> 对于正常使用社区进行提问、回答而言,积分不是必须的。<br>
- 我们一再声明,CNProg由你来运行和维护。如果你想帮助我们来运作CNProg,你需要一定的积分等级。<span class="yellowbg">积分是一种用来粗略衡量社区对你有多信任的数据。</span>积分不是有谁来支付或直接给予你的,而是你通过获得其他用户的支持和信任“赚得”的。
- <br><br>
- 举例来说,如果你提了一个非常有帮助的问题或者做了很有用的回答,你将会被其他用户投赞成票。相反,你提了不受欢迎的问题,或者误导用户的回答,你将可能被其他用户投反对票。每个赞成票会帮你产生<strong>10</strong>个社区积分,每个反对票会相应扣除你<strong>2</strong>个积分。每天通过别人投赞成票,你最多只能产生<strong>200</strong>个积分,这是上限。当你累计到一定积分,你可以在社区做更多的事情:<br>
+ <h3 class="subtitle">{% trans "How does reputation system work?" %}</h3>
+ <p>{% trans "Anyone can ask questions and give answers, points are not necessary for that." %}<br>
+ {% trans "As we've said before, users help running this site. Point system helps select users who can administer this community."%}
+ {% trans "Reputation points roughly measure how community trusts you. These points are given to you directly by other members of the community." %}
+ </p>
+ <p>
+ {% trans "For example, if you ask an interesting question or give a helpful answer, your input will be upvoted and you will gain more trust in the community." %}
+ {% trans "If on the other hand someone gives a misleading answer, the answer will be voted down and he/she loses some points." %}
+ {% trans "Each vote in favor will generate <strong>10</strong> points, each vote against will subtract <strong>2</strong> points." %}
+ {% trans "Through the votes of other people you can accumulate a maximum of <strong>200</strong> points." %}
+ {% trans "After accumulating certain number of points, you can do more:" %}
<table style="font-family:arial;" cellspacing="3" cellpadding="3">
<tr>
<th width="40px" style="text-align:right"></th>
@@ -49,66 +49,65 @@
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>15</strong></td>
- <td>投赞成票</td>
+ <td>{% trans "upvote" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>15</strong></td>
- <td>标记垃圾帖</td>
+ <td>{% trans "use tags" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>50</strong></td>
- <td>添加评论</td>
+ <td>{% trans "add comments" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>100</strong></td>
- <td>投反对票</td>
+ <td>{% trans "downvote" %}</td>
</tr><tr>
<td style="text-align:right;padding-right:5px"><strong>250</strong></td>
<td>打开关闭自己的问题</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>500</strong></td>
- <td>给任何问题整理标签</td>
+ <td>{% trans "retag questions" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>750</strong></td>
- <td>编辑wiki类问题</td>
+ <td>{% trans "edit community wiki questions" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>2000</strong></td>
- <td>编辑任何问题或答案</td>
+ <td>{% trans "edit any answer" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>3000</strong></td>
- <td>打开关闭任何人的问题</td>
+ <td>{% trans "open any closed question" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>5000</strong></td>
- <td>删除任何一个评论</td>
+ <td>{% trans "delete any comment" %}</td>
</tr>
<tr>
<td style="text-align:right;padding-right:5px"><strong>10000</strong></td>
- <td>删除任何一个问题或答案,及其他管理功能</td>
+ <td>{% trans "delete any questions and answers and perform other moderation tasks" %}</td>
</tr>
</table>
</p><br>
- <h3 class="subtitle">我需要注册一个新用户吗?</h3>
- <p> 不需要。社区提供了OpenID的登录支持,你要用Google、Yahoo等任何支持OpenID登录的帐号就可以使用系统。<strong><a href="/account/signin">马上登录</a> »</strong>
+ <h3 class="subtitle">{% trans "To register, do I need to create new password?" %}</h3>
+ <p>{% trans "No, you don't have to. You can login through any service that supports OpenID, e.g. Google, Yahoo, AOL, etc." %}
+ <strong><a href="/account/signin">{% trans "Login now!" %}</a> »</strong>
</p><br>
- <h3 class="subtitle">为什么其他人可以修改我的问题/回答?</h3>
- <p> CNProg 是为了帮助程序员解决更多问题,更加方便的解决问题。所以问题和答案都是如Wiki一样可编辑的,我们希望社区能帮助用户沉淀、积累更多有用的知识和经验。如果您不喜欢这种方式,我们尊重你的选择。
+ <h3 class="subtitle">{% trans "Why other people can edit my questions/answers?" %}</h3>
+ <p> {% trans "Goal of this site is..." %} {% trans "So questions and answers can be edited like wiki pages by experienced users of this site and this improves the overall quality of the knowledge base content." %}
+ {% trans "If this approach is not for you, we respect your choice." %}
</p><br>
-
- <h3 class="subtitle">还有其他问题?</h3>
- <p> 如果您对社区还有其他疑问,请一起来完善我们的<a href="/tags/faq" class="big">CNProg FAQ</a>。
+ <h3 class="subtitle">{% trans "Still have questions?" %}</h3>
+ <p>{% trans "Please ask your question, help make our community better!" %} <a href="/tags/faq" class="big">{% trans "site title" %} {% trans "questions" %}</a>{% trans "." %}
</p>
<br><br>
</div>
{% endblock %}
-
-
-
+<!-- end template faq.html -->
diff --git a/templates/footer.html b/templates/footer.html
index 46649b9f..61e6e6bb 100644
--- a/templates/footer.html
+++ b/templates/footer.html
@@ -1,28 +1,33 @@
-{% load extra_tags %}
+<!-- template footer.html -->
+{% load extra_tags %}
{% load i18n %}
+<!-- 页面底部开始: -->
<div id="ground">
<div class="footerLinks" >
- <a href="/about">{% trans "About us" %}</a><span class="link-separator"> |</span>
+ <a href="/about">{% trans "about" %}</a><span class="link-separator"> |</span>
<a href="/faq">{% trans "faq" %}</a><span class="link-separator"> |</span>
- <a href="http://blog.cnprog.com">Blog</a><span class="link-separator"> |</span>
- <a href="mailto:team@cnprog.com">{% trans "Contact" %}</a><span class="link-separator"> |</span>
- <a href="/privacy">{% trans "Privacy" %}</a><span class="link-separator"> |</span>
- <a href="http://cnprog.uservoice.com" target="_blank">{% trans "Feedback" %}</a>
+ <a href="{{ blog_url }}">{% trans "blog" %}</a><span class="link-separator"> |</span>
+ <a href="{{ webmaster_email }}">{% trans "contact us" %}</a><span class="link-separator"> |</span>
+ <a href="/privacy">{% trans "privacy policy" %}</a><span class="link-separator"> |</span>
+ <a href="{{ feedback_url }}" target="_blank">{% trans "give feedback" %}</a>
</div>
<p style="margin-top:10px;">
<a href="http://code.google.com/p/cnprog/" target="_blank">
<img src="/content/images/djangomade124x25_grey.gif" border="0" alt="Made with Django." title="Made with Django." >
</a>
+ <!--<div style="font-size:90%;color:#333">{% trans "current revision" %}: R-0120-20090406</div>-->
</p>
- <p style="margin-top:-30px; margin-right:15px;" class="fright"><img src="/content/images/cc-wiki.png" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /></p>
+ <p id="licenseLogo"><img src="/content/images/cc-wiki.png" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /></p>
</div>
+ <!-- 页面底部结束: -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
- var pageTracker = _gat._getTracker("UA-248512-5");
+ var pageTracker = _gat._getTracker({{ google_analytics_key }});
pageTracker._trackPageview();
} catch(err) {}
</script>
+<!-- end template footer.html -->
diff --git a/templates/header.html b/templates/header.html
index 1da107b6..0aa02886 100644
--- a/templates/header.html
+++ b/templates/header.html
@@ -1,13 +1,15 @@
+<!-- template header.html -->
{% load extra_tags %}
{% load i18n %}
<div id="top">
<div id="header">
{% if request.user.is_authenticated %}
- <a href="/users/{{ request.user.id }}/{{ request.user.username }}/">{{ request.user.username }}</a> {% get_score_badge request.user %} <a href="/logout/">{% trans "Logout" %}</a>
+ <a href="/users/{{ request.user.id }}/{{ request.user.username }}/">{{ request.user.username }}</a> {% get_score_badge request.user %}
+ <a href="/logout/">{% trans "logout" %}</a>
{% else %}
- <a href="/account/signin">{% trans "Login" %}</a>
+ <a href="/account/signin">{% trans "login" %}</a>
{% endif %}
- <a href="/about">{% trans "About us" %}</a>
+ <a href="/about">{% trans "about" %}</a>
<a href="/faq">{% trans "faq" %}</a>
</div>
</div>
@@ -18,24 +20,26 @@
<td width="23%">
<div id="logo">
<a href="/">
- <img src="/content/images/logo.png" title="{% trans 'link to homepage'%}" />
+ <img src="/content/images/logo.png" title="{% trans "back to home page" %}" />
</a>
</div>
</td>
<td width="77%" valign="bottom">
<div class="nav">
- <a id="nav_questions" href="/questions/" >{% trans "Questions" %}</a>
- <a id="nav_tags" href="/tags/">{% trans "Tags" %}</a>
- <a id="nav_users" href="/users/">{% trans "Users" %}</a>
- <a id="nav_books" href="/books/">{% trans "Books" %}</a>
- <a id="nav_badges" href="/badges/">{% trans "Badges" %}</a>
- <a id="nav_unanswered" href="/questions/unanswered/">{% trans "Unanswered" %}</a>
+ <a id="nav_questions" href="/questions/" >{% trans "questions" %}</a>
+ <a id="nav_tags" href="/tags/">{% trans "tags" %}</a>
+ <a id="nav_users" href="/users/">{% trans "users" %}</a>
+ <!--<a id="nav_books" href="/books/">{% trans "books" %}</a>-->
+ <a id="nav_badges" href="/badges/">{% trans "badges" %}</a>
+ <a id="nav_unanswered" href="/questions/unanswered/">{% trans "unanswered questions" %}</a>
+ {% comment %}<!-- i think this needs to be removed -e.f. -->
{% if request.user.is_authenticated %}
- <a id="nav_profile" href="/users/{{ request.user.id }}/{{ request.user.username }}/">{% trans "Profile" %}</a>
+ <a id="nav_profile" href="/users/{{ request.user.id }}/{{ request.user.username }}/">{% trans "my profile" %}</a>
{% endif %}
+ {% endcomment %}
<div class="focus">
- <a id="nav_ask" href="/questions/ask/" class="special">{% trans "Ask a question" %}</a>
+ <a id="nav_ask" href="/questions/ask/" class="special">{% trans "ask a question" %}</a>
</div>
</div>
@@ -50,12 +54,12 @@
<form action="/search/" method="GET">
<div>
<input type="text" class="searchInput" value="{{ keywords }}" name="q" id="keywords" >
- <input type="submit" name="Submit" value="{% trans 'Search' %}" class="searchBtn" >
+ <input type="submit" name="Submit" value="{% trans "search" %}" class="searchBtn" >
</div>
<div class="options">
- <input id="type-question" type="radio" class="" value="question" name="t" checked >{% trans "Questions" %}
- <input id="type-tag" type="radio" class="" value="tag" name="t" >{% trans "Tags" %}
- <input id="type-user" type="radio" class="" value="user" name="t" >{% trans "Users" %}
+ <input id="type-question" type="radio" class="" value="question" name="t" checked >{% trans "questions" %}
+ <input id="type-tag" type="radio" class="" value="tag" name="t" >{% trans "tags" %}
+ <input id="type-user" type="radio" class="" value="user" name="t" >{% trans "users" %}
</div>
</form>
</td>
@@ -63,3 +67,4 @@
</table>
</div>
</div>
+<!-- end template header.html -->
diff --git a/templates/index.html b/templates/index.html
index ba3e2229..2ef66d4e 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,11 +1,11 @@
{% extends "base.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load humanize %}
{% load extra_filters %}
-{% load i18n %}
{% block title %}{% spaceless %}{% trans "Home" %}{% endspaceless %}{% endblock %}
-{% block meta %}<meta name="keywords" content="{{ APP_KEYWORDS }}" />
- <meta name="description" content="{{ APP_DESCRIPTION }}" />{% endblock %}
+{% block meta %}<meta name="keywords" content="{% trans "meta site keywords, comma separated" %}" />
+ <meta name="description" content="{% trans "meta site content" %}" />{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -20,12 +20,13 @@
<div class="tabBar">
<div class="headQuestions">{% trans "Questions" %}</div>
<div class="tabsA">
- <a id="latest" href="?sort=latest" title="{% trans 'Newest updated questions' %}" >{% trans "Newest" %}</a>
- <a id="hottest" href="?sort=hottest" title="{% trans 'Questions with most answers' %}" >{% trans "Hottest" %}</a>
- <a id="mostvoted" href="?sort=mostvoted" title="{% trans 'Questions with most votes' %}" >{% trans "Best" %}</a>
- <a id="all" href="/questions/" title="{% trans 'All questions' %}" >{% trans "All" %}</a>
+ <a id="latest" href="?sort=latest" title="{% trans "last updated questions" %}" >{% trans "newest" %}</a>
+ <a id="hottest" href="?sort=hottest" title="{% trans "hottest questions" %}" >{% trans "hottest" %}</a>
+ <a id="mostvoted" href="?sort=mostvoted" title="{% trans "most voted questions" %}" >{% trans "most voted" %}</a>
+ <a id="all" href="/questions/" title="{% trans "all questions" %}" >{% trans "all questions" %}</a>
</div>
</div>
+<!-- 问题列表 -->
<div id="listA">
{% for question in questions %}
<div class="qstA">
@@ -42,9 +43,9 @@
<td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
</tr>
<tr>
- <td><span class="unit">{% trans "Answers" %}</span></td>
- <td><span class="unit">{% trans "Votes" %}</span></td>
- <td><span class="unit">{% trans "Visits" %}</span></td>
+ <td><span class="unit">{% trans "answers" %}</span></td>
+ <td><span class="unit">{% trans "votes" %}</span></td>
+ <td><span class="unit">{% trans "views" %}</span></td>
</tr>
</table>
</div>
@@ -52,7 +53,7 @@
{{ question.summary }}...
</div>
{% if question.wiki %}
- <span class="from wiki">{% trans "Community wiki" %}</span>
+ <span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
{% else %}
<div class="from">
@@ -64,7 +65,7 @@
{% endif %}
<div class="tags">
{% for tag in question.tagname_list %}
- <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans 'Browse questions with tag of ' %}'{{ tag }}'" rel="tag">{{ tag }}</a>
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
{% endfor %}
</div>
</div>
@@ -75,11 +76,12 @@
{% block sidebar %}
{% if not request.user.is_authenticated %}
<div class="boxA">
- <h3>{% trans "Welcome" %}</h3>
+ <h3>{% trans "welcome to website" %}</h3>
<div class="body">
- {{ APP_INTRO|safe }}
- <div class="more"><a href="/about">{% trans "About us" %} »</a></div>
- <div class="more"><a href="/faq">FAQ »</a></div>
+ <p>{% trans "what is this website" %}</p>
+ <p>{% trans "what can one do on this website" %}</p>
+ <div class="more"><a href="/about">{% trans "about" %} »</a></div>
+ <div class="more"><a href="/faq">{% trans "faq" %} »</a></div>
</div>
</div>
{% endif %}
@@ -88,33 +90,34 @@
<div class="body">
<p class="tagsbox">
{% for tag in tags %}
- <a rel="tag" title="{% trans 'Browse questions with tag of ' %}'{{ tag.name }}'" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
+ <a rel="tag"
+ title="{% blocktrans with tag.name as tagname %}see questions tagged '{{tagname}}'{% endblocktrans %}" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
{% endfor %}
</p>
- <div class="more"><a href="/tags">{% trans "Popular tags" %} »</a> </div>
+ <div class="more"><a href="/tags">{% trans "popular tags" %} »</a> </div>
</div>
</div>
<div class="boxB">
- <h3>{% trans "Recent badges" %}</h3>
+ <h3>{% trans "Recent awards" %}</h3>
<div class="body">
<ul class="badge-list">
{% for award in awards %}
<li>
<a href="/badges/{{award.badge_id}}/{{award.badge_name}}" title="{{ award.badge_description }}" class="medal">
- <span class="badge{{ award.badge_type }}">&#9679;</span>&nbsp;{{ award.badge_name }}</a>
+ <span class="badge{{ award.badge_type }}">&#9679;</span>&nbsp;{{ award.badge_name }}</a> {% trans "given to" %}
<a href="/users/{{award.user_id}}/{{award.user_name}}">{{ award.user_name }}</a>
</li>
{% endfor %}
</ul>
- <div class="more"><a href="/badges/">{% trans "All badges" %} »</a> </div>
+ <div class="more"><a href="/badges/">{% trans "all awards" %} »</a> </div>
</div>
</div>
<div id="feeds">
-<a href="/feeds/rss" title="{% trans 'RSS feed of recent 30 questions' %}">{% trans "Subscribe" %}</a>
+<a href="/feeds/rss" title="{% trans "subscribe to last 30 questions by RSS" %}">{% trans "subscribe to the questions feed" %}</a>
</div>
{% endblock %}
{% block tail %}
<div style="padding:5px 0 5px 5px;">
-<span class="evenMore">{% trans "Are you looking for more questions? Try to browse" %} <a href="/questions/">{% trans "All questions" %}</a>{% trans " or "%} <a href="/tags/">{% trans "Popular tags" %}</a>{% trans ". Please help us answer "%}<a href="/questions/unanswered">{% trans "Unanswered questions" %}</a></span>
+<span class="evenMore">{% trans "Still looking for more? See" %} <a href="/questions/">{% trans "complete list of quesionts" %}</a>, {% trans "or" %} <a href="/tags/">{% trans "popular tags" %}</a>{% trans "." %} {% trans "Please help us answer" %} <a href="/questions/unanswered">{% trans "unanswered questions" %}</a>{% trans "." %}</span>
</div>
{% endblock %}
diff --git a/templates/logout.html b/templates/logout.html
index 48a2deaf..b13e5e25 100644
--- a/templates/logout.html
+++ b/templates/logout.html
@@ -1,3 +1,4 @@
+<!-- template logout.html -->
{% extends "base_content.html" %}
{% load extra_tags %}
{% load humanize %}
@@ -13,13 +14,12 @@
{% endblock %}
{% block content %}
<div class="headNormal">
- {% trans "Logout" %}
+ {% trans "Logout" %}
</div>
<div id="main-body" style="width:100%">
- <input id="btLogout" type="button" class="submit" value="OK" style="width:150px">
+ <p>{% trans "As a registered user you can login with your OpenID, log out of the site or permanently remove your account." %}</p>
+ <input id="btLogout" type="button" class="submit" value="{% trans "Logout now" %}"><!-- style="width:150px">-->
<br><br>
</div>
{% endblock %}
-
-
-
+<!-- ent template logout.html -->
diff --git a/templates/okfiles b/templates/okfiles
new file mode 100644
index 00000000..3ca0191e
--- /dev/null
+++ b/templates/okfiles
@@ -0,0 +1,30 @@
+404.html
+500.html
+about.html
+ask.html
+badges.html
+base_content.html
+base.html
+book.html
+close.html
+faq.html
+footer.html
+header.html
+index.html
+logout.html
+pagesize.html
+paginator.html
+privacy.html
+question_edit_tips.html
+question.html
+questions.html
+revisions_answer.html
+tags.html
+unanswered.html
+user_edit.html
+user_info.html
+users.html
+users_questions.html
+user_stats.html
+user_tabs.html
+user_votes.html
diff --git a/templates/pagesize.html b/templates/pagesize.html
index 5eb0159c..5037f1f6 100644
--- a/templates/pagesize.html
+++ b/templates/pagesize.html
@@ -1,7 +1,9 @@
+<!-- template pagesize.html -->
{% spaceless %}
+{% load i18n %}
{% if is_paginated %}
<div class="paginator">
- <span class="text">每页显示</span>
+ <span class="text">{% trans "posts per page" %}</span>
{% ifequal pagesize 10 %}
<span class="curr">10</span>
{% else %}
@@ -21,4 +23,5 @@
{% endifequal %}
</div>
{% endif %}
-{% endspaceless %} \ No newline at end of file
+{% endspaceless %}
+<!-- end template pagesize.html -->
diff --git a/templates/paginator.html b/templates/paginator.html
index 3e8bd856..c5e51a81 100644
--- a/templates/paginator.html
+++ b/templates/paginator.html
@@ -1,7 +1,10 @@
+<!-- paginator.html -->
{% spaceless %}
+{% load i18n %}
{% if is_paginated %}
<div class="paginator">
-{% if has_previous %}<span class="prev"><a href="{{base_url}}page={{ previous }}{{ extend_url }}" title="上一页">&laquo; 上一页</a></span>{% endif %}
+{% if has_previous %}<span class="prev"><a href="{{base_url}}page={{ previous }}{{ extend_url }}" title="{% trans "previous" %}">
+&laquo; {% trans "previous" %}</a></span>{% endif %}
{% if not in_leading_range %}
{% for num in pages_outside_trailing_range %}
@@ -14,22 +17,23 @@
{% ifequal num page %}
{% ifequal pages 1 %}
{% else %}
- <span class="curr" title="当前页">{{ num }}</span>
+ <span class="curr" title="{% trans "current page" %}">{{ num }}</span>
{% endifequal %}
{% else %}
- <span class="page"><a href="{{base_url}}page={{ num }}{{ extend_url }}" title="第{{ num }}页">{{ num }}</a></span>
+ <span class="page"><a href="{{base_url}}page={{ num }}{{ extend_url }}" title="{% trans "page number " %}{{ num }}{% trans "number - make blank in english" %}">{{ num }}</a></span>
{% endifequal %}
{% endfor %}
{% if not in_trailing_range %}
...
{% for num in pages_outside_leading_range reversed %}
- <span class="page"><a href="{{base_url}}page={{ num }}{{ extend_url }}" title="第{{ num }}页">{{ num }}</a></span>
+ <span class="page"><a href="{{base_url}}page={{ num }}{{ extend_url }}" title="{% trans "page number " %}{{ num }}{% trans "number - make blank in english" %}">{{ num }}</a></span>
{% endfor %}
{% endif %}
-{% if has_next %}<span class="next"><a href="{{base_url}}page={{ next }}{{ extend_url }}" title="下一页">下一页 &raquo;</a></span>{% endif %}
+{% if has_next %}<span class="next"><a href="{{base_url}}page={{ next }}{{ extend_url }}" title="{% trans "next page" %}">{% trans "next page" %} &raquo;</a></span>{% endif %}
</div>
{% endif %}
-{% endspaceless %} \ No newline at end of file
+{% endspaceless %}
+<!-- end paginator.html -->
diff --git a/templates/privacy.html b/templates/privacy.html
index b0f02cd7..335aba92 100644
--- a/templates/privacy.html
+++ b/templates/privacy.html
@@ -1,40 +1,43 @@
+<!-- privacy.html -->
{% extends "base_content.html" %}
{% load extra_tags %}
+{% load i18n %}
{% load humanize %}
-{% block title %}{% spaceless %}隐私政策{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Privacy policy" %}{% endspaceless %}{% endblock %}
{% block forejs %}
{% endblock %}
{% block content %}
<div class="headNormal">
- 隐私政策
+ {% trans "Privacy policy" %}
</div>
<div id="main-body" style="width:100%">
<p>
- CNProg承认用户隐私的重要性。本文件概述在您浏览CNProg过程中所接收和收集的个人信息的种类,以及CNProg所采取的保护信息的一些措施。CNProg希望这将有助于您在知情的情况下,就和我们共享个人信息的问题作出决定。
+ {% trans "general message about privacy" %}
</p>
- <h3 class="subtitle">网站访问者</h3>
- <p> 当您访问本网站或使用我们的某些在线服务时,服务器会自动记录信息,包括但不限于URL、IP地址、浏览器的类型、屏幕分辨率、系统类型和使用的语言以及访问日期和时间。我们的目的是为了向您提供更好的用户服务,包括可能为您提供定制的在线服务。
+ <h3 class="subtitle">{% trans "Site Visitors" %}</h3>
+ <p>
+ {% trans "what technical information is collected about visitors" %}
</p>
- <h3 class="subtitle">个人身份信息</h3>
- <p> 在登录使用CNProg的提问和回答功能时,我们要求使用者提供用户名、密码、电子邮件等信息。CNProg收集这类关于个人身份的信息只是为了登录系统获得使用功能的目的。我们不会向任何其他社区用户、个人或第三方透露您的密码或者电子邮件信息。用户可以选择性地填写用户资料、个人网站、年龄、城市等信息,我们收集这些内容为了使用户能够更容易和更满意地使用CNProg提供的网页和服务。
+ <h3 class="subtitle">{% trans "Personal Information" %}</h3>
+ <p>
+ {% trans "details on personal information policies" %}
</p>
- <h3 class="subtitle">其他服务</h3>
- <p> CNProg可能会收集和统计用户访问本站的概况数据。例如,CNProg可能会检测网站最流行的部分功能。CNProg可能会公开显示或者提供给第三方使用该数据。但是,CNProg不会公开您的身份信息。
+ <h3 class="subtitle">{% trans "Other Services" %}</h3>
+ <p>
+ {% trans "details on sharing data with third parties" %}
</p>
- <h3 class="subtitle">Cookie</h3>
- <p> 访问CNProg时,我们会向您的计算机发送一个或多个专门用于识别您的浏览器的Cookie(包含一个字符串的小文件)。 使用 Cookie 的目的是通过储存用户偏好、跟踪用户倾向(例如搜索方法)来提高我们的服务质量。大多数浏览器的初始设置均为接受 Cookie,但也可以将其重置为拒绝所有 Cookie 或在收到 Cookie 时提示。不过,如果禁用 Cookie,某些功能和服务可能无法正常运行。
+ <h3 class="subtitle">Cookies</h3>
+ <p>
+ {% trans "cookie policy details" %}
</p>
-
- <h3 class="subtitle">政策更改</h3>
- <p> 我们可能在事先通知或不通知的情况下随时更改此"隐私政策",我们建议用户时常查看CNProg隐私政策的改动,在任何改动生效后您的继续访问和使用本站,我们假设您已同意了CNProg以上的所有条款。
+ <h3 class="subtitle">{% trans "Policy Changes" %}</h3>
+ <p>{% trans "how privacy policies can be changed" %}
</p>
<br><br>
</div>
{% endblock %}
-
-
-
+<!-- end privacy.html -->
diff --git a/templates/question.html b/templates/question.html
index 9cbe1664..5ba08b63 100644
--- a/templates/question.html
+++ b/templates/question.html
@@ -1,13 +1,15 @@
+<!-- question.html -->
{% extends "base.html" %}{% load extra_tags %}{% load extra_filters %}{% load humanize %}
+{% load i18n %}
{% block title %}{% spaceless %}{{ question.get_question_title }}{% endspaceless %}{% endblock %}
{% block forejs %}
{% if not question.closed and request.user.is_authenticated %}
<script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown-min.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd-min.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
<link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
{% endif %}
- <script type='text/javascript' src='/content/js/com.cnprog.post.pack.js'></script>
+ <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
<script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
<script type="text/javascript">
// define reputation needs for comments
@@ -32,10 +34,10 @@
captureLength: 5, callback: lanai.highlightSyntax});
var display = true;
- var txt = "[禁用预览]";
+ var txt = "[{% trans "hide preview" %}]";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
- txt = display ? "[启用预览]" : "[禁用预览]";
+ txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
@@ -59,29 +61,39 @@
<td style="width:30px;vertical-align:top">
<div class="vote-buttons">
{% if question_vote %}
- <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote" src="/content/images/vote-arrow-up{% if question_vote.is_upvote %}-on{% endif %}.png" title="这篇帖子有价值(再次点击取消操作)" >
- <div id="question-vote-number-{{ question.id }}" class="vote-number" title="当前总票数">
+ <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
+ src="/content/images/vote-arrow-up{% if question_vote.is_upvote %}-on{% endif %}.png"
+ title="{% trans "i like this post (click again to cancel)" %}" >
+ <div id="question-vote-number-{{ question.id }}" class="vote-number"
+ title="{% trans "current number of votes" %}">
{{ question.score }}
</div>
- <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote" src="/content/images/vote-arrow-down{% if question_vote.is_downvote %}-on{% endif %}.png" title="这篇帖子没有价值(再次点击取消操作)" >
+ <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
+ src="/content/images/vote-arrow-down{% if question_vote.is_downvote %}-on{% endif %}.png"
+ title="{% trans "i dont like this post (click again to cancel)" %}" >
{% else %}
- <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote" src="/content/images/vote-arrow-up.png" title="这篇帖子有价值(再次点击取消操作)" >
- <div id="question-vote-number-{{ question.id }}" class="vote-number" title="当前总票数">
+ <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
+ src="/content/images/vote-arrow-up.png"
+ title="{% trans "i like this post (click again to cancel)" %}" >
+ <div id="question-vote-number-{{ question.id }}" class="vote-number"
+ title="{% trans "current number of votes" %}">
{{ question.score }}
</div>
- <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote" src="/content/images/vote-arrow-down.png" title="这篇帖子没有价值(再次点击取消操作)" >
+ <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
+ src="/content/images/vote-arrow-down.png" title="{% trans "i dont like this post (click again to cancel)" %}" >
{% endif %}
<br><br>
{% if favorited %}
- <img class="question-img-favorite" src="/content/images/vote-favorite-on.png" title="我要收藏这个问题(再次点击取消操作)" >
+ <img class="question-img-favorite" src="/content/images/vote-favorite-on.png"
+ title="{% trans "mark this question as favorite (click again to cancel)" %}" >
<div id="favorite-number" class="favorite-number my-favorite-number">
{{ question.favourite_count }}
</div>
{% else %}
- <img class="question-img-favorite" src="/content/images/vote-favorite-off.png" title="我要收藏这个问题(再次点击取消操作)" >
-
+ <img class="question-img-favorite" src="/content/images/vote-favorite-off.png"
+ title="{% trans "remove favorite mark from this question (click again to restore mark)" %}" >
<div id="favorite-number" class="favorite-number">{% ifnotequal question.favourite_count 0 %}{{ question.favourite_count }}{% endifnotequal %}
</div>
@@ -96,7 +108,8 @@
</div>
<div id="question-tags" class="tags" >
{% for tag in question.tagname_list %}
- <a href="{% url forum.views.tag tag|urlencode %}" class="post-tag" title="查看有关'{{ tag }}'的问题" rel="tag">{{ tag }}</a>
+ <a href="{% url forum.views.tag tag|urlencode %}" class="post-tag"
+ title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
{% endfor %}
</div>
<div id="question-controls" style="clear:both;">
@@ -105,27 +118,30 @@
<td width="210px" style="vertical-align:top">
{% if request.user|can_edit_post:question %}
- <span class="action-link"><a href="{% url edit_question question.id %}">编辑</a></span>
+ <span class="action-link"><a href="{% url edit_question question.id %}">{% trans 'edit' %}</a></span>
<span class="action-link-separator">|</span>
{% endif %}
{% if request.user|can_delete_post:question %}
- <span class="action-link"><a id="question-delete-link-{{question.id}}">删除</a></span>
+ <span class="action-link"><a id="question-delete-link-{{question.id}}">{% trans "delete" %}</a></span>
<span class="action-link-separator">|</span>
{% endif %}
{% if question.closed %}
{% if request.user|can_reopen_question:question %}
- <span class="action-link"><a href="{% url reopen question.id %}">打开</a></span>
+ <span class="action-link"><a href="{% url reopen question.id %}">{% trans "reopen" %}</a></span>
<span class="action-link-separator">|</span>
{% endif %}
{% else %}
{% if request.user|can_close_question:question %}
- <span class="action-link"><a href="{% url close question.id %}">关闭</a></span>
+ <span class="action-link"><a href="{% url close question.id %}">{% trans "close" %}</a></span>
<span class="action-link-separator">|</span>
{% endif %}
{% endif %}
- <span id="question-offensive-flag-{{ question.id }}" class="offensive-flag" title="检举该帖为垃“水帖”(含广告、人身攻击、恶意言论等)"><a>垃圾帖?</a><span class="darkred">{% if request.user|can_view_offensive_flags %}{% if question.offensive_flag_count %}({{ question.offensive_flag_count }}){% endif %}{% endif %}</span>
-
+ <span id="question-offensive-flag-{{ question.id }}" class="offensive-flag"
+ title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
+ <a>{% trans "flag offensive" %}</a>
+ <span class="darkred">{% if request.user|can_view_offensive_flags %}
+ {% if question.offensive_flag_count %}({{ question.offensive_flag_count }}){% endif %}{% endif %}</span>
</span>
</td>
@@ -135,7 +151,7 @@
<table width="200px" >
<tr>
<td colspan="2">
- 更新于<a href="{% url question_revisions question.id %}"><strong title="{{question.last_edited_at }}">{% diff_date question.last_edited_at %}</strong></a>
+ {% trans "updated" %} <a href="{% url question_revisions question.id %}"><strong title="{{question.last_edited_at }}">{% diff_date question.last_edited_at %}</strong></a>
</td>
</tr>
@@ -177,14 +193,14 @@
</td>
<td style="vertical-align:top">
{% if question.wiki %}
- <span class="wiki-category">社区Wiki</span>
+ <span class="wiki-category">{% trans "community wiki" %}</span>
<div style="margin-bottom:10px"></div>
{% else %}
<div class="question-mark">
<table width="200px">
<tr>
<td colspan="2">
- 提问于<strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>
+ {% trans "asked" %} <strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>
</td>
</tr>
@@ -213,7 +229,10 @@
<div class="post-comments" style="margin-bottom:20px">
<input id="can-post-comments-question-{{question.id}}" type="hidden" value="{{ request.user|can_add_comments }}"/>
- <a id="comments-link-question-{{question.id}}" class="comments-link">{% if question.comment_count %}评论 <strong>({{question.comment_count}})</strong>{% else %}添加评论{% endif %}</a>
+ <a id="comments-link-question-{{question.id}}" class="comments-link">
+ {% if question.comment_count %}{% trans "comments" %} <strong>({{question.comment_count}})</strong>
+ {% else %}{% trans "add comment" %}
+ {% endif %}</a>
<div id="comments-question-{{question.id}}" class="comments-container">
<div class="comments"/></div>
</div>
@@ -225,41 +244,49 @@
</table>
{% if question.closed %}
<div class="question-status" style="margin-bottom:15px">
- <h3>问题以“{{ question.get_close_reason_display }}”的原因已被 <a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a> 于{% diff_date question.closed_at %}<font class="darkred">关闭</font></h3>
+ <h3>{% blocktrans %}The question has been closed for the following reason "{{ question.get_close_reason_display }}" by{% endblocktrans %}
+ <a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a>
+ {% blocktrans %}close date {{question.closed_at}}{% endblocktrans %}</h3>
</div>
{% endif %}
{% ifnotequal question.answer_count 0 %}
<div class="tabBar">
<a name="sort-top"></a>
- <div class="headQuestions">{{ question.answer_count }}个回答:</div>
+ <div class="headQuestions">{{ question.answer_count }}{% trans "Answers" %}:</div>
<div class="tabsA">
- <a id="oldest" href="?sort=oldest#sort-top" title="最先回答显示在最前面">最先回答</a>
- <a id="latest" href="?sort=latest#sort-top" title="最晚回答显示在最前面">最近回答</a>
- <a id="votes" href="?sort=votes#sort-top" title="投票次数最多的显示在最前面">投票最多</a>
+ <a id="oldest" href="?sort=oldest#sort-top" title="{% trans "oldest answers will be shown first" %}">{% trans "oldest answers" %}</a>
+ <a id="latest" href="?sort=latest#sort-top" title="{% trans "newest answers will be shown first" %}">{% trans "newest answers" %}</a>
+ <a id="votes" href="?sort=votes#sort-top" title="{% trans "most voted answers will be shown first" %}">{% trans "popular answers" %}</a>
</div>
</div>
{% cnprog_paginator context %}
{% for answer in answers %}
<a name="{{ answer.id }}"></a>
- <div id="answer-container-{{ answer.id }}" class="answer {% if answer.accepted %}accepted-answer{% endif %}{% if answer.deleted %}deleted{% endif %} {% ifequal answer.author_id question.author_id %} answered-by-owner{% endifequal %}">
+ <div id="answer-container-{{ answer.id }}" class="answer {% if answer.accepted %}accepted-answer{% endif %} {% ifequal answer.author_id question.author_id %} answered-by-owner{% endifequal %} {% if answer.deleted %}deleted{% endif %}">
<table style="width:100%;">
<tr>
<td style="width:30px;vertical-align:top">
<div class="vote-buttons">
- <img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote" src="/content/images/vote-arrow-up{% get_user_vote_image user_answer_votes answer.id 1 %}.png" title="这篇帖子有价值(再次点击取消操作)" >
- <div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="当前总票数">
+ <img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote" src="/content/images/vote-arrow-up{% get_user_vote_image user_answer_votes answer.id 1 %}.png" title="{% trans "i like this answer (click again to cancel)" %}">
+ <div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="{% trans "current number of votes" %}">
{{ answer.score }}
</div>
- <img id="answer-img-downvote-{{ answer.id }}" class="answer-img-downvote" src="/content/images/vote-arrow-down{% get_user_vote_image user_answer_votes answer.id -1 %}.png" title="这篇帖子没有价值(再次点击取消操作)" >
+ <img id="answer-img-downvote-{{ answer.id }}" class="answer-img-downvote"
+ src="/content/images/vote-arrow-down{% get_user_vote_image user_answer_votes answer.id -1 %}.png"
+ title="{% trans "i dont like this answer (click again to cancel)" %}" >
<br><br>
{% ifequal request.user question.author %}
- <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept" src="/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png" title="最佳答案(再次点击取消操作)" >
+ <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
+ src="/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png"
+ title="{% trans "mark this answer as favorite (click again to undo)" %}" >
{% else %}
{% if answer.accepted %}
- <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept" src="/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png" title="这个答案已经被提问作者标记为最佳答案" >
+ <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
+ src="/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png"
+ title="{% trans "the author of the question has selected this answer as correct" %}" >
{% endif %}
{% endifequal %}
</div>
@@ -272,32 +299,43 @@
<div class="answer-controls" style="clear:both;">
<table width="100%">
<tr>
- <td width="210px" style="vertical-align:top">
+ <td width="400px" style="vertical-align:top">
{% if request.user|can_edit_post:answer %}
- <span class="action-link"><a href="{% url edit_answer answer.id %}">编辑</a></span>
+ <span class="action-link"><a href="{% url edit_answer answer.id %}">{% trans "edit" %}</a></span>
<span class="action-link-separator">|</span>
{% endif %}
{% if request.user|can_delete_post:answer %}
- <span class="action-link"><a id="answer-delete-link-{{answer.id}}">删除</a></span>
+ <span class="action-link">
+ <a id="answer-delete-link-{{answer.id}}">
+ {% if answer.deleted %}
+ {% trans "undelete" %}
+ {% endif %}
+ {% if not answer.deleted %}
+ {% trans "delete" %}
+ {% endif %}
+ </a>
+ </span>
<span class="action-link-separator">|</span>
{% endif %}
<span class="linksopt">
- <a href="#{{ answer.id }}" title="该回答的链接地址">
- 永久链接
+ <a href="#{{ answer.id }}" title="{% trans "answer permanent link" %}">
+ {% trans "permanent link" %}
</a>
</span>
<span class="action-link-separator">|</span>
- <span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag" title="检举该帖为垃“水帖”(含广告、人身攻击、恶意言论等)"><a>垃圾帖?</a><span class="darkred">{% if request.user|can_view_offensive_flags %}{% if answer.offensive_flag_count %}({{ answer.offensive_flag_count }}){% endif %}{% endif %}</span></span>
+ <span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag"
+ title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
+ <a>{% trans "flag offensive" %}</a>
+ <span class="darkred">{% if request.user|can_view_offensive_flags %}{% if answer.offensive_flag_count %}({{ answer.offensive_flag_count }}){% endif %}{% endif %}</span></span>
</td>
- <td width="210px" style="vertical-align:top">
+ <td width="110px" style="vertical-align:top">
{% if answer.last_edited_by %}
<div class="question-edit" >
<table width="200px" >
<tr>
<td colspan="2">
- 更新于<a href="{% url answer_revisions answer.id %}"><strong title="{{answer.last_edited_at }}">{% diff_date answer.last_edited_at %}</strong></a>
+ {% trans "updated" %}<a href="{% url answer_revisions answer.id %}"><strong title="{{answer.last_edited_at }}">{% diff_date answer.last_edited_at %}</strong></a>
</td>
-
</tr>
{% if answer.wiki %}
<tr>
@@ -336,16 +374,15 @@
</td>
<td style="vertical-align:top">
{% if answer.wiki %}
- <span class="wiki-category">社区Wiki</span>
+ <span class="wiki-category">{% trans "community wiki" %}</span>
<div style="margin-bottom:10px"></div>
{% else %}
<div class="answer-mark">
<table width="200px">
<tr>
- <td colspan="2">
- 回答于<strong title="{{answer.added_at}}">{% diff_date answer.added_at %}</strong>
+ <td colspan="2">
+ {% trans "asked" %} <strong title="{{answer.added_at}}">{% diff_date answer.added_at %}</strong>
</td>
-
</tr>
<tr>
<td width="40px" style="vertical-align:bottom">
@@ -370,7 +407,9 @@
</div>
<div id="comment-{{ answer.id }}" class="post-comments" >
<input id="can-post-comments-answer-{{answer.id}}" type="hidden" value="{{ request.user|can_add_comments }}"/>
- <a id="comments-link-answer-{{answer.id}}" class="comments-link">{% if answer.comment_count %}评论 <strong>({{answer.comment_count}})</strong>{% else %}添加评论{% endif %}</a>
+ <a id="comments-link-answer-{{answer.id}}" class="comments-link">
+ {% if answer.comment_count %}{% trans "comments" %}
+ <strong>({{answer.comment_count}})</strong>{% else %}{% trans "add comment" %}{% endif %}</a>
<div id="comments-answer-{{answer.id}}" class="comments-container">
<div class="comments"/></div>
</div>
@@ -394,7 +433,7 @@
{% if not question.closed %}
{% if request.user.is_authenticated %}
<div style="padding:10px 0 0 0;">
- <div class="headNormal">您的回答:</div>
+ <div class="headNormal">{% trans "Your answer" %}:</div>
</div>
<div id="description" class="" >
@@ -404,7 +443,8 @@
<table width="100%">
<tr>
<td>
- <span id="pre-collapse" title="打开或者关闭Markdown编辑器的实时预览">预览开关</span>
+ <span id="pre-collapse"
+ title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
</td>
<td style="text-align:right;">
{{ answer.wiki }} <span style="font-weight:normal;cursor:help" title="{{answer.wiki.help_text}}">{{ answer.wiki.label_tag }} </span>
@@ -415,12 +455,11 @@
</div>
<div id="previewer" class="wmd-preview"></div>
{{ answer.text.errors }}
-
</div>
<br>
- <input type="submit" value="回答该问题" class="submit"><span class="form-error"></span>
+ <input type="submit" value="{% trans "Answer the question" %}" class="submit"><span class="form-error"></span>
{% else %}
- <input id="btLogin" type="button" class="submit" style="width:200px" value="登录并回答该问题">
+ <input id="btLogin" type="button" class="submit" style="width:200px" value="{% trans "Login to answer" %}">
{% endif %}
{% endif %}
<br><br>
@@ -432,26 +471,28 @@
{% block sidebar %}
<div class="boxC">
<p>
- 您正在浏览的问题含有以下标签:
+ {% trans "Question tags" %}:
</p>
<p class="tags" >
{% for tag in tags %}
- <a href="{% url forum.views.tag tag.name|urlencode %}" title="查看有关'{{ tag.name }}'的问题" rel="tag">{{ tag.name }}</a> <span class="tag-number">× {{ tag.used_count|intcomma }}</span><br>
+ <a href="{% url forum.views.tag tag.name|urlencode %}"
+ title="{% trans "see questions tagged"%}'{{tag.name}}'{% trans "using tags" %}"
+ rel="tag">{{ tag.name }}</a> <span class="tag-number">× {{ tag.used_count|intcomma }}</span><br>
{% endfor %}
</p>
<p>
- 提问时间: <br><strong title="{{ question.added_at }}">{{ question.added_at|timesince }}前</strong>
+ {% trans "question asked" %}: <strong title="{{ question.added_at }}">{{ question.added_at|timesince }} {% trans "ago" %}</strong>
</p>
<p>
- 目前浏览数量:<br><strong>{{ question.view_count|intcomma }} 次</strong>
+ {% trans "question was seen" %}: <strong>{{ question.view_count|intcomma }} {% trans "times" %}</strong>
</p>
<p>
- 最后更新时间:<br><strong title="{{ question.last_activity_at }}">{{ question.last_activity_at|timesince }}前</strong>
+ {% trans "last updated" %}: <strong title="{{ question.last_activity_at }}">{{ question.last_activity_at|timesince }} {% trans "ago" %}</strong>
</p>
</div>
<div class="boxC">
- <h3 class="subtitle">相似的问题</h3>
+ <h3 class="subtitle">{% trans "Related questions" %}</h3>
<div class="questions-related">
{% for question in similar_questions %}
<p>
@@ -466,4 +507,4 @@
{% block endjs %}
{% endblock %}
-
+<!-- end question.html -->
diff --git a/templates/question_edit.html b/templates/question_edit.html
index 2cec358f..6fe8bb41 100644
--- a/templates/question_edit.html
+++ b/templates/question_edit.html
@@ -1,14 +1,16 @@
+<!-- question_edit.html -->
{% extends "base.html" %}
-{% block title %}{% spaceless %}修改问题{% endspaceless %}{% endblock %}
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Edit question" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
<script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
<script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
- <script type='text/javascript' src='/content/js/wmd/showdown-min.js'></script>
- <script type='text/javascript' src='/content/js/wmd/wmd-min.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/showdown.js'></script>
+ <script type='text/javascript' src='/content/js/wmd/wmd.js'></script>
<link rel="stylesheet" type="text/css" href="/content/js/wmd/wmd.css" />
<script type="text/javascript">
-
+ //todo move javascript out
$().ready(function(){
$("#nav_questions").attr('className',"on");
$('#editor').TextAreaResizer();
@@ -19,10 +21,10 @@
//toggle preview of editor
var display = true;
- var txt = "禁用预览";
+ var txt = "[{% trans "hide preview"}%]";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
- txt = display ? "启用预览" : "禁用预览";
+ txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
@@ -60,15 +62,16 @@
{% block content %}
<div id="main-bar" class="headNormal">
- 修改问题 [<a href="{{ question.get_absolute_url }}">返回</a>]
+ {% trans "Edit question" %} [<a href="{{ question.get_absolute_url }}">{% trans "back" %}</a>]
</div>
<div id="main-body" class="ask-body">
<div id="askform">
<form id="fmedit" action="{% url edit_question question.id %}" method="post" >
- <label for="id_revision" ><strong>版本:</strong></label> <br>
+ <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br>
{% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
<div style="vertical-align:middle">
- {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="选择版本">
+ {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision"
+ value="{% trans "select revision"%}">
</div><br>
<div class="form-item">
<label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br>
@@ -85,7 +88,7 @@
<table width="100%">
<tr>
<td>
- <span id="pre-collapse" title="打开或者关闭Markdown编辑器的实时预览">预览开关</span>
+ <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
</td>
<td style="text-align:right;">
{{ form.wiki }} <span style="color:#000;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
@@ -113,8 +116,8 @@
<br>
<div class="error" ></div>
- <input type="submit" value="现在修改" class="submit" />
- <input type="button" value="取消" class="submit" onclick="history.back(-1);" />
+ <input type="submit" value="{% trans "Save edit" %}" class="submit" />
+ <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
<br>
<br>
</form>
@@ -123,63 +126,9 @@
{% endblock %}
{% block sidebar %}
-<div class="boxC">
- <p class="subtitle darkred">受欢迎的提问</p>
- <div>
- <ul class="list-item">
- <li>
- <b>您的问题与编程相关吗?</b>
- </li>
- <li>
- 建议您提的问题是可以被答复的,而不仅仅是可以讨论。
- </li>
- <li>
- 请详细描述您的问题。
- </li>
- <li>
- 我们推荐您使用中文描述问题,这样可以得到更多的答复机会。
- </li>
- </ul>
- <a href="/faq/" target="_blank" title="查看常见问题" style="float:right;position:relative">faq »</a>
- <br>
- </div>
-</div>
-
-<div class="boxC">
- <p class="subtitle">Markdown快速参考</p>
- <ul class="list-item">
- <li>
- *斜体* 或者 _斜体_
-
- </li>
- <li>
- **加粗** 或者 __加粗__
-
- </li>
- <li>
- <b>链接</b>:一个[例子](http://url.com/ "标题")
-
- </li>
-
- <li>
- <b>图片</b>:![alt 文本](/path/img.jpg "标题")
-
- </li>
- <li>
- 列表:
- 1. Foo
- 2. Bar
- </li>
- <li>
- 基本的HTML标签也是支持的
- </li>
- </ul>
- <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank" style="float:right;position:relative">有关Markdown详细说明 »</a>
- <br>
-</div>
-
+{% include "question_edit_tips.html" %}
{% endblock %}
{% block endjs %}
{% endblock %}
-
+<!-- end question_edit.html -->
diff --git a/templates/question_edit_tips.html b/templates/question_edit_tips.html
new file mode 100644
index 00000000..4ac666a6
--- /dev/null
+++ b/templates/question_edit_tips.html
@@ -0,0 +1,51 @@
+<!-- question_edit_tips.html -->
+{% load i18n %}
+<div class="boxC">
+ <p class="subtitle darkred">{% trans "question tips" %}</p>
+ <div>
+ <ul class="list-item">
+ <li> <b>{% trans "please ask a relevant question" %}</b>
+ </li>
+ <li>
+ {% trans "please try provide enough details" %}
+ </li>
+ <li>
+ {% trans "be clear and concise" %}
+ </li>
+ </ul>
+ <a href="/faq/" target="_blank" title="{% trans "see frequently asked questions" %}" style="float:right;position:relative">faq »</a>
+ <br>
+ </div>
+</div>
+
+<div class="boxC">
+ <p class="subtitle">{% trans "Markdown tips" %}</p>
+ <ul class="list-item">
+ <li>
+ {% trans "*italic* or __italic__" %}
+ </li>
+ <li>
+ {% trans "**bold** or __bold__" %}
+ </li>
+ <li>
+ <b>{% trans "link" %}</b>:[{% trans "text" %}](http://url.com/ "{% trans "title" %}")
+
+ </li>
+
+ <li>
+ <b>{% trans "image" %}</b>:![alt {% trans "text" %}](/path/img.jpg "{% trans "title" %}")
+
+ </li>
+ <li>
+ {% trans "numbered list:" %}
+ 1. Foo
+ 2. Bar
+ </li>
+ <li>
+ {% trans "basic HTML tags are also supported" %}
+ </li>
+ </ul>
+ <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank" style="float:right;position:relative">{% trans "learn more about Markdown" %} »</a>
+ <br>
+</div>
+<!-- end question_edit_tips.html -->
diff --git a/templates/questions.html b/templates/questions.html
index 6663dbf2..21ac18ce 100644
--- a/templates/questions.html
+++ b/templates/questions.html
@@ -1,8 +1,10 @@
+<!-- questions.html -->
{% extends "base.html" %}
{% load extra_tags %}
+{% load i18n %}
{% load humanize %}
{% load extra_filters %}
-{% block title %}{% spaceless %}问题列表{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Questions" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -18,12 +20,12 @@
{% endblock %}
{% block content %}
<div class="tabBar">
- <div class="headQuestions">{% if searchtag %}标签问题{% else %}{% if searchtitle %}查询结果{% else %}所有问题{% endif %}{% endif %}</div>
+ <div class="headQuestions">{% if searchtag %}{% trans "Found by tags" %}{% else %}{% if searchtitle %}{% trans "Found by title" %}{% else %}{% trans "All questions" %}{% endif %}{% endif %}</div>
<div class="tabsA">
- <a id="latest" href="?sort=latest" class="off" title="最新加入系统的问题">最新问题</a>
- <a id="active" href="?sort=active" class="off" title="最近被更新的问题">活跃问题</a>
- <a id="hottest" href="?sort=hottest" class="off" title="被回复最多的问题">热门问题</a>
- <a id="mostvoted" href="?sort=mostvoted" class="off" title="投票次数最多的问题">最有价值问题</a>
+ <a id="latest" href="?sort=latest" class="off" title="{% trans "most recently asked questions" %}">{% trans "newest" %}</a>
+ <a id="active" href="?sort=active" class="off" title="{% trans "most recently updated questions" %}">{% trans "active" %}</a>
+ <a id="hottest" href="?sort=hottest" class="off" title="{% trans "hottest questions" %}">{% trans "hottest" %}</a>
+ <a id="mostvoted" href="?sort=mostvoted" class="off" title="{% trans "most voted questions" %}">{% trans "most voted" %}</a>
</div>
</div>
<div id="listA">
@@ -40,9 +42,9 @@
<td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
</tr>
<tr>
- <td><span class="unit">回答</span></td>
- <td><span class="unit">票数</span></td>
- <td><span class="unit">浏览</span></td>
+ <td><span class="unit">{% trans "answers" %}</span></td>
+ <td><span class="unit">{% trans "votes" %}</span></td>
+ <td><span class="unit">{% trans "views" %}</span></td>
</tr>
</table>
</div>
@@ -53,7 +55,7 @@
{% ifequal tab_id 'active'%}
{% if question.wiki %}
- <span class="from wiki">社区Wiki</span>
+ <span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
@@ -65,7 +67,7 @@
{% endif %}
{% else %}
{% if question.wiki %}
- <span class="from wiki">社区Wiki</span>
+ <span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
@@ -79,7 +81,7 @@
<div class="tags">
{% for tag in question.tagname_list %}
- <a href="{% url forum.views.tag tag|urlencode %}" title="查看有关'{{ tag }}'的问题" rel="tag">{{ tag }}</a>
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
{% endfor %}
</div>
</div>
@@ -103,45 +105,48 @@
{% block sidebar %}
<div class="boxC">
<p>
- 您正在浏览所有<br><div class="questions-count">{{ questions_count|intcomma }}</div>
- <p>个
- {% if searchtag %}
- 标记为
- <span class="tag">
- {{ searchtag }}
- </span>
- {% endif %}
- {% if searchtitle %}
- 标题含有
- <strong class="darkred">
- {{ searchtitle }}
- </strong>
- {% endif %}
- 的问题。</p>
+ {% if searchtag %}
+ {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num and searchtag as tagname %}
+ have total {{q_num}} questions tagged {{tagname}}
+ {% plural %}
+ have total {{q_num}} questions tagged {{tagname}}
+ {% endblocktrans %}
+ {% endif %}
+ {% if searchtitle %}
+ {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %}
+ have total {{q_num}} questions containing {{searchtitle}}
+ {% plural %}
+ have total {{q_num}} questions containing {{searchtitle}}
+ {% endblocktrans %}
+ {% endif %}
+
{% ifequal tab_id "latest" %}
- <p>问题按<strong>提问时间</strong>显示排序。新加入的问题将显示在最前面。</p>
+ <p>{% trans "latest questions info" %}</p>
{% endifequal %}
{% ifequal tab_id "active" %}
- <p>问题按<strong>最后更新时间</strong>显示排序。最后被回答或者更新的问题将显示在最前面。</p>
+ <p>{% trans "Questions are sorted by the <strong>time of last update</strong>." %}
+ {% trans "Most recently answered ones are shown first." %}</p>
{% endifequal %}
{% ifequal tab_id "hottest" %}
- <p>问题按<strong>回复数量</strong>显示排序。回复最多的问题将显示在最前面。</p>
+ <p>{% trans "Questions sorted by <strong>number of responses</strong>." %}
+ {% trans "Most answered questions are shown first." %}</p>
{% endifequal %}
{% ifequal tab_id "mostvoted" %}
- <p>问题按<strong>投票数量</strong>显示排序。投票最多的问题将显示在最前面。</p>
+ <p>{% trans "Questions are sorted by the <strong>number of votes</strong>." %}
+ {% trans "Most voted questions are shown first." %}</p>
{% endifequal %}
</p>
</div>
<div class="boxC">
- <h3 class="subtitle">相关标签</h3>
+ <h3 class="subtitle">{% trans "Related tags" %}</h3>
<div class="tags">
{% for tag in tags %}
- <a rel="tag" title="查看有关'{{ tag.name }}'的问题" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
+ <a rel="tag" title="{% trans "see questions tagged" %}'{{ tag.name }}'{% trans "using tags" %}" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
<span class="tag-number">× {{ tag.used_count|intcomma }}</span>
<br>
{% endfor %}
@@ -150,4 +155,4 @@
</div>
{% endblock %}
-
+<!-- end questions.html -->
diff --git a/templates/reopen.html b/templates/reopen.html
index 9d87c3a6..7ab59421 100644
--- a/templates/reopen.html
+++ b/templates/reopen.html
@@ -1,7 +1,9 @@
+<!-- reopen.html -->
{% extends "base_content.html" %}
{% load extra_tags %}
+{% load i18n %}
{% load humanize %}
-{% block title %}{% spaceless %}重设问题{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Reopen question" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -11,21 +13,21 @@
{% endblock %}
{% block content %}
<div id="main-bar" class="headNormal">
- 重设问题
+ {% trans "Reopen question" %}
</div>
<div id="main-body" style="width:100%">
- <p>你将打开这个已经被关闭的问题: <a href="{{ question.get_absolute_url }}"><span class="big">{{ question.get_question_title }}</span></a>
+ <p>{% trans "Open the previously closed question" %}: <a href="{{ question.get_absolute_url }}"><span class="big">{{ question.get_question_title }}</span></a>
</p>
- <p><strong>问题曾以“{{ question.get_close_reason_display }}”的原因被 <a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a> 于{% diff_date question.closed_at %}<font class="darkred">关闭</font>
+ <p><strong>{% trans "The question was closed for the following reason " %}"{{ question.get_close_reason_display }}"{% trans "reason - leave blank in english" %} <a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a> {% trans "on "%} {% diff_date question.closed_at %}<font class="darkred">{% trans "date closed" %}</font>
</strong>
</p>
<form id="fmclose" action="{% url reopen question.id %}" method="post" >
<div id="" style="padding:20px 0 20px 0">
- <input type="submit" value="确定打开这个问题" class="submit" />
- <input id="btBack" type="button" value="取消" class="submit" />
+ <input type="submit" value="{% trans "Reopen this question" %}" class="submit" />
+ <input id="btBack" type="button" value="{% trans "Cancel" %}" class="submit" />
</div>
@@ -35,3 +37,4 @@
+<!-- end reopen.html -->
diff --git a/templates/revisions_answer.html b/templates/revisions_answer.html
index ece59d6e..5ab12fbf 100644
--- a/templates/revisions_answer.html
+++ b/templates/revisions_answer.html
@@ -1,13 +1,15 @@
+<!-- revisions_answer.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load extra_filters %}
{% load humanize %}
-{% block title %}{% spaceless %}版本历史{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Revision history" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
<script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
<script type="text/javascript">
-
+ //todo - take this out into .js file
$().ready(function(){
$("#nav_questions").attr('className',"on");
$('div.revision div[id^=rev-header-]').bind('click', function(){
@@ -31,7 +33,7 @@
{% block content %}
<div id="main-bar" class="headNormal">
- 版本历史 [<a href="{{ post.get_absolute_url }}">返回</a>]
+ {% trans "Revision history" %} [<a href="{{ post.get_absolute_url }}">{% trans "back" %}</a>]
</div>
<div id="main-body" class="">
<div id="revisions">
@@ -42,13 +44,13 @@
<table width="100%">
<tr>
<td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}" src="/content/images/expander-arrow-show.gif"></td>
- <td width="30px" style="vertical-align:middle"><span class="revision-number" title="版本 {{ revision.revision }}">{{ revision.revision }}</span></td>
+ <td width="30px" style="vertical-align:middle"><span class="revision-number" title="{% trans "revision" %} {{ revision.revision }}">{{ revision.revision }}</span></td>
<td width="200px" style="vertical-align:middle">
{% if revision.summary %}
<div class="summary"><span>{{ revision.summary }}<span></div>
{% endif %}
{% if request.user|can_edit_post:post %}
- <a href="{% url edit_answer post.id %}?revision={{ revision.revision }}">编辑</a>
+ <a href="{% url edit_answer post.id %}?revision={{ revision.revision }}">{% trans "edit" %}</a>
{% endif %}
</td>
@@ -58,9 +60,9 @@
<tr >
<td colspan="2" style="padding:3px 0 3px 0">
{% ifequal revision.revision 1 %}
- 提问于<strong title="{{ post.added_at }}">{% diff_date post.added_at %}</strong>
+ {% trans "asked" %} <strong title="{{ post.added_at }}">{% diff_date post.added_at %}</strong>
{% else %}
- 更新于<strong title="{{ post.last_edited_at }}">{% diff_date revision.revised_at %}</strong>
+ {% trans "updated" %} <strong title="{{ post.last_edited_at }}">{% diff_date revision.revised_at %}</strong>
{% endifequal %}
</td>
@@ -97,4 +99,4 @@
{% block endjs %}
{% endblock %}
-
+<!-- end revisions_answer.html -->
diff --git a/templates/revisions_question.html b/templates/revisions_question.html
index 94fb2644..77a421bb 100644
--- a/templates/revisions_question.html
+++ b/templates/revisions_question.html
@@ -1,13 +1,16 @@
+<!-- revisions_question.html -->
{% extends "base_content.html" %}
+<!--somehow very similar to revisions_answer.html-->
{% load extra_tags %}
+{% load i18n %}
{% load extra_filters %}
{% load humanize %}
-{% block title %}{% spaceless %}版本历史{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Revision history" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
<script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
<script type="text/javascript">
-
+ //todo - take this out into .js file
$().ready(function(){
$("#nav_questions").attr('className',"on");
$('div.revision div[id^=rev-header-]').bind('click', function(){
@@ -15,8 +18,6 @@
toggleRev(revId);
});
-
-
lanai.highlightSyntax();
});
@@ -27,13 +28,12 @@
arrow.attr("src", "/content/images/expander-arrow-" + (visible ? "show" : "hide") + ".gif");
$("#rev-body-" + id).slideToggle("fast");
}
-
</script>
{% endblock %}
{% block content %}
<div id="main-bar" class="headNormal">
- 版本历史 [<a href="{{ post.get_absolute_url }}">返回</a>]
+ {% trans "Revision history" %}[<a href="{{ post.get_absolute_url }}">{% trans "back" %}</a>]
</div>
<div id="main-body" class="">
<div id="revisions">
@@ -44,13 +44,13 @@
<table width="100%">
<tr>
<td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}" src="/content/images/expander-arrow-show.gif"></td>
- <td width="30px" style="vertical-align:middle"><span class="revision-number" title="版本 {{ revision.revision }}">{{ revision.revision }}</span></td>
+ <td width="30px" style="vertical-align:middle"><span class="revision-number" title="{% trans "revision" %} {{ revision.revision }}">{{ revision.revision }}</span></td>
<td width="200px" style="vertical-align:middle">
{% if revision.summary %}
<div class="summary"><span>{{ revision.summary }}<span></div>
{% endif %}
{% if request.user|can_edit_post:post %}
- <a href="{% url edit_question post.id %}?revision={{ revision.revision }}">编辑</a>
+ <a href="{% url edit_question post.id %}?revision={{ revision.revision }}">{% trans "edit" %}</a>
{% endif %}
</td>
@@ -60,9 +60,9 @@
<tr >
<td colspan="2" style="padding:3px 0 3px 0">
{% ifequal revision.revision 1 %}
- 提问于<strong title="{{ post.added_at }}">{% diff_date post.added_at %}</strong>
+ {% trans "asked" %}<strong title="{{ post.added_at }}">{% diff_date post.added_at %}</strong>
{% else %}
- 更新于<strong title="{{ post.last_edited_at }}">{% diff_date revision.revised_at %}</strong>
+ {% trans "updated" %}<strong title="{{ post.last_edited_at }}">{% diff_date revision.revised_at %}</strong>
{% endifequal %}
</td>
@@ -100,3 +100,4 @@
{% block endjs %}
{% endblock %}
+<!-- end revisions_question.html -->
diff --git a/templates/tags.html b/templates/tags.html
index 0d2a972e..cb499eed 100644
--- a/templates/tags.html
+++ b/templates/tags.html
@@ -1,7 +1,9 @@
+<!-- tags.html -->
{% extends "base_content.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load humanize %}
-{% block title %}{% spaceless %}标签列表{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Tag list" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -24,25 +26,25 @@
{% block content %}
<!-- Tabs -->
<div class="tabBar">
- <div class="headQuestions">标签列表</div>
+ <div class="headQuestions">{% trans "Tag list" %}</div>
<div class="tabsA">
- <a id="sort_name" href="/tags/?sort=name" class="off" title="按名称的字母先后顺序排序">按名称排序</a>
- <a id="sort_used" href="/tags/?sort=used" class="off" title="按标签被使用的次数排序">按流行程度排序</a>
+ <a id="sort_name" href="/tags/?sort=name" class="off" title="{% trans "sorted alphabetically" %}">{% trans "by name" %}</a>
+ <a id="sort_used" href="/tags/?sort=used" class="off" title="{% trans "sorted by frequency of tag use" %}">{% trans "by popularity" %}</a>
</div>
</div>
<div id="searchtags">
<p>
{% if stag %}
- 匹配查询 '<span class="darkred"><strong>{{ stag }}</strong></span>' 的所有标签:
+ {% trans "All tags matching query" %} '<span class="darkred"><strong>{{ stag }}</strong></span>' {% trans "all tags - make this empty in english" %}:
{% endif %}
{% if not tags.object_list %}
- <span >没有找到相关数据。</span>
+ <span>{% trans "Nothing found" %}</span>
{% endif %}
</p>
<ul class="tagsList tags">
{% for tag in tags.object_list %}
<li>
- <a href="{% url forum.views.tag tag|urlencode %}" title="查看有关'{{ tag }}'的问题" rel="tag">
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">
{{ tag }}
</a>&nbsp;
<span class="tag-number">× {{ tag.used_count|intcomma }}</span>
@@ -58,4 +60,5 @@
<div class="pager">
{% cnprog_paginator context %}
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}
+<!-- end tags.html -->
diff --git a/templates/template.list b/templates/template.list
new file mode 100644
index 00000000..d4d4ec2d
--- /dev/null
+++ b/templates/template.list
@@ -0,0 +1,18 @@
+close.html
+book.html
+base_content.html
+badges.html
+badge.html
+ask.html
+answer_edit_tips.html
+answer_edit.html
+about.html
+500.html
+404.html
+pagesize.html
+logout.html
+header.html
+footer.html
+faq.html
+base.html
+question.html
diff --git a/templates/tough/faq.html b/templates/tough/faq.html
new file mode 100644
index 00000000..9b43a9ca
--- /dev/null
+++ b/templates/tough/faq.html
@@ -0,0 +1,110 @@
+{% extends "base_content.html" %}
+{% load extra_tags %}
+{% load humanize %}
+{% block title %}{% spaceless %}FAQ{% endspaceless %}{% endblock %}
+{% block forejs %}
+{% endblock %}
+{% block content %}
+<div class="headNormal">
+ {% trans "Frequently Asked Questions " %}(FAQ)
+</div>
+<div id="main-body" style="width:100%">
+
+ <h3 class="subtitle">{% trans "What kinds of questions can I ask here?" %}</h3>
+ <p>{% trans "Most importanly - questions should be <strong>relevant</strong> to this community." %}<br>
+ {% trans "Before asking the question - please make sure to use search to see whether your question has alredy been answered."%}<br>
+ </p><br>
+
+ <h3 class="subtitle">{% trans "What questions should I avoid asking?" %}</h3>
+ <p>{% trans "Please avoid asking questions that are not relevant to this community, too subjective and argumentative." %}</p>
+ </p><br>
+
+ <h3 class="subtitle">{% trans "What should I avoid in my answers?" %}</h3>
+ <p>{% trans "site title" %} {% trans "is a Q&A site, not a discussion group. Therefore - please avoid having discussions in your answers, comment facility allows some space for brief discussions." %}
+ </p><br>
+
+ <h3 class="subtitle">{% trans "Who moderates this community?" %}</h3>
+ <p>{% trans "The short answer is: <strong>you</strong>." %}<br>
+ {% trans "This website is moderated by the users." %}
+ {% trans "The reputation system allows users earn the authorization to perform a variety of moderation tasks." %}
+ </p><br>
+
+ <h3 class="subtitle">{% trans "How does reputation system work?" %}</h3>
+ <p>{% trans "Anyone can ask questions and give answers, points are not necessary for that." %}<br>
+ {% trans "As we've said before, users help running this site. Point system helps select users who can administer this community."%}
+ {% trans "Reputation points roughly measure how community trusts you. These points are given to you directly by other members of the community." %}
+ </p>
+ <p>
+ {% trans "For example, if you ask an interesting question or give a helpful answer, your input will be upvoted and you will gain more trust in the community." %}
+ {% trans "If on the other hand someone gives a misleading answer, the answer will be voted down and he/she loses some points." %}
+ {% trans "Each vote in favor will generate <strong>10</strong> points, each vote against will subtract <strong>2</strong> points." trans %}
+ {% trans "Through the votes of other people you can accumulate a maximum of <strong>200</strong> points." %}
+ {% "After accumulating certain number of points, you can do more:" %}
+ <table style="font-family:arial;" cellspacing="3" cellpadding="3">
+ <tr>
+ <th width="40px" style="text-align:right"></th>
+ <th width="300px"></th>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>15</strong></td>
+ <td>{% trans "upvote" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>15</strong></td>
+ <td>{% trans "use tags" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>50</strong></td>
+ <td>{% trans "add comments" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>100</strong></td>
+ <td>{% trans "downvote" %}</td>
+ </tr><tr>
+ <td style="text-align:right;padding-right:5px"><strong>250</strong></td>
+ <td>打开关闭自己的问题</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>500</strong></td>
+ <td>{% trans "retag questions" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>750</strong></td>
+ <td>{% trans "edit community wiki questions" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>2000</strong></td>
+ <td>{% trans "edit any answer" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>3000</strong></td>
+ <td>{% trans "open any closed question" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>5000</strong></td>
+ <td>{% trans "delete any comment" %}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;padding-right:5px"><strong>10000</strong></td>
+ <td>{% trans "delete any questions and answers and perform other moderation tasks" %}</td>
+ </tr>
+
+ </table>
+
+ </p><br>
+
+ <h3 class="subtitle">{% trans "To register, do I need to create new password?"</h3>
+ <p>{% trans "No, you don't have to. You can login through any service that supports OpenID, e.g. Google, Yahoo, AOL, etc." %}
+ <strong><a href="/account/signin">{% trans "Login now!" %}</a> »</strong>
+ </p><br>
+
+ <h3 class="subtitle">{% trans "Why other people can edit my questions/answers?" %}</h3>
+ <p> {% trans "Goal of this site is..." %} {% trans "So questions and answers can be edited like wiki pages by experienced users of this site and this improves the overall quality of the knowledge base content." %}
+ {% trans "If this approach is not for you, we respect your choice." %}
+ </p><br>
+ <h3 class="subtitle">{% trans "Still have questions?" %}</h3>
+ <p>{% "Please ask your question, help make our community better!" %} <a href="/tags/faq" class="big">{% trans "site title" %} {% trans "questions" %}</a>{% trans "." %}
+ </p>
+ <br><br>
+</div>
+{% endblock %}
diff --git a/templates/tough/question_retag.html b/templates/tough/question_retag.html
new file mode 100644
index 00000000..105428f4
--- /dev/null
+++ b/templates/tough/question_retag.html
@@ -0,0 +1,107 @@
+{% extends "base.html" %}
+{% block title %}{% spaceless %}{% trans "Revise tags" %}{% endspaceless %}{% endblock %}
+{% block forejs %}
+ <script type='text/javascript' src='/content/js/com.cnprog.editor.js'></script>
+ <script type='text/javascript' src='/content/js/com.cnprog.post.js'></script>
+ <script type='text/javascript' src='/content/js/jquery.validate.pack.js'></script>
+ <script type="text/javascript">
+
+ $().ready(function(){
+ $("#nav_questions").attr('className',"on");
+ //Tags autocomplete action
+ var tags = {{ tags|safe }};
+ $("#id_tags").autocomplete(tags, {
+ minChars: 1,
+ matchContains: true,
+ max: 20,
+ multiple: true,
+ multipleSeparator: " ",
+ formatItem: function(row, i, max) {
+ return row.n + " ("+ row.c +")";
+ },
+ formatResult: function(row, i, max){
+ return row.n;
+ }
+
+ });
+
+ $("#fmretag").validate({
+ rules: {
+ tags: {
+ required: true,
+ maxength: 105
+ }
+ },
+ messages: {
+ tags: {
+ required: ' ' + {% trans "tags are requried" %},
+ maxlength: ' ' + {% trans "up to 5 tags, less than 20 characters each" %},
+ }
+ }
+
+ });
+ lanai.highlightSyntax();
+
+ });
+ </script>
+{% endblock %}
+
+{% block content %}
+<div id="main-bar" class="headNormal">
+ {% trans "Change tags" %} [<a href="{{ question.get_absolute_url }}">{% trans "back" %}</a>]
+</div>
+<div id="main-body" class="ask-body">
+ <div id="askform">
+ <form id="fmretag" action="{% url edit_question question.id %}" method="post" >
+ <h3>
+ {{ question.get_question_title }}
+ </h3>
+ <div id="description" class="edit-content-html">
+ {{ question.html|safe }}
+ </div>
+
+
+ <div class="form-item">
+ <strong>{{ form.tags.label_tag }}:</strong> <span class="form-error"></span><br>
+ {{ form.tags }} {{ form.tags.errors }}
+ <div class="title-desc">
+ {{ form.tags.help_text }}
+ </div>
+ </div>
+ <br>
+
+ <div class="error" ></div>
+ <input type="submit" value="{% trans "Change now" %}" class="submit" />
+ <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
+ <br>
+ <br>
+ </form>
+ </div>
+</div>
+{% endblock %}
+
+{% block sidebar %}
+<div class="boxC">
+ <p class="subtitle">{% trans "Why use and modify tags?" %}</p>
+ <ul class="list-item">
+
+ <li>
+ {% trans "site title" %} {% trans "uses tags for the classification of questions %}
+ </li>
+ <li>
+ 修改完整问题需要用户的积分达到一定条件(比如:积分 >= 3000分,自己发布的问题除外),而用户积分达到比较低的时候,就可以修改问题的标签(比如:积分 >= 500, 这里指所有问题的标签)。
+
+ </li>
+ <li>
+ {% trans "tag editors receive special awards from the community" %}
+ </li>
+ </ul>
+ <a href="{% url faq %}" style="float:right;position:relative">faq »</a>
+ <br>
+</div>
+
+{% endblock %}
+
+{% block endjs %}
+{% endblock %}
+
diff --git a/templates/tough/unanswered.html b/templates/tough/unanswered.html
new file mode 100644
index 00000000..94e778db
--- /dev/null
+++ b/templates/tough/unanswered.html
@@ -0,0 +1,115 @@
+{% extends "base.html" %}
+{% load extra_tags %}
+{% load humanize %}
+{% load extra_filters %}
+{% block title %}{% spaceless %}{% trans "Unanswered questions" %}{% endspaceless %}{% endblock %}
+{% block forejs %}
+ <script type="text/javascript">
+ $().ready(function(){
+ $("#nav_unanswered").attr('className',"on");
+ });
+
+ </script>
+{% endblock %}
+{% block content %}
+<div class="tabBar">
+ <span class="headQuestions">{% trans "Unanswered questions" %}</span>
+ <div class="tabsA">
+ <a id="latest" href="?sort=latest" class="on" title="{% trans "most recently asked questions" %}>{% trans "newest" %}</a>
+ </div>
+</div>
+
+<div id="listA">
+ {% for question in questions.object_list %}
+ <div class="qstA">
+ <h2><a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a></h2>
+ <div class="stat">
+ <table>
+ <tr>
+ <td><span class="num">{{ question.answer_count|intcomma }}</span> </td>
+ <td><span class="num">{{ question.score|intcomma }}</span> </td>
+ <td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
+ </tr>
+ <tr>
+ <td><span class="unit">{% trans "answers" %}</span></td>
+ <td><span class="unit">{% trans "votes" %}</span></td>
+ <td><span class="unit">{% trans "views" %}</span></td>
+ </tr>
+ </table>
+ </div>
+ <div class="summary">
+ {{ question.summary }}...
+ </div>
+
+ {% ifequal tab_id 'active'%}
+ {% if question.wiki %}
+ <span class="from wiki">{% trans "community wiki" %}</span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% else %}
+ <div class="from">
+ {% comment %}{% gravatar question.last_activity_by 24 %}{% endcomment %}
+ <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span>
+ <span class="score">{% get_score_badge question.last_activity_by %} </span>
+ <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span>
+ </div>
+ {% endif %}
+ {% else %}
+ {% if question.wiki %}
+ <span class="from wiki">{% trans "community wiki" %}</span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ {% else %}
+ <div class="from">
+ {% comment %}{% gravatar question.author 24 %}{% endcomment %}
+ <span class="author"><a href="{{ question.author.get_profile_url }}">{{ question.author }}</a></span>
+ <span class="score">{% get_score_badge question.author %} </span>
+ <span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
+ </div>
+ {% endif %}
+ {% endifequal %}
+
+ <div class="tags">
+ {% for tag in question.tagname_list %}
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}" rel="tag">{{ tag }}</a>
+ {% endfor %}
+ </div>
+ </div>
+ {% endfor %}
+</div>
+{% endblock %}
+
+{% block tail %}
+ <div class="pager">
+ {% cnprog_paginator context %}
+
+ </div>
+ <div class="pagesize">
+ {% cnprog_pagesize context %}
+ </div>
+{% endblock %}
+
+{% block sidebar %}
+<div class="boxC">
+ <p>
+ <!--todo: move this to blocktrans -->
+ {% tans "Have a total of" %}<br><div class="questions-count">{{ questions_count|intcomma }}</div>
+ <p>{% trans "number of <strong>unanswered</strong> questions" %}</p>
+ <p>问题按 <strong>问题创建时间</strong> 排序。最新加入的问题将显示在最前面。</p>
+
+ </p>
+</div>
+<div class="boxC">
+ <h3 class="subtitle">{% trans "Related tags" %}</h3>
+ <div class="body">
+ <div class="tags">
+ {% for tag in tags %}
+ <a rel="tag" title="{% trans "see questions tagged"%}'{{ tag.name }}'{% trans "using tags" %}" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
+ <span class="tag-number">× {{ tag.used_count|intcomma }}</span>
+ <br>
+ {% endfor %}
+ <br>
+ </div>
+ </div>
+</div>
+
+{% endblock %}
+
diff --git a/templates/unanswered.html b/templates/unanswered.html
index 4012921a..926f2ffd 100644
--- a/templates/unanswered.html
+++ b/templates/unanswered.html
@@ -1,8 +1,10 @@
+<!-- unanswered.html -->
{% extends "base.html" %}
{% load extra_tags %}
+{% load i18n %}
{% load humanize %}
{% load extra_filters %}
-{% block title %}{% spaceless %}没有回答的问题{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans "Unanswered questions" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -13,9 +15,9 @@
{% endblock %}
{% block content %}
<div class="tabBar">
- <span class="headQuestions">没有回答的问题</span>
+ <span class="headQuestions">{% trans "Unanswered questions" %}</span>
<div class="tabsA">
- <a id="latest" href="?sort=latest" class="on" title="最新加入系统的问题">最新问题</a>
+ <a id="latest" href="?sort=latest" class="on" title="{% trans "most recently asked questions" %}">{% trans "newest" %}</a>
</div>
</div>
@@ -31,9 +33,9 @@
<td><span class="num">{{ question.view_count|cnprog_intword|safe }}</span> </td>
</tr>
<tr>
- <td><span class="unit">回答</span></td>
- <td><span class="unit">票数</span></td>
- <td><span class="unit">浏览</span></td>
+ <td><span class="unit">{% trans "answers" %}</span></td>
+ <td><span class="unit">{% trans "votes" %}</span></td>
+ <td><span class="unit">{% trans "views" %}</span></td>
</tr>
</table>
</div>
@@ -43,7 +45,7 @@
{% ifequal tab_id 'active'%}
{% if question.wiki %}
- <span class="from wiki">社区Wiki</span>
+ <span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
@@ -55,7 +57,7 @@
{% endif %}
{% else %}
{% if question.wiki %}
- <span class="from wiki">社区Wiki</span>
+ <span class="from wiki">{% trans "community wiki" %}</span>
<span class="date" title="{{ question.added_at }}">{% diff_date question.added_at %}</span>
{% else %}
<div class="from">
@@ -68,9 +70,12 @@
{% endifequal %}
<div class="tags">
- {% for tag in question.tagname_list %}
- <a href="{% url forum.views.tag tag|urlencode %}" title="查看有关'{{ tag }}'的问题" rel="tag">{{ tag }}</a>
- {% endfor %}
+ {% for tag in question.tagname_list %}
+ <a href="{% url forum.views.tag tag|urlencode %}"
+ title="{% trans "see questions tagged" %}'{{ tag }}'{% trans "using tags" %}"
+ rel="tag">{{ tag }}
+ </a>
+ {% endfor %}
</div>
</div>
{% endfor %}
@@ -78,31 +83,30 @@
{% endblock %}
{% block tail %}
- <div class="pager">
- {% cnprog_paginator context %}
-
- </div>
- <div class="pagesize">
- {% cnprog_pagesize context %}
- </div>
+ <div class="pager">
+ {% cnprog_paginator context %}
+ </div>
+ <div class="pagesize">
+ {% cnprog_pagesize context %}
+ </div>
{% endblock %}
{% block sidebar %}
<div class="boxC">
<p>
- 您正在浏览所有<br><div class="questions-count">{{ questions_count|intcomma }}</div>
- <p>个<span class="darkred"><strong> 没有回答的 </strong></span>问题。</p>
-
- <p>问题按 <strong>问题创建时间</strong> 排序。最新加入的问题将显示在最前面。</p>
-
+ {% blocktrans with questions_count|intcomma as num_q %}have {{num_q}} unanswered questions{% endblocktrans %}
+ {% comment %}
+ {% trans "Have a total of" %}<br><div class="questions-count">{{ questions_count|intcomma }}</div>
+ {% endcomment %}
+ <!---<p>问题按 <strong>问题创建时间</strong> 排序。最新加入的问题将显示在最前面。</p>-->
</p>
</div>
<div class="boxC">
- <h3 class="subtitle">相关标签</h3>
+ <h3 class="subtitle">{% trans "Related tags" %}</h3>
<div class="body">
<div class="tags">
{% for tag in tags %}
- <a rel="tag" title="查看有关'{{ tag.name }}'的问题" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
+ <a rel="tag" title="{% trans "see questions tagged"%}'{{ tag.name }}'{% trans "using tags" %}" href="{% url forum.views.tag tag.name|urlencode %}">{{ tag.name }}</a>
<span class="tag-number">× {{ tag.used_count|intcomma }}</span>
<br>
{% endfor %}
@@ -113,3 +117,4 @@
{% endblock %}
+<!-- end unanswered.html -->
diff --git a/templates/upfiles/1245715031297631.png b/templates/upfiles/1245715031297631.png
new file mode 100755
index 00000000..89a6aed4
--- /dev/null
+++ b/templates/upfiles/1245715031297631.png
Binary files differ
diff --git a/templates/upfiles/12457157052552259.png b/templates/upfiles/12457157052552259.png
new file mode 100755
index 00000000..89a6aed4
--- /dev/null
+++ b/templates/upfiles/12457157052552259.png
Binary files differ
diff --git a/templates/user.html b/templates/user.html
index dd8e3b13..53a30dc0 100644
--- a/templates/user.html
+++ b/templates/user.html
@@ -1,3 +1,4 @@
+<!-- user.html -->
{% extends "base_content.html" %}
{% load extra_tags %}
{% load humanize %}
@@ -31,4 +32,4 @@
{% endblock %}
{% include "user_footer.html" %}
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}<!-- end user.html -->
diff --git a/templates/user_edit.html b/templates/user_edit.html
index 18794472..0f927374 100644
--- a/templates/user_edit.html
+++ b/templates/user_edit.html
@@ -1,7 +1,9 @@
+<!-- user_edit.html -->
{% extends "base_content.html" %}
{% load extra_tags %}
{% load humanize %}
-{% block title %}{% spaceless %}修改个人资料{% endspaceless %}{% endblock %}
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Edit user profile" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
$().ready(function(){
@@ -14,7 +16,7 @@
{% endblock %}
{% block content %}
<div id="main-bar" class="headNormal">
- {{ request.user.username }} - 修改资料
+ {{ request.user.username }} - {% trans "edit profile" %}
</div>
<div id="main-body" style="width:100%;padding-top:10px">
<form name="" action="{% url edit_user request.user.id %}" method="post">
@@ -25,12 +27,13 @@
<img src="/content/images/nophoto.png">
{% endif %}
<div style="padding:20px 0 0 20px;font-weight:bold;font-size:150%">
- <a href="http://www.gravatar.com/" target="_blank" title="gravatar和您的邮件地址是绑定的">修改头像</a>
+ <a href="http://www.gravatar.com/" target="_blank"
+ title="gravatar {% trans "image associated with your email address" %}">{% trans "avatar" %}</a>
</div>
</div>
<div id="askform" style="float:right;width:750px;text-align:left;">
- <h2>注册用户</h2>
+ <h2>{% trans "Registered user" %}</h2>
<table class="user-details">
<tr>
<th width="100px"></th>
@@ -76,8 +79,8 @@
</table>
<div style="margin:30px 0 60px 0">
- <input type="submit" value="更新" class="submit" >
- <input id="cancel" type="button" value="取消" class="submit" >
+ <input type="submit" value="{% trans "Update" %}" class="submit" >
+ <input id="cancel" type="button" value="{% trans "Cancel" %}" class="submit" >
</div>
</div>
@@ -85,6 +88,4 @@
</div>
{% endblock %}
-
-
-
+<!-- end user_edit.html -->
diff --git a/templates/user_favorites.html b/templates/user_favorites.html
index 8cebc798..d47670bd 100644
--- a/templates/user_favorites.html
+++ b/templates/user_favorites.html
@@ -1,7 +1,9 @@
+<!-- user_favorites.html -->
{% extends "user.html" %}
{% load extra_tags %}
{% load humanize %}
{% block usercontent %}
{% include "users_questions.html" %}
-{% endblock %} \ No newline at end of file
+{% endblock %}
+<!-- end user_favorites.html -->
diff --git a/templates/user_footer.html b/templates/user_footer.html
index 3deba20a..ee347742 100644
--- a/templates/user_footer.html
+++ b/templates/user_footer.html
@@ -1,3 +1,4 @@
+<!-- user_footer.html -->
<div id="mainbar-footer">
-</div> \ No newline at end of file
+</div><!-- end user_footer.html -->
diff --git a/templates/user_info.html b/templates/user_info.html
index 1700fda8..8e6dca84 100644
--- a/templates/user_info.html
+++ b/templates/user_info.html
@@ -1,6 +1,8 @@
+<!-- user_info.html -->
{% load extra_tags %}
{% load extra_filters %}
{% load humanize %}
+{% load i18n %}
<div id="subheader" class="headUser">
{{view_user.username}}
@@ -18,7 +20,7 @@
<tr>
<td align="center">
<div class="scoreNumber">{{view_user.reputation|intcomma}}</div>
- <p><b style="color:#777;">积分</b></p>
+ <p><b style="color:#777;">{% trans "reputation" %}</b></p>
</td>
</tr>
</table>
@@ -26,51 +28,52 @@
<td width="360" style="vertical-align: top;">
<table class="user-details">
<tr height="30px">
- <th width="130" align="left"><strong>注册用户</strong></th>
+ <th width="130" align="left"><strong>{% trans "Registered user" %}</strong></th>
<th width="230" align="right">
{% if request.user|can_view_user_edit:view_user %}
- <span class="user-edit-link"><a href="/users/{{ view_user.id }}/edit/">更新我的资料</a></span>
+ <span class="user-edit-link"><a href="/users/{{ view_user.id }}/edit/">{% trans "update profile" %}</a></span>
{% endif %}
</th>
</tr>
{% if view_user.real_name %}
<tr>
- <td >姓名</td>
- <td ><b>{{view_user.real_name}}</b></td>
+ <td>{% trans "real name" %}</td>
+ <td><b>{{view_user.real_name}}</b></td>
</tr>
{% endif %}
<tr>
- <td>已加入</td>
+ <td>{% trans "member for" %}</td>
<td>{{ view_user.date_joined|timesince }}</td>
</tr>
{% if view_user.last_seen %}
<tr>
- <td>上次活动时间</td>
- <td><strong title="{{ view_user.last_seen }}">{{ view_user.last_seen|timesince }}前</strong></td>
+ <td>{% trans "last seen" %}</td>
+ <td><strong title="{{ view_user.last_seen }}">{{ view_user.last_seen|timesince }} {% trans "ago" %}</strong></td>
</tr>
{% endif %}
{% if view_user.website %}
<tr>
- <td>个人网站</td>
+ <td>{% trans "user website" %}</td>
<td><a rel="nofollow" target="_blank" href="{{view_user.website}}">{{view_user.website}}</a></td>
</tr>
{% endif %}
{% if view_user.location %}
<tr>
- <td>城市</td>
+ <td>{% trans "location" %}</td>
<td>{{view_user.location}}</td>
</tr>
{% endif %}
{% if view_user.date_of_birth%}
<tr>
- <td>年龄</td>
- <td>{% get_age view_user.date_of_birth %} 岁</td>
+ <!--todo - redo this with blocktrans -->
+ <td>{% trans "age" %}</td>
+ <td>{% get_age view_user.date_of_birth %} {% trans "age unit" %}</td>
</tr>
{% endif %}
{% if votes_today_left %}
<tr>
- <td>今日剩余投票数</td>
- <td><strong class="darkred">{{ votes_today_left }}</strong> 票</td>
+ <td>{% trans "todays unused votes" %}</td>
+ <td><strong class="darkred">{{ votes_today_left }}</strong> {% trans "votes left" %}</td>
</tr>
{% endif %}
</table>
@@ -83,4 +86,5 @@
</div>
</td>
</tr>
-</table> \ No newline at end of file
+</table>
+<!-- end user_info.html -->
diff --git a/templates/user_preferences.html b/templates/user_preferences.html
index 3a760a25..246a834e 100644
--- a/templates/user_preferences.html
+++ b/templates/user_preferences.html
@@ -1,20 +1,11 @@
+<!-- user_preferences.html -->
{% extends "user.html" %}
{% load extra_tags %}
{% load humanize %}
{% block usercontent %}
<div style="padding:5px;">
- <fieldset>
- <legend><b>同步Twitter消息</b></legend>
- <form>
- <label for="name">账号:</label>
- <input id="name" /><br>
- <label for="password">密码:</label>
- <input id="password" type="password"/><br>
- <input id="cbMessage" type="checkbox" />发布我的提问到我的Twitter<br>
- <input id="cbReply" type="checkbox" />发布我的回答到我的Twitter<br>
- <input type="submit" value="保存" />
- </form>
- </fieldset>
+ <h1>Surprise will be here soon ;-)</h1>
</div>
{% endblock %}
+<!-- end user_preferences.html -->
diff --git a/templates/user_recent.html b/templates/user_recent.html
index bb2bc99d..70c074ad 100644
--- a/templates/user_recent.html
+++ b/templates/user_recent.html
@@ -1,3 +1,4 @@
+<!-- user_recent.html -->
{% extends "user.html" %}
{% load extra_tags %}
{% load humanize %}
@@ -22,4 +23,5 @@
</div>
{% endfor %}
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}
+<!-- end user_recent.html -->
diff --git a/templates/user_reputation.html b/templates/user_reputation.html
index aad8db44..7a1c7366 100644
--- a/templates/user_reputation.html
+++ b/templates/user_reputation.html
@@ -1,3 +1,4 @@
+<!-- user_reputation.html -->
{% extends "user.html" %}
{% load extra_tags %}
{% load humanize %}
@@ -37,4 +38,4 @@
{% endfor %}
</div>
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}<!-- end user_reputation.html -->
diff --git a/templates/user_responses.html b/templates/user_responses.html
index 0ada494c..45aab21b 100644
--- a/templates/user_responses.html
+++ b/templates/user_responses.html
@@ -1,3 +1,4 @@
+<!-- user_responses.html -->
{% extends "user.html" %}
{% load extra_tags %}
{% load humanize %}
@@ -9,7 +10,7 @@
<div style="width:150px;float:left">{% diff_date response.time 3 %}</div>
<div style="width:100px;float:left"><a href="{{ response.userlink }}">{{ response.username }}</a></div>
<div style="float:left;overflow:hidden;width:680px">
- <strong {% ifequal response.type "回答问题"%}class="user-action-2"{% endifequal %}{% ifequal response.type "最佳答案"%}class="user-action-8"{% endifequal %}>{{ response.type }}</strong>:
+ <strong {% ifequal response.type "question_answered" %}class="user-action-2"{% endifequal %}{% ifequal response.type "answer_accepted" %}class="user-action-8"{% endifequal %}>{{ response.type }}</strong>:
<a href="{{ response.titlelink }}">{{ response.title }}</a><br>
{{ response.content|safe }}
<div style="height:10px"></div>
@@ -18,4 +19,5 @@
</div>
{% endfor %}
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}
+<!-- end user_responses.html -->
diff --git a/templates/user_stats.html b/templates/user_stats.html
index f6f55246..a5be1a77 100644
--- a/templates/user_stats.html
+++ b/templates/user_stats.html
@@ -1,4 +1,6 @@
+<!-- user_stats.html -->
{% extends "user.html" %}
+{% load i18n %}
{% load extra_tags %}
{% load humanize %}
{% block usercontent %}
@@ -10,7 +12,7 @@
<div style="text-align: right;" class="count">{{questions|length}}</div>
</td>
<td>
- <h2>个问题</h2>
+ <h2>{% trans "User questions" %}</h2>
</td>
</tr>
</table>
@@ -23,7 +25,7 @@
<div style="text-align: right;" class="count">{{answered_questions|length}}</div>
</td>
<td >
- <h2>个回答</h2>
+ <h2>{% trans "Answers" %}</h2>
</td>
</tr>
</table>
@@ -31,12 +33,14 @@
{% for answered_question in answered_questions %}
<div class="answer-summary">
<a title="{{answered_question.summary}}" href="/questions/{{answered_question.id}}/{{answered_question.title}}#{{answered_question.answer_id}}">
- <div class="answer-votes {% if answered_question.accepted %}answered-accepted{% endif %}" title="该回答总共有{{ answered_question.vote_count }}个投票&#13;{% if answered_question.accepted %}该回答已被设为最佳答案{%endif%}">
+ <div class="answer-votes {% if answered_question.accepted %}answered-accepted{% endif %}"
+ title="{% blocktrans with answered_question.vote_count as vote_count %}the answer has been voted for {{ vote_count }} times{% endblocktrans %}&#13;{% if answered_question.accepted %}{% trans "this answer has been selected as correct" %}{%endif%}">
{{ answered_question.vote_count }}
</div>
</a>
<div class="answer-link">
- <a href="/questions/{{answered_question.id}}/{{answered_question.title}}#{{answered_question.answer_id}}">{{answered_question.title}}</a> {% if answered_question.comment_count %}<span title="该回答有{{ answered_question.comment_count }}条评论">({{answered_question.comment_count}})</span>{% endif %}
+ <a href="/questions/{{answered_question.id}}/{{answered_question.title}}#{{answered_question.answer_id}}">{{answered_question.title}}</a> {% if answered_question.comment_count %}<span
+ title="{% blocktrans %}the answer has been commented {{ answered_question.comment_count }} times{% endblocktrans %}">({{answered_question.comment_count}})</span>{% endif %}
</div>
</div>
{% endfor %}
@@ -49,7 +53,7 @@
<div style="text-align: right;" class="count">{{total_votes}}</div>
</td>
<td >
- <h2>个投票</h2>
+ <h2>{% trans "votes total" %}</h2>
</td>
</tr>
</table>
@@ -58,12 +62,12 @@
<tr>
<td width="60">
<img style="cursor: default;" align="absmiddle" src="/content/images/vote-arrow-up-on.png"/>
- <span title="该用户投的赞成票总数" class="vote-count">{{up_votes}}</span>
+ <span title="{% trans "user has voted up this many times" %}" class="vote-count">{{up_votes}}</span>
</td>
<td width="60">
<img style="cursor: default;" align="absmiddle" src="/content/images/vote-arrow-down-on.png"/>
- <span title="用户投的反对票总数" class="vote-count">{{down_votes}}</span>
+ <span title="{% trans "user voted down this many times" %}" class="vote-count">{{down_votes}}</span>
</td>
</tr>
@@ -77,7 +81,7 @@
<div style="text-align: right;" class="count">{{tags|length}}</div>
</td>
<td >
- <h2>个标签</h2>
+ <h2>{% trans "Tags" %}</h2>
</td>
</tr>
</table>
@@ -86,7 +90,9 @@
<tr>
<td width="180" valign="top">
{% for tag in tags%}
- <a rel="tag" title="查看有关'{{ tag }}'的问题" href="{% url forum.views.tag tag|urlencode %}">{{tag.name}}</a><span class="tag-number"> × {{ tag.used_count|intcomma }}</span><br>
+ <a rel="tag"
+ title="{% blocktrans %}see other questions tagged '{{ tag }}' {% endblocktrans %}"
+ href="{% url forum.views.tag tag|urlencode %}">{{tag.name}}</a><span class="tag-number"> × {{ tag.used_count|intcomma }}</span><br>
{% if forloop.counter|divisibleby:"10" %}
</td>
<td width="180" valign="top">
@@ -104,7 +110,7 @@
<div style="text-align: right;" class="count">{{total_awards}}</div>
</td>
<td >
- <h2>枚奖牌</h2>
+ <h2>{% trans "Badges" %}</h2>
</td>
</tr>
</table>
@@ -125,3 +131,4 @@
</div>
{% endblock %}
+<!-- end user_stats.html -->
diff --git a/templates/user_tabs.html b/templates/user_tabs.html
index 165b1b9f..03a9d111 100644
--- a/templates/user_tabs.html
+++ b/templates/user_tabs.html
@@ -1,20 +1,34 @@
+<!-- user_tabs.html -->
{% load extra_filters %}
+{% load i18n %}
<div class="tabBar">
<div class="tabsA">
- <a id="stats" {% ifequal tab_name "stats" %}class="on"{% endifequal %} title="用户概览" href="/users/{{view_user.id}}/{{view_user.username}}?sort=stats">概览</a>
- <a id="recent" {% ifequal tab_name "recent" %}class="on"{% endifequal %} title="最近活动" href="/users/{{view_user.id}}/{{view_user.username}}?sort=recent">最近活动</a>
+ <a id="stats" {% ifequal tab_name "stats" %}class="on"{% endifequal %}
+ title="{% trans "User profile" %}" href="/users/{{view_user.id}}/{{view_user.username}}?sort=stats">{% trans "overview" %}</a>
+ <a id="recent" {% ifequal tab_name "recent" %}class="on"{% endifequal %}
+ title="{% trans "recent activity" %}" href="/users/{{view_user.id}}/{{view_user.username}}?sort=recent">{% trans "recent activity" %}</a>
{% if request.user|is_user_self:view_user %}
- <a id="responses" {% ifequal tab_name "responses" %}class="on"{% endifequal %} title="其他用户的回复和评论" href="/users/{{view_user.id}}/{{view_user.username}}?sort=responses">回应</a>
+ <a id="responses" {% ifequal tab_name "responses" %}class="on"{% endifequal %}
+ title="{% trans "comments and answers to others questions" %}"
+ href="/users/{{view_user.id}}/{{view_user.username}}?sort=responses">{% trans "responses" %}</a>
{% endif %}
- <a id="reputation" {% ifequal tab_name "reputation" %}class="on"{% endifequal %} title="用户的社区积分历史" href="/users/{{view_user.id}}/{{view_user.username}}?sort=reputation">积分</a>
+ <a id="reputation" {% ifequal tab_name "reputation" %}class="on"{% endifequal %}
+ title="{% trans "graph of user reputation" %}"
+ href="/users/{{view_user.id}}/{{view_user.username}}?sort=reputation">{% trans "reputation history" %}</a>
{% if request.user|can_view_user_votes:view_user %}
- <a id="votes" {% ifequal tab_name "votes" %}class="on"{% endifequal %} title="用户所有投票" href="/users/{{view_user.id}}/{{view_user.username}}?sort=votes">投票</a>
+ <a id="votes" {% ifequal tab_name "votes" %}class="on"{% endifequal %}
+ title="{% trans "user vote record" %}" href="/users/{{view_user.id}}/{{view_user.username}}?sort=votes">{% trans "casted votes" %}</a>
{% endif %}
- <a id="favorites" {% ifequal tab_name "favorites" %}class="on"{% endifequal %} title="用户收藏的问题" href="/users/{{view_user.id}}/{{view_user.username}}?sort=favorites">收藏</a>
+ <a id="favorites" {% ifequal tab_name "favorites" %}class="on"{% endifequal %}
+ title="{% trans "questions that user selected as his/her favorite"
+ href="/users/{{view_user.id}}/{{view_user.username}}?sort=favorites">{% trans "favorites" %}</a>
<!--
{% if request.user|can_view_user_preferences:view_user %}
- <a id="preferences" {% ifequal tab_name "preferences" %}class="on"{% endifequal %} title="用户参数的设置" href="/users/{{view_user.id}}/{{view_user.username}}?sort=preferences">设置</a>
+ <a id="preferences" {% ifequal tab_name "preferences" %}class="on"{% endifequal %}
+ title="{% trans "user preference settings" %}"
+ href="/users/{{view_user.id}}/{{view_user.username}}?sort=preferences">{% trans "settings" %}</a>
{% endif %}
-->
</div>
-</div> \ No newline at end of file
+</div>
+<!-- end user_tabs.html -->
diff --git a/templates/user_votes.html b/templates/user_votes.html
index d50a3308..ec967704 100644
--- a/templates/user_votes.html
+++ b/templates/user_votes.html
@@ -1,6 +1,8 @@
+<!-- user_votes.html -->
{% extends "user.html" %}
{% load extra_tags %}
{% load humanize %}
+{% load i18n %}
{% block usercontent %}
<div style="padding-top:5px;font-size:13px;">
@@ -9,9 +11,9 @@
<div style="width:150px;float:left">{% diff_date vote.voted_at 3 %}</div>
<div style="width:30px;float:left">
{% ifequal vote.vote 1 %}
- <img src="/content/images/vote-arrow-up-on.png" title="赞成票">
+ <img src="/content/images/vote-arrow-up-on.png" title="{% trans "upvote" %}">
{% else %}
- <img src="/content/images/vote-arrow-down-on.png" title="反对票">
+ <img src="/content/images/vote-arrow-down-on.png" title="{% trans "downvote" %}">
{% endifequal %}
</div>
<div style="float:left;overflow:hidden;width:750px">
@@ -25,4 +27,5 @@
</div>
{% endfor %}
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}
+<!-- end user_votes.html -->
diff --git a/templates/users.html b/templates/users.html
index 16a83b21..701dbaa2 100644
--- a/templates/users.html
+++ b/templates/users.html
@@ -1,9 +1,12 @@
+<!-- users.html -->
{% extends "base_content.html" %}
{% load extra_tags %}
{% load humanize %}
-{% block title %}{% spaceless %}用户列表{% endspaceless %}{% endblock %}
+{% load i18n %}
+{% block title %}{% spaceless %}{% trans "Users" %}{% endspaceless %}{% endblock %}
{% block forejs %}
<script type="text/javascript">
+ //todo move javascript out
$().ready(function(){
$("#nav_users").attr('className',"on");
$("#type-user").attr('checked',true);
@@ -14,27 +17,26 @@
Hilite.elementid = "main-body";
Hilite.debug_referrer = location.href;
});
-
</script>
{% endblock %}
{% block content %}
<div class="tabBar">
- <div class="headUsers">用户列表</div>
+ <div class="headUsers">{% trans "Users" %}</div>
<div class="tabsA">
- <a id="sort_reputation" href="?sort=reputation" class="off" title="积分">积分</a>
- <a id="sort_newest" href="?sort=newest" class="off" title="最新加入">最新加入</a>
- <a id="sort_last" href="?sort=last" class="off" title="最先加入">最先加入</a>
- <a id="sort_user" href="?sort=user" class="off" title="用户名">用户名</a>
+ <a id="sort_reputation" href="?sort=reputation" class="off" title="{% trans "reputation" %}">{% trans "reputation" %}</a>
+ <a id="sort_newest" href="?sort=newest" class="off" title="{% trans "recent" %}">{% trans "recent" %}</a>
+ <a id="sort_last" href="?sort=last" class="off" title="{% trans "oldest" %}">{% trans "oldest" %}</a>
+ <a id="sort_user" href="?sort=user" class="off" title="{% trans "by username" %}">{% trans "by username" %}</a>
</div>
</div>
<div id="main-body" style="width:100%">
<p>
{% if suser %}
- 匹配查询 '<span class="darkred"><strong>{{ suser }}</strong></span>' 的所有用户名:
+ {% blocktrans %}users matching query {{suser}}:{% endblocktrans %}
{% endif %}
{% if not users.object_list %}
- <span >没有找到相关数据。</span>
+ <span>{% trans "Nothing found." %}</span>
{% endif %}
</p>
<div class="userList">
@@ -67,4 +69,5 @@
<div class="pager">
{% cnprog_paginator context %}
</div>
-{% endblock %} \ No newline at end of file
+{% endblock %}
+<!-- end users.html -->
diff --git a/templates/users_questions.html b/templates/users_questions.html
index f797a6b8..dfb87c8f 100644
--- a/templates/users_questions.html
+++ b/templates/users_questions.html
@@ -1,17 +1,21 @@
+<!-- users_questions.html -->
{% load extra_tags %}
{% load extra_filters %}
{% load humanize %}
+{% load i18n %}
<div class="user-stats-table">
{% for question in questions%}
{% if question.favourite_count %}
{% if question.favorited_myself %}
<div class="favorites-count">
- <img title="这个问题被 {{question.favourite_count}} 位用户收藏" src="/content/images/vote-favorite-on.png">
+ <img title="{% trans "this questions was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}"
+ src="/content/images/vote-favorite-on.png">
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% else %}
<div class="favorites-count-off">
- <img title="这个问题被 {{question.favourite_count}} 位用户收藏" src="/content/images/vote-favorite-off.png">
+ <img title="{% trans "this question was selected as favorite" %}{{question.favourite_count}} {% trans "number of times" %}"
+ src="/content/images/vote-favorite-off.png">
<div><b>{{question.favourite_count|intcomma}}</b></div>
</div>
{% endif %}
@@ -23,17 +27,17 @@
<div class="stats">
<div class="votes">
<div class="vote-count-post">{{question.vote_count|intcomma}}</div>
- 票
+ {% trans "votes" %}
</div>
- <div title="{% if question.answer_accepted %}有答案已被接受为正确答案{% endif %}" class="status {% if question.answer_accepted %}answered-accepted{% endif %} {% ifequal question.answer_count 0 %}unanswered{% endifequal %}{% ifnotequal question.answer_count 0 %}answered{% endifnotequal %}">
+ <div title="{% if question.answer_accepted %}{% trans "this answer has been accepted to be correct" %}{% endif %}" class="status {% if question.answer_accepted %}answered-accepted{% endif %} {% ifequal question.answer_count 0 %}unanswered{% endifequal %}{% ifnotequal question.answer_count 0 %}answered{% endifnotequal %}">
<div class="answer-count-post">{{question.answer_count|intcomma}}</div>
- 回答
+ {% trans "answers" %}
</div>
<div class="views">
<div class="views-count-post">{{question.view_count|cnprog_intword|safe}}</div>
- 浏览
+ {% trans "views" %}
</div>
</div>
</a>
@@ -44,7 +48,8 @@
<div class="tags">
{% convert2tagname_list question %}
{% for tag in question.tagnames %}
- <a href="{% url forum.views.tag tag|urlencode %}" title="查看有关'{{ tag }}'的问题" rel="tag">{{ tag }}</a>
+ <!--todo - move trans below to blocktrans -->
+ <a href="{% url forum.views.tag tag|urlencode %}" title="{% trans "see questions tagged" %} '{{ tag }}' {% trans "using tags" %}" rel="tag">{{ tag }}</a>
{% endfor %}
</div>
<div class="started">
@@ -57,4 +62,5 @@
</div>
<br clear="both"/>
{% endfor %}
-</div> \ No newline at end of file
+</div>
+<!-- end users_questions.html -->