# Copyright (C) Weimin Wang
# This file is distributed under the same license as the PyWebIO package.
#
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
# Pikhosh <pikhosh@gmail.com>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: PyWebIO 1.5.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-26 16:35+0330\n"
"PO-Revision-Date: 2022-02-28 12:37+0330\n"
"Last-Translator: Pikhosh <pikhosh@gmail.com>\n"
"Language-Team: Persian <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
"Language: fa\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Lokalize 21.12.2\n"

#: ../../session.rst:2
msgid "``pywebio.session`` --- More control to session"
msgstr "``pywebio.session`` --- کنترل بیشتر به نشست"

#: of pywebio.session.download:1
msgid ""
"Send file to user, and the user browser will download the file to the "
"local"
msgstr ""

#: of pywebio.session.download pywebio.session.eval_js pywebio.session.go_app
#: pywebio.session.register_thread pywebio.session.run_async
#: pywebio.session.run_asyncio_coroutine pywebio.session.run_js
msgid "Parameters"
msgstr ""

#: of pywebio.session.download:3
msgid "File name when downloading"
msgstr ""

#: of pywebio.session.download:4
msgid "File content. It is a bytes-like object"
msgstr ""

#: of pywebio.session:137 pywebio.session.download:6 pywebio.session.eval_js:12
msgid "Example:"
msgstr ""

#: of pywebio.session.download:8
msgid ""
"put_button('Click to download', lambda: download('hello-world.txt', "
"b'hello world!'))"
msgstr ""

#: of pywebio.session.run_js:1
msgid "Execute JavaScript code in user browser."
msgstr ""

#: of pywebio.session.run_js:3
msgid "The code is run in the browser's JS global scope."
msgstr ""

#: of pywebio.session.run_js:5
msgid "JavaScript code"
msgstr ""

#: of pywebio.session.eval_js:6 pywebio.session.run_js:6
msgid ""
"Local variables passed to js code. Variables need to be JSON-serializable."
msgstr ""

#: of pywebio.session.run_asyncio_coroutine:8 pywebio.session.run_js:8
#: pywebio.session.set_env:20
msgid "Example::"
msgstr ""

#: of pywebio.session.run_js:10
msgid "run_js('console.log(a + b)', a=1, b=2)"
msgstr ""

#: of pywebio.session.eval_js:1
msgid ""
"Execute JavaScript expression in the user's browser and get the value of "
"the expression"
msgstr ""

#: of pywebio.session.eval_js:3
msgid ""
"JavaScript expression. The value of the expression need to be JSON-"
"serializable. If the value of the expression is a `promise "
"<https://developer.mozilla.org/en-"
"US/docs/Web/JavaScript/Reference/Global_Objects/Promise>`_, ``eval_js()``"
" will wait for the promise to resolve and return the value of it. When "
"the promise is rejected, `None` is returned."
msgstr ""

#: of pywebio.session.eval_js pywebio.session.run_async
msgid "Returns"
msgstr ""

#: of pywebio.session.eval_js:7
msgid "The value of the expression."
msgstr ""

#: of pywebio.session.eval_js:9
msgid ""
"Note: When using :ref:`coroutine-based session "
"<coroutine_based_session>`, you need to use the ``await "
"eval_js(expression)`` syntax to call the function."
msgstr ""

#: of pywebio.session.eval_js:14
msgid ""
"current_url = eval_js(\"window.location.href\")\n"
"put_text(current_url)  # ..demo-only\n"
"\n"
"## ----\n"
"function_res = eval_js('''(function(){\n"
"    var a = 1;\n"
"    a += b;\n"
"    return a;\n"
"})()''', b=100)\n"
"put_text(function_res)  # ..demo-only\n"
"\n"
"## ----\n"
"promise_res = eval_js('''new Promise(resolve => {\n"
"    setTimeout(() => {\n"
"        resolve('Returned inside callback.');\n"
"    }, 2000);\n"
"});''')\n"
"put_text(promise_res)  # ..demo-only"
msgstr ""

