Browse Source

update doc list,add some translations

honmaple 8 years ago
parent
commit
6c52a48a20

+ 8 - 6
forums/api/user/models.py

@@ -6,12 +6,14 @@
 # Author: jianglin
 # Email: xiyang0807@gmail.com
 # Created: 2016-12-15 21:09:08 (CST)
-# Last Update:星期日 2017-4-9 12:16:21 (CST)
+# Last Update:星期五 2017-4-21 19:8:22 (CST)
 #          By:
 # Description:
 # **************************************************************************
 from datetime import datetime, timedelta
+
 from flask import current_app
+from flask_babelex import lazy_gettext as _
 from flask_login import UserMixin, current_user
 from itsdangerous import BadSignature, SignatureExpired, URLSafeTimedSerializer
 from pytz import all_timezones
@@ -19,11 +21,11 @@ from sqlalchemy import event
 from sqlalchemy.orm import object_session
 from werkzeug.security import check_password_hash, generate_password_hash
 
-from flask_maple.models import ModelMixin
 from flask_maple.mail import MailMixin
+from flask_maple.models import ModelMixin
+from forums.common.records import load_online_sign_users
 from forums.count import Count
 from forums.extension import db, mail
-from forums.common.records import load_online_sign_users
 
 user_follower = db.Table(
     'user_follower',
@@ -201,12 +203,12 @@ class UserSetting(db.Model, ModelMixin):
     STATUS_ALLOW_AUTHENTICATED = '1'
     STATUS_ALLOW_OWN = '2'
 
-    STATUS = (('0', 'ALLOW ALL USER'), ('1', 'ALLOW AUTHENTICATED USER'),
-              ('2', 'ALLOW OWN'))
+    STATUS = (('0', _('ALLOW ALL USER')), ('1', _('ALLOW AUTHENTICATED USER')),
+              ('2', _('ALLOW OWN')))
 
     LOCALE_CHINESE = 'zh'
     LOCALE_ENGLISH = 'en'
-    LOCALE = (('zh', 'Chinese'), ('en', 'English'))
+    LOCALE = (('zh', _('Chinese')), ('en', _('English')))
 
     TIMEZONE_UTC = 'UTC'
     TIMEZONE = [(i, i) for i in all_timezones]

+ 20 - 18
forums/docs/templates/docs/doc_list.html

@@ -1,28 +1,30 @@
 {% extends 'base/base.html' %}
 {% block content %}
-<ol class="breadcrumb" style="margin-bottom:0;">
+  <ol class="breadcrumb" style="margin-bottom:0;">
     <li><a href="{{ url_for('forums.forums') }}"><i class="fa fa-home"></i>社区首页</a></li>
     <li class="active">文档</li>
-</ol>
-{% macro item(name,url,icon,color="#337ab7") %}
-<div class="col-md-3">
-    <div class="panel panel-default">
+  </ol>
+  {% macro item(name,url,icon,color="#337ab7") %}
+    <div class="col-md-3">
+      <div class="panel panel-default">
         <a href="{{ url }}">
-            <div class="panel-body text-center">
-                <i class="fa {{ icon }}" style="font-size:55px;color:{{ color }}"></i>
-            </div>
+          <div class="panel-body text-center">
+            <i class="fa {{ icon }}" style="font-size:55px;color:{{ color }}"></i>
+          </div>
         </a>
         <a href="{{ url }}">
-            <div class="panel-footer">
-                {{ name }}
-                <i class="pull-right icon-arrow-right"></i>
-            </div>
+          <div class="panel-footer">
+            {{ name }}
+            <i class="pull-right icon-arrow-right"></i>
+          </div>
         </a>
+      </div>
     </div>
-</div>
-{%- endmacro %}
-<div class="row">
-    {{ item("Flask-Maple",url_for('docs.doc',path='flask-maple/index.html'),"fa-comments","#F86334")}}
-    {{ item("Flask-Avatar",url_for('docs.doc',path='flask-avatar/index.html'),"fa-book","#F86334")}}
-</div>
+  {%- endmacro %}
+  {% set icons = ['fa-book','fa-commenting-o','fa-cubes','fa-comments-o','fa-globe'] %}
+  <div class="row">
+    {% for doc in docs %}
+      {{ item(doc,url_for('docs.doc',path=doc + '/index.html'),icons | random,"#F86334")}}
+    {% endfor %}
+  </div>
 {% endblock %}

+ 4 - 2
forums/docs/views.py

@@ -6,12 +6,13 @@
 # Author: jianglin
 # Email: xiyang0807@gmail.com
 # Created: 2016-11-09 21:06:32 (CST)
-# Last Update:星期日 2017-4-2 12:16:48 (CST)
+# Last Update:星期五 2017-4-21 19:17:46 (CST)
 #          By:
 # Description:
 # **************************************************************************
 from flask import (Blueprint, render_template, send_from_directory)
 from flask.views import MethodView
+import os
 
 site = Blueprint(
     'docs', __name__, template_folder='templates', static_folder='static')
@@ -19,7 +20,8 @@ site = Blueprint(
 
 class DocListView(MethodView):
     def get(self):
-        return render_template('docs/doc_list.html')
+        docs = [i for i in os.listdir(site.static_folder)]
+        return render_template('docs/doc_list.html', docs=docs)
 
 
 class DocView(MethodView):

BIN
translations/zh/LC_MESSAGES/messages.mo


+ 30 - 7
translations/zh/LC_MESSAGES/messages.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2017-04-09 12:50+0800\n"
+"POT-Creation-Date: 2017-04-21 19:08+0800\n"
 "PO-Revision-Date: 2016-06-16 14:36+0800\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language: zh\n"
@@ -16,9 +16,9 @@ msgstr ""
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Generated-By: Babel 2.3.4\n"
+"Generated-By: Babel 2.4.0\n"
 
-#: forums/extension.py:66
+#: forums/extension.py:67
 msgid "Please login to access this page."
 msgstr "这个页面要求登陆,请登陆"
 
@@ -220,6 +220,26 @@ msgstr "社区精华帖子"
 msgid "Top Topics"
 msgstr "精华文章"
 
+#: forums/api/user/models.py:206
+msgid "ALLOW ALL USER"
+msgstr "允许所有人"
+
+#: forums/api/user/models.py:206
+msgid "ALLOW AUTHENTICATED USER"
+msgstr "只允许登陆用户"
+
+#: forums/api/user/models.py:207
+msgid "ALLOW OWN"
+msgstr "仅自己"
+
+#: forums/api/user/models.py:211
+msgid "Chinese"
+msgstr "中文"
+
+#: forums/api/user/models.py:211
+msgid "English"
+msgstr "英文"
+
 #: forums/common/response.py:34
 msgid "Username or Password Error"
 msgstr ""
@@ -334,10 +354,6 @@ msgstr "博客"
 msgid "Good"
 msgstr "精华文章"
 
-#: templates/base/header.html:26
-msgid "search content"
-msgstr "搜索内容"
-
 #: templates/base/link.html:18
 msgid "TopicList"
 msgstr "所有主题"
@@ -559,6 +575,10 @@ msgstr "最高在线:"
 msgid "Time of highest online:"
 msgstr "最高在线时间:"
 
+#: templates/search/result.html:3 templates/search/result.html:6
+msgid "Search"
+msgstr ""
+
 #: templates/setting/_macro.html:4 templates/setting/setting.html:5
 #: templates/setting/setting.html:19
 msgid "Profile "
@@ -798,3 +818,6 @@ msgstr "最后回复来自%(author)s"
 #~ msgid "You have no permission"
 #~ msgstr "你没有权限!"
 
+#~ msgid "search content"
+#~ msgstr "搜索内容"
+