Explorar o código

update translate

wangweimin %!s(int64=4) %!d(string=hai) anos
pai
achega
661f37ec6f

+ 1 - 1
docs/guide.rst

@@ -908,7 +908,7 @@ In coroutine-based session, you can start new thread, but you cannot call PyWebI
     start_server(main, auto_open_webbrowser=True)
 
 
-`run_async(coro) <pywebio.session.run_async>` returns a `TaskHandle <pywebio.session.coroutinebased.TaskHandle>`, which can be used to query the running status of the coroutine or close the coroutine.
+`run_async(coro) <pywebio.session.run_async>` returns a `TaskHandler <pywebio.session.coroutinebased.TaskHandler>`, which can be used to query the running status of the coroutine or close the coroutine.
 
 Close of session
 ^^^^^^^^^^^^^^^^^^^

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 207 - 397
docs/locales/zh_CN/LC_MESSAGES/guide.po


+ 46 - 52
docs/locales/zh_CN/LC_MESSAGES/index.po

@@ -7,15 +7,16 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-02-17 17:57+0800\n"
-"PO-Revision-Date: 2021-02-18 11:23+0800\n"
+"POT-Creation-Date: 2021-02-21 00:26+0800\n"
+"PO-Revision-Date: 2021-02-21 00:28+0800\n"
+"Last-Translator: WangWeimin <wang0.618@qq.com>\n"
+"Language: zh_CN\n"
+"Language-Team: \n"
+"Plural-Forms: nplurals=1; plural=0;\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.8.0\n"
-"Last-Translator: WangWeimin <wang0.618@qq.com>\n"
-"Language-Team: \n"
-"Language: zh_CN\n"
 "X-Generator: Poedit 2.4.2\n"
 
 #: ../../index.rst:72
@@ -32,21 +33,20 @@ msgstr "PyWebIO"
 
 #: ../../index.rst:4
 msgid ""
-"PyWebIO provides a series of imperative functions to obtain user input "
-"and output on the browser, turning the browser into a \"rich text "
-"terminal\", and can be used to build simple web applications or browser-"
-"based GUI applications. Using PyWebIO, developers can write applications "
-"just like writing terminal scripts (interaction based on input and "
-"print), without the need to have knowledge of HTML and JS. PyWebIO can "
-"also be easily integrated into existing Web services. PyWebIO is very "
-"suitable for quickly building applications that do not require complex "
-"UI."
-msgstr ""
-"PyWebIO提供了一系列命令式的交互函数来在浏览器上获取用户输入和进行输出,将"
-"浏览器变成了一个“富文本终端”,可以用于构建简单的Web应用或基于浏览器的GUI"
-"应用。 使用PyWebIO,开发者能像编写终端脚本一样(基于input和print进行交互)"
-"来编写应用,无需具备HTML和JS的相关知识; PyWebIO还可以方便地整合进现有的"
-"Web服务。非常适合快速构建对UI要求不高的应用。"
+"PyWebIO provides a series of imperative functions to obtain user input and "
+"output on the browser, turning the browser into a \"rich text terminal\", and "
+"can be used to build simple web applications or browser-based GUI applications. "
+"Using PyWebIO, developers can write applications just like writing terminal "
+"scripts (interaction based on input and print), without the need to have "
+"knowledge of HTML and JS. PyWebIO can also be easily integrated into existing "
+"Web services. PyWebIO is very suitable for quickly building applications that do "
+"not require complex UI."
+msgstr ""
+"PyWebIO提供了一系列命令式的交互函数来在浏览器上获取用户输入和进行输出,将浏览器变"
+"成了一个“富文本终端”,可以用于构建简单的Web应用或基于浏览器的GUI应用。 使用"
+"PyWebIO,开发者能像编写终端脚本一样(基于input和print进行交互)来编写应用,无需具备"
+"HTML和JS的相关知识; PyWebIO还可以方便地整合进现有的Web服务。非常适合快速构建对UI"
+"要求不高的应用。"
 
 #: ../../index.rst:7
 msgid "Features"