#: of pywebio.session.eval_js:39
msgid "The JS expression support return promise."
msgstr ""

#: of pywebio.session.register_thread:1
msgid ""
"Register the thread so that PyWebIO interactive functions are available "
"in the thread."
msgstr ""

#: of pywebio.session.register_thread:3
msgid "Can only be used in the thread-based session."
msgstr ""

#: of pywebio.session.register_thread:5
msgid "See :ref:`Concurrent in Server mode <thread_in_server_mode>`"
msgstr ""

#: of pywebio.session.register_thread:7
msgid "Thread object"
msgstr ""

#: of pywebio.session.defer_call:1
msgid "Set the function to be called when the session closes."
msgstr ""

#: of pywebio.session.defer_call:3
msgid ""
"Whether it is because the user closes the page or the task finishes to "
"cause session closed, the function set by ``defer_call(func)`` will be "
"executed. Can be used for resource cleaning."
msgstr ""

#: of pywebio.session.defer_call:6
msgid ""
"You can call ``defer_call(func)`` multiple times in the session, and the "
"set functions will be executed sequentially after the session closes."
msgstr ""

#: of pywebio.session.defer_call:9
msgid "``defer_call()`` can also be used as decorator::"
msgstr ""

#: of pywebio.session.defer_call:11
msgid ""
"@defer_call\n"
"def cleanup():\n"
"   pass"
msgstr ""

#: of pywebio.session.defer_call:15
msgid ""
"PyWebIO interactive functions cannot be called inside the deferred "
"functions."
msgstr ""

#: of pywebio.session:9
msgid "The session-local object for current session."
msgstr ""

#: of pywebio.session:11
msgid ""
"``local`` is a dictionary object that can be accessed through attributes,"
" it aim to be used to save some session-local state of your application. "
"Attributes of ``local`` are not shared between sessions, each session "
"sees only the attributes it itself placed in there."
msgstr ""

#: of pywebio.session
msgid "Usage Scenes"
msgstr ""

#: of pywebio.session:17
msgid ""
"When you need to share some session-independent data with multiple "
"functions, it is more convenient to use session-local objects to save "
"state than to use function parameters."
msgstr ""

#: of pywebio.session:20
msgid "Here is a example of a session independent counter implementation::"
msgstr ""

#: of pywebio.session:22
msgid ""
"from pywebio.session import local\n"
"def add():\n"
"    local.cnt = (local.cnt or 0) + 1\n"
"\n"
"def show():\n"
"    put_text(local.cnt or 0)\n"
"\n"
"def main():\n"
"    put_buttons(['Add counter', 'Show counter'], [add, show])"
msgstr ""

#: of pywebio.session:32
msgid "The way to pass state through function parameters is::"
msgstr ""

#: of pywebio.session:34
msgid ""
"from functools import partial\n"
"def add(cnt):\n"
"    cnt[0] += 1\n"
"\n"
"def show(cnt):\n"
"    put_text(cnt[0])\n"
"\n"
"def main():\n"
"    cnt = [0]  # Trick: to pass by reference\n"
"    put_buttons(['Add counter', 'Show counter'], [partial(add, cnt), "
"partial(show, cnt)])"
msgstr ""

#: of pywebio.session:45
msgid "Of course, you can also use function closures to achieved the same::"
msgstr ""

#: of pywebio.session:47
msgid ""
"def main():\n"
"    cnt = 0\n"
"\n"
"    def add():\n"
"        nonlocal cnt\n"
"        cnt += 1\n"
"\n"
"    def show():\n"
"        put_text(cnt)\n"
"\n"
"    put_buttons(['Add counter', 'Show counter'], [add, show])"
msgstr ""

#: of pywebio.session
msgid "Operations supported by local object"
msgstr ""

#: of pywebio.session:61
msgid ""
"``local`` is a dictionary object that can be accessed through attributes."
" When accessing a property that does not exist in the data object, it "
"returns ``None`` instead of throwing an exception. The method of "
"dictionary is not supported in ``local``. It supports the ``in`` operator"
" to determine whether the key exists. You can use ``local._dict`` to get "
"the underlying dictionary data."
msgstr ""

#: of pywebio.session:68
msgid ""
"local.name = \"Wang\"\n"
"local.age = 22\n"
"assert local.foo is None\n"
"local[10] = \"10\"\n"
"\n"
"for key in local:\n"
"    print(key)\n"
"\n"
"assert 'bar' not in local\n"
"assert 'name' in local\n"
"\n"
"print(local._dict)"
msgstr ""

#: of pywebio.session.set_env:1
msgid "configure the environment of current session."
msgstr ""

#: of pywebio.session.set_env:3
msgid "Available configuration are:"
msgstr ""

#: of pywebio.session.set_env:5
msgid "``title`` (str): Title of current page."
msgstr ""

#: of pywebio.session.set_env:6
msgid ""
"``output_animation`` (bool): Whether to enable output animation, enabled "
"by default"
msgstr ""

#: of pywebio.session.set_env:7
msgid ""
"``auto_scroll_bottom`` (bool): Whether to automatically scroll the page "
"to the bottom after output content, it is closed by default.  Note that "
"after enabled, only outputting to ROOT scope can trigger automatic "
"scrolling."
msgstr ""

#: of pywebio.session.set_env:9
msgid ""
"``http_pull_interval`` (int): The period of HTTP polling messages (in "
"milliseconds, default 1000ms), only available in sessions based on HTTP "
"connection."
msgstr ""

#: of pywebio.session.set_env:11
msgid ""
"``input_panel_fixed`` (bool): Whether to make input panel fixed at "
"bottom, enabled by default"
msgstr ""

#: of pywebio.session.set_env:12
msgid ""
"``input_panel_min_height`` (int): The minimum height of input panel (in "
"pixel, default 300px), it should be larger than 75px. Available only when"
" ``input_panel_fixed=True``"
msgstr ""

#: of pywebio.session.set_env:14
msgid ""
"``input_panel_init_height`` (int): The initial height of input panel (in "
"pixel, default 300px), it should be larger than 175px. Available only "
"when ``input_panel_fixed=True``"
msgstr ""

#: of pywebio.session.set_env:16
msgid ""
"``input_auto_focus`` (bool): Whether to focus on input automatically "
"after showing input panel, default is ``True``"
msgstr ""

#: of pywebio.session.set_env:17
msgid ""
"``output_max_width`` (str): The max width of the page content area (in "
"pixel or percentage, e.g. ``'1080px'``, ``'80%'``. Default is 880px)."
msgstr ""

#: of pywebio.session.set_env:22
msgid "set_env(title='Awesome PyWebIO!!', output_animation=False)"
msgstr ""

#: of pywebio.session.set_env:26
msgid "Added the ``output_max_width`` parameter"
msgstr ""

#: of pywebio.session.go_app:1
msgid ""
"Jump to another task of a same PyWebIO application. Only available in "
"PyWebIO Server mode"
msgstr ""

#: of pywebio.session.go_app:3
msgid "Target PyWebIO task name."
msgstr ""

#: of pywebio.session.go_app:4
msgid "Whether to open in a new window, the default is `True`"
msgstr ""

#: of pywebio.session.go_app:6
msgid "See also: :ref:`Server mode <server_and_script_mode>`"
msgstr ""

#: of pywebio.session:88
msgid "The session information data object, whose attributes are:"
msgstr ""

#: of pywebio.session:90
msgid ""
"``user_agent`` : The Object of the user browser information, whose "
"attributes are"
msgstr ""

#: of pywebio.session:92
msgid ""
"``is_mobile`` (bool): whether user agent is identified as a mobile phone "
"(iPhone, Android phones, Blackberry, Windows Phone devices etc)"
msgstr ""

#: of pywebio.session:94
msgid ""
"``is_tablet`` (bool): whether user agent is identified as a tablet device"
" (iPad, Kindle Fire, Nexus 7 etc)"
msgstr ""