@@ -62,17 +62,15 @@ msgstr "非声明式布局,布局方式简单高效"
 
 #: ../../index.rst:11
 msgid ""
-"Less intrusive: old script code can be transformed into a Web service "
-"only by modifying the input and output logic"
+"Less intrusive: old script code can be transformed into a Web service only by "
+"modifying the input and output operation"
 msgstr "代码侵入性小,旧脚本代码仅需修改输入输出逻辑便可改造为Web服务"
 
 #: ../../index.rst:12
 msgid ""
-"Support integration into existing web services, currently supports "
-"Flask, Django, Tornado, aiohttp framework"
-msgstr ""
-"支持整合到现有的Web服务,目前支持与Flask、Django、Tornado、aiohttp框架集"
-"成"
+"Support integration into existing web services, currently supports Flask, "
+"Django, Tornado, aiohttp framework"
+msgstr "支持整合到现有的Web服务,目前支持与Flask、Django、Tornado、aiohttp框架集成"
 
 #: ../../index.rst:13
 msgid "Support for ``asyncio`` and coroutine"
@@ -100,8 +98,7 @@ msgstr "开发版::"
 
 #: ../../index.rst:25
 msgid ""
-"pip3 install -U https://code.aliyun.com/wang0618/pywebio/repository/"
-"archive.zip"
+"pip3 install -U https://code.aliyun.com/wang0618/pywebio/repository/archive.zip"
 msgstr ""
 
 #: ../../index.rst:27
@@ -114,8 +111,8 @@ msgstr ""
 
 #: ../../index.rst:34
 msgid ""
-"Here is a simple PyWebIO script to calculate the `BMI <https://en."
-"wikipedia.org/wiki/Body_mass_index>`_ ::"
+"Here is a simple PyWebIO script to calculate the `BMI <https://en.wikipedia.org/"
+"wiki/Body_mass_index>`_ ::"
 msgstr ""
 "这是一个使用PyWebIO计算 `BMI指数 <https://en.wikipedia.org/wiki/"
 "Body_mass_index>`_ 的脚本:"
@@ -135,8 +132,7 @@ msgid ""
 "\n"
 "    top_status = [(16, 'Severely underweight'), (18.5, 'Underweight'),\n"
 "                  (25, 'Normal'), (30, 'Overweight'),\n"
-"                  (35, 'Moderately obese'), (float('inf'), 'Severely "
-"obese')]\n"
+"                  (35, 'Moderately obese'), (float('inf'), 'Severely obese')]\n"
 "\n"
 "    for top, status in top_status:\n"
 "        if BMI <= top:\n"
@@ -169,29 +165,28 @@ msgstr ""
 
 #: ../../index.rst:58
 msgid ""
-"This is just a very simple script if you ignore PyWebIO, but after using "
-"the input and output functions provided by PyWebIO, you can interact "
-"with the code in the browser:"
+"This is just a very simple script if you ignore PyWebIO, but after using the "
+"input and output functions provided by PyWebIO, you can interact with the code "
+"in the browser:"
 msgstr ""
-"如果没有使用PyWebIO,这只是一个非常简单的脚本,而通过使用PyWebIO提供的输"
-"入输出函数,你可以在浏览器中与代码进行交互:"
+"如果没有使用PyWebIO,这只是一个非常简单的脚本,而通过使用PyWebIO提供的输入输出函"
+"数,你可以在浏览器中与代码进行交互:"
 
 #: ../../index.rst:64
 msgid ""
-"In the last line of the above code, changing the function call ``bmi()`` "
-"to `pywebio.start_server(bmi, port=80) <pywebio.platform.tornado."
-"start_server>` will start a bmi web service on port 80 ( :demo_host:"
-"`online Demo </?pywebio_api=bmi>` )."
+"In the last line of the above code, changing the function call ``bmi()`` to "
+"`pywebio.start_server(bmi, port=80) <pywebio.platform.tornado.start_server>` "
+"will start a bmi web service on port 80 ( :demo_host:`online Demo </?"
+"pywebio_api=bmi>` )."
 msgstr ""