#: of pywebio.session:95
msgid ""
"``is_pc`` (bool): whether user agent is identified to be running a "
"traditional \"desktop\" OS (Windows, OS X, Linux)"
msgstr ""

#: of pywebio.session:96
msgid "``is_touch_capable`` (bool): whether user agent has touch capabilities"
msgstr ""

#: of pywebio.session:98
msgid "``browser.family`` (str): Browser family. such as 'Mobile Safari'"
msgstr ""

#: of pywebio.session:99
msgid "``browser.version`` (tuple): Browser version. such as (5, 1)"
msgstr ""

#: of pywebio.session:100
msgid "``browser.version_string`` (str): Browser version string. such as '5.1'"
msgstr ""

#: of pywebio.session:102
msgid "``os.family`` (str): User OS family. such as 'iOS'"
msgstr ""

#: of pywebio.session:103
msgid "``os.version`` (tuple): User OS version. such as (5, 1)"
msgstr ""

#: of pywebio.session:104
msgid "``os.version_string`` (str): User OS version string. such as '5.1'"
msgstr ""

#: of pywebio.session:106
msgid "``device.family`` (str): User agent's device family. such as 'iPhone'"
msgstr ""

#: of pywebio.session:107
msgid "``device.brand`` (str): Device brand. such as 'Apple'"
msgstr ""

#: of pywebio.session:108
msgid "``device.model`` (str): Device model. such as 'iPhone'"
msgstr ""

#: of pywebio.session:110
msgid ""
"``user_language`` (str): Language used by the user's operating system. "
"(e.g., ``'zh-CN'``)"
msgstr ""

#: of pywebio.session:111
msgid ""
"``server_host`` (str): PyWebIO server host, including domain and port, "
"the port can be omitted when 80."
msgstr ""

#: of pywebio.session:112
msgid ""
"``origin`` (str): Indicate where the user from. Including protocol, host,"
" and port parts. Such as ``'http://localhost:8080'``. It may be empty, "
"but it is guaranteed to have a value when the user's page address is not "
"under the server host. (that is, the host, port part are inconsistent "
"with ``server_host``)."
msgstr ""

#: of pywebio.session:115
msgid "``user_ip`` (str): User's ip address."
msgstr ""

#: of pywebio.session:116
msgid ""
"``backend`` (str): The current PyWebIO backend server implementation. The"
" possible values are ``'tornado'``, ``'flask'``, ``'django'`` , "
"``'aiohttp'`` , ``'starlette'``."
msgstr ""

#: of pywebio.session:118
msgid ""
"``protocol`` (str): The communication protocol between PyWebIO server and"
" browser. The possible values are ``'websocket'``, ``'http'``"
msgstr ""

#: of pywebio.session:120
msgid ""
"``request`` (object): The request object when creating the current "
"session. Depending on the backend server, the type of ``request`` can be:"
msgstr ""

#: of pywebio.session:123
msgid ""
"When using Tornado, ``request`` is instance of "
"`tornado.httputil.HTTPServerRequest "
"<https://www.tornadoweb.org/en/stable/httputil.html#tornado.httputil.HTTPServe"
"rRequest>`_"
msgstr ""

#: of pywebio.session:125
msgid ""
"When using Flask, ``request`` is instance of `flask.Request "
"<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>`_"
msgstr ""

#: of pywebio.session:126
msgid ""
"When using Django, ``request`` is instance of `django.http.HttpRequest "
"<https://docs.djangoproject.com/en/3.0/ref/request-"
"response/#django.http.HttpRequest>`_"
msgstr ""

#: of pywebio.session:127
msgid ""
"When using aiohttp, ``request`` is instance of `aiohttp.web.BaseRequest "
"<https://docs.aiohttp.org/en/stable/web_reference.html#aiohttp.web.BaseRequest"
">`_"
msgstr ""

#: of pywebio.session:128
msgid ""
"When using FastAPI/Starlette, ``request`` is instance of "
"`starlette.websockets.WebSocket <https://www.starlette.io/websockets/>`_"
msgstr ""

#: of pywebio.session:130
msgid ""
"The ``user_agent`` attribute of the session information object is parsed "
"by the user-agents library. See https://github.com/selwin/python-user-"
"agents#usage"
msgstr ""

#: of pywebio.session:135
msgid "Added the ``protocol`` attribute."
msgstr ""

#: of pywebio.session:139
msgid ""
"import json\n"
"from pywebio.session import info as session_info\n"
"\n"
"put_code(json.dumps({\n"
"    k: str(getattr(session_info, k))\n"
"    for k in ['user_agent', 'user_language', 'server_host',\n"
"              'origin', 'user_ip', 'backend', 'protocol', 'request']\n"
"}, indent=4), 'json')"
msgstr ""

#: of pywebio.session.coroutinebased.TaskHandler:1
msgid "The handler of coroutine task"
msgstr ""

#: of pywebio.session.coroutinebased.TaskHandler:3
msgid "See also: `run_async() <pywebio.session.run_async>`"
msgstr ""

#: of pywebio.session.coroutinebased.TaskHandler.close:1
msgid "Close the coroutine task."
msgstr ""

#: of pywebio.session.coroutinebased.TaskHandler.closed:1
msgid "Returns a bool stating whether the coroutine task is closed."
msgstr ""

#: of pywebio.session.hold:1
msgid "Keep the session alive until the browser page is closed by user."
msgstr ""

#: of pywebio.session.hold:5
msgid ""
"Since PyWebIO v1.4, in :ref:`server mode <server_mode>`, it's no need to "
"call this function manually, PyWebIO will automatically hold the session "
"for you when needed. The only case to use it is to prevent the "
"application from exiting in scrip mode."
msgstr ""

#: of pywebio.session.hold:9
msgid ""
"In case you use the previous version of PyWebIO (we strongly recommend "
"that you upgrade to the latest version), here is the old document for "
"``hold()``:"
msgstr ""

#: of pywebio.session.hold:12
msgid ""
"After the PyWebIO session closed, the functions that need communicate "
"with the PyWebIO server (such as the event callback of `put_buttons()` "
"and download link of `put_file()`) will not work. You can call the "
"``hold()`` function at the end of the task function to hold the session, "
"so that the event callback and download link will always be available "
"before the browser page is closed by user."
msgstr ""

#: of pywebio.session.run_async:1
msgid ""
"Run the coroutine object asynchronously. PyWebIO interactive functions "
"are also available in the coroutine."
msgstr ""

#: of pywebio.session.run_async:3
msgid ""
"``run_async()`` can only be used in :ref:`coroutine-based session "
"<coroutine_based_session>`."
msgstr ""

#: of pywebio.session.run_async:5
msgid "Coroutine object"
msgstr ""

#: of pywebio.session.run_async:6
msgid ""
"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` instance, which "
"can be used to query the running status of the coroutine or close the "
"coroutine."
msgstr ""

#: of pywebio.session.run_async:9
msgid ""
"See also: :ref:`Concurrency in coroutine-based sessions "
"<coroutine_based_concurrency>`"
msgstr ""

#: of pywebio.session.run_asyncio_coroutine:1
msgid ""
"If the thread running sessions are not the same as the thread running the"
" asyncio event loop, you need to wrap ``run_asyncio_coroutine()`` to run "
"the coroutine in asyncio."
msgstr ""

#: of pywebio.session.run_asyncio_coroutine:4
msgid ""
"Can only be used in :ref:`coroutine-based session "
"<coroutine_based_session>`."
msgstr ""

#: of pywebio.session.run_asyncio_coroutine:6
msgid "Coroutine object in `asyncio`"
msgstr ""

#: of pywebio.session.run_asyncio_coroutine:10
msgid ""
"async def app():\n"
"    put_text('hello')\n"
"    await run_asyncio_coroutine(asyncio.sleep(1))\n"
"    put_text('world')\n"
"\n"
"pywebio.platform.flask.start_server(app)"
msgstr ""