-"将上面代码最后一行对 ``bmi()`` 的直接调用改为使用 `pywebio."
-"start_server(bmi, port=80) <pywebio.platform.tornado.start_server>` 便可"
-"以在80端口提供 ``bmi()`` 服务( :demo_host:`在线Demo </?"
-"pywebio_api=bmi>` )。"
+"将上面代码最后一行对 ``bmi()`` 的直接调用改为使用 `pywebio.start_server(bmi, "
+"port=80) <pywebio.platform.tornado.start_server>` 便可以在80端口提供 ``bmi()`` 服"
+"务( :demo_host:`在线Demo </?pywebio_api=bmi>` )。"
 
 #: ../../index.rst:66
 msgid ""
-"If you want to integrate the ``bmi()`` service into an existing web "
-"framework, you can visit :ref:`Integration with a web framework "
+"If you want to integrate the ``bmi()`` service into an existing web framework, "
+"you can visit :ref:`Integration with a web framework "
 "<integration_web_framework>` section of this document."
 msgstr ""
 "将 ``bmi()`` 服务整合到现有的Web框架请参考 :ref:`与Web框架集成 "
@@ -206,8 +201,8 @@ msgid ""
 "This documentation is also available in `PDF and Epub formats <https://"
 "readthedocs.org/projects/pywebio/downloads/>`_."
 msgstr ""
-"这个文档同时也提供 `PDF 和 Epub 格式 <https://readthedocs.org/projects/"
-"pywebio/downloads/>`_."
+"这个文档同时也提供 `PDF 和 Epub 格式 <https://readthedocs.org/projects/pywebio/"
+"downloads/>`_."
 
 #: ../../index.rst:98
 msgid "Indices and tables"
@@ -237,6 +232,5 @@ msgstr ""
 
 #: ../../index.rst:110
 msgid ""
-"Report bugs on the `GitHub issue <https://github.com/wang0618/pywebio/"
-"issues>`_."
+"Report bugs on the `GitHub issue <https://github.com/wang0618/pywebio/issues>`_."
 msgstr ""

+ 2 - 2
docs/locales/zh_CN/LC_MESSAGES/input.po

@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-02-17 18:31+0800\n"
-"PO-Revision-Date: 2021-02-18 11:23+0800\n"
+"PO-Revision-Date: 2021-02-21 00:21+0800\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -78,7 +78,7 @@ msgid ""
 "provide a non-empty input value, you need to pass ``required=True`` to the "
 "input function (some input functions do not support the ``required`` parameter)"
 msgstr ""
-"输入默认可以忽略,如果需要用户必须提供值,则需要在输入函数中传入 "
+"输入默认可以为空,如果需要用户必须提供值,则需要在输入函数中传入 "
 "``required=True`` (部分输入函数不支持 ``required`` 参数)"
 
 #: of pywebio.input:25

+ 14 - 14
docs/locales/zh_CN/LC_MESSAGES/session.po

@@ -558,7 +558,7 @@ msgstr "``device.model`` (str): 设备型号. 比如 'iPhone'"
 msgid ""
 "``user_language`` (str): Language used by the user's operating system. (e.g., "
 "``'zh-CN'``)"
-msgstr "``user_language`` (str): 用户操作系统使用的语言. 比如 ``’zh-CN’``"
+msgstr "``user_language`` (str): 用户操作系统使用的语言. 比如 ``'zh-CN'``"
 
 #: of pywebio.session.get_info:25
 msgid ""
@@ -576,7 +576,7 @@ msgid ""
 "host. (that is, the host, port part are inconsistent with ``server_host``)."
 msgstr ""
 "``origin`` (str): 当前用户的页面地址. 包含 协议、主机、端口 部分. 比如 "
-"``http://localhost:8080'`` .\n"
+"``'http://localhost:8080'`` .\n"
 "可能为空,但保证当用户的页面地址不在当前服务器下(即 主机、端口部分和 "
 "``server_host`` 不一致)时有值."
 
@@ -589,8 +589,8 @@ msgid ""
 "``backend`` (str): The current PyWebIO backend server implementation. The "
 "possible values are ``'tornado'``, ``'flask'``, ``'django'`` , ``'aiohttp'``."
 msgstr ""
-"当前PyWebIO使用的后端Server实现. 可能出现的值有 ``’tornado’`` , ``’flask’`` , "
-"``’django’`` , ``’aiohttp’``."
+"当前PyWebIO使用的后端Server实现. 可能出现的值有 ``'tornado'`` , ``'flask'`` , "
+"``'django'`` , ``'aiohttp'``."
 
 #: of pywebio.session.get_info:30
 msgid ""
@@ -654,18 +654,18 @@ msgid ""
 "}, indent=4), 'json')"
 msgstr ""
 
-#: of pywebio.session.coroutinebased.TaskHandle:1
-msgid "协程任务句柄"
-msgstr ""
+#: of pywebio.session.coroutinebased.TaskHandler:1
+msgid "The handler of coroutine task"
+msgstr "协程任务句柄"
 
-#: of pywebio.session.coroutinebased.TaskHandle:3
+#: of pywebio.session.coroutinebased.TaskHandler:3
 msgid "See also: `run_async() <pywebio.session.run_async>`"
 msgstr ""
 
-#: of pywebio.session.coroutinebased.TaskHandle.close:1
-msgid "关闭协程任务"
-msgstr ""
+#: of pywebio.session.coroutinebased.TaskHandler.close:1
+msgid "Close the coroutine task."
+msgstr "关闭协程任务"
 
-#: of pywebio.session.coroutinebased.TaskHandle.closed:1
-msgid "返回任务是否关闭"
-msgstr ""
+#: of pywebio.session.coroutinebased.TaskHandler.closed:1
+msgid "Returns a bool stating whether the coroutine task is closed."
+msgstr "任务是否关闭"

+ 1 - 1
pywebio/session/__init__.py

@@ -87,7 +87,7 @@ r"""
 .. autofunction:: go_app
 .. autofunction:: get_info
 
-.. autoclass:: pywebio.session.coroutinebased.TaskHandle
+.. autoclass:: pywebio.session.coroutinebased.TaskHandler
    :members:
 """
 

+ 7 - 7
pywebio/session/coroutinebased.py

@@ -206,7 +206,7 @@ class CoroutineBasedSession(Session):
         """异步运行协程对象。可以在协程内调用 PyWebIO 交互函数
 
         :param coro_obj: 协程对象
-        :return: An instance of  `TaskHandle` is returned, which can be used later to close the task.
+        :return: An instance of  `TaskHandler` is returned, which can be used later to close the task.
         """
         assert asyncio.iscoroutine(coro_obj), '`run_async()` only accept coroutine object'
 
@@ -225,8 +225,8 @@ class CoroutineBasedSession(Session):
         return res
 
 
-class TaskHandle:
-    """协程任务句柄
+class TaskHandler:
+    """The handler of coroutine task
 
     See also: `run_async() <pywebio.session.run_async>`
     """
@@ -236,11 +236,11 @@ class TaskHandle:
         self._closed = closed
 
     def close(self):
-        """关闭协程任务"""
+        """Close the coroutine task."""
         return self._close()
 
-    def closed(self):
-        """返回任务是否关闭"""
+    def closed(self) -> bool:
+        """Returns a bool stating whether the coroutine task is closed. """
         return self._closed()
 
 
@@ -348,5 +348,5 @@ class Task:
             logger.warning('Task[%s] was destroyed but it is pending!', self.coro_id)
 
     def task_handle(self):
-        handle = TaskHandle(close=self.close, closed=lambda: self.task_closed)
+        handle = TaskHandler(close=self.close, closed=lambda: self.task_closed)
         return handle

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio