Skip to content

Commit 461c656

Browse files
committed
doc: Modify translation.
Signed-off-by: lbuque <1102390310@qq.com>
1 parent 36048bf commit 461c656

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+10183
-39
lines changed

Diff for: .readthedocs.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ build:
1616
# golang: "1.19"
1717

1818
# Build documentation in the "docs/" directory with Sphinx
19-
# sphinx:
20-
# configuration: docs/conf.py
19+
sphinx:
20+
configuration: docs/en/conf.py
2121

2222
# Optionally build your docs in additional formats such as PDF and ePub
2323
# formats: all

Diff for: docs/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
build
1+
build
2+
*.mo

Diff for: docs/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ pip3 install -r requirements.txt
1111
## 编译
1212

1313
```shell
14-
make SOURCEDIR=zh_CN html # 简体中文
15-
make SOURCEDIR=en html # English
14+
sphinx-build -b gettext ./en build/gettext
15+
sphinx-intl update -p ./build/gettext -l zh_CN
16+
sphinx-build -b html -D language=zh_CN ./en/ build/html/zh_CN # 简体中文
17+
sphinx-build -b html -D language=en ./en/ build/html/en # English
1618
```
1719

1820
## 预览
1921

20-
打开 build/zh_CN/html/index.html,即可在浏览器上预览。
22+
打开 build/html/zh_CN/index.html,即可在浏览器上预览。

Diff for: docs/en/COPYRIGHT.rst

+41-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
1-
COPYRIGHT
2-
==========
1+
************************
2+
Copyrights and Licenses
3+
************************
4+
5+
.. include:: ./refs/COPYRIGHT.ref
6+
7+
8+
Software Copyrights
9+
====================
10+
11+
All original source code in this repository is Copyright (C) 2023 M5Stack.
12+
This source code is licensed under the MIT license as described in the file LICENSE.
13+
14+
15+
Third Party
16+
============
17+
18+
* `micropython`_ Copyright (c) 2013-2023 Damien P. George and licensed under MIT License.
19+
* `umqtt`_ Copyright (c) 2013-2014 micropython-lib contributors and licensed under MIT License.
20+
* `urequests`_ Copyright (c) 2013-2014 micropython-lib contributors and licensed under MIT License.
21+
* `ir`_ Copyright (c) 2020 Peter Hinch and licensed under MIT License.
22+
* `neopixel`_ Copyright (c) 2013-2014 micropython-lib contributors and licensed under MIT License.
23+
* `bh1750fvi`_ Copyright (c) 2022 Sebastian Wicki and licensed under MIT License.
24+
* `bmp280`_ Copyright (c) 2020 Sebastian Wicki and licensed under MIT License.
25+
* `checksum`_ Copyright (c) 2022 Sebastian Wicki and licensed under MIT License.
26+
* `dht12`_ Copyright (c) 2020 Sebastian Wicki and licensed under MIT License.
27+
* `pcf8563`_ Copyright (c) 2020 Sebastian Wicki and licensed under MIT License.
28+
* `qmp6988`_ Copyright (c) 2022 Sebastian Wicki and licensed under MIT License.
29+
* `scd40`_ Copyright (c) 2022 Sebastian Wicki and licensed under MIT License.
30+
* `sgp30`_ Copyright (c) 2022 Sebastian Wicki and licensed under MIT License.
31+
* `sht4x`_ Copyright (c) 2021 ladyada for Adafruit and licensed under MIT License.
32+
* `vl53l0x`_ Copyright (c) 2017 Tony DiCola for Adafruit Industries and licensed under MIT License.
33+
* `camera`_ Copyright (c) 2021 Mauro Riva and licensed under Apache License Version 2.0.
34+
35+
36+
Documentation
37+
==============
38+
39+
* HTML version of API documentation uses the Sphinx theme sphinx_idf_theme,
40+
which is Copyright (c) 2013-2020 Dave Snider,
41+
Read the Docs. It is licensed under the MIT license.

Diff for: docs/en/conf.py

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
# This pattern also affects html_static_path and html_extra_path.
5050
exclude_patterns = []
5151

52+
# multi-language docs
53+
language = 'en'
54+
locale_dirs = ['../locales/']
55+
gettext_compact = False # optional.
56+
gettext_uuid = True # optional.
5257

5358
# -- Options for HTML output -------------------------------------------------
5459

Diff for: docs/en/controllers/cardputer.rst

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Cardputer
44

55
.. include:: ../refs/controllers.cardputer.ref
66

7+
78
**********
89
Startup UI
910
**********
@@ -17,6 +18,7 @@ Launcher
1718

1819
``Enter`` launches the selected application.
1920

21+
2022
Setting
2123
*******
2224

@@ -28,6 +30,7 @@ Setting
2830

2931
``BtnA`` quits the application.
3032

33+
3134
WLAN
3235
====
3336

@@ -39,6 +42,7 @@ WLAN
3942

4043
``BtnA`` quits the application.
4144

45+
4246
Gerneral
4347
========
4448

@@ -50,13 +54,15 @@ The ``FN`` + ``UP`` and ``FN`` + ``DOWN`` keys select menus.
5054

5155
``BtnA`` quits the application.
5256

57+
5358
Develop
5459
*******
5560

5661
|develop.png|
5762

5863
``BtnA`` quits the application.
5964

65+
6066
APP.RUN
6167
*******
6268

@@ -68,6 +74,7 @@ APP.RUN
6874

6975
``BtnA`` quits the application.
7076

77+
7178
APP.LIST
7279
********
7380

Diff for: docs/en/get-started/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Get Started
55

66
Currently UIFLOW2 supports the following boards:
77

8+
89
CORE
910
----
1011

@@ -30,6 +31,7 @@ CORE
3031
`Cardputer`_ `Core2 v1.1`_
3132
================== ================== ==================
3233

34+
3335
STICK
3436
-----
3537

Diff for: docs/en/hardware/button.rst

+213
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
Button
2+
======
3+
4+
.. include:: ../refs/system.ref
5+
.. include:: ../refs/hardware.button.ref
6+
7+
8+
Button is used to control the built-in buttons inside the host device. Below is
9+
the detailed Button support for the host:
10+
11+
.. table::
12+
:widths: auto
13+
:align: center
14+
15+
+-----------------+------+------+------+--------+--------+
16+
| | BtnA | BtnB | BtnC | BtnPWR | BtnEXT |
17+
+=================+======+======+======+========+========+
18+
| AtomS3 | |S| | | | | |
19+
+-----------------+------+------+------+--------+--------+
20+
| AtomS3 Lite | |S| | | | | |
21+
+-----------------+------+------+------+--------+--------+
22+
| AtomS3U | |S| | | | | |
23+
+-----------------+------+------+------+--------+--------+
24+
| StampS3 | |S| | | | | |
25+
+-----------------+------+------+------+--------+--------+
26+
| CoreS3 | | | | |S| | |
27+
+-----------------+------+------+------+--------+--------+
28+
| Core2 | |S| | |S| | |S| | | |
29+
+-----------------+------+------+------+--------+--------+
30+
| TOUGH | | | | | |
31+
+-----------------+------+------+------+--------+--------+
32+
33+
.. |S| unicode:: U+2714
34+
35+
36+
Micropython Example::
37+
38+
import os, sys, io
39+
import M5
40+
from M5 import *
41+
42+
def btnPWR_wasClicked_event(state):
43+
global label0
44+
label0.setText('clicked')
45+
46+
def btnPWR_wasHold_event(state):
47+
global label0
48+
label0.setText('hold')
49+
50+
M5.begin()
51+
Widgets.fillScreen(0x222222)
52+
label0 = Widgets.Label("Text", 58, 43, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu24)
53+
54+
BtnPWR.setCallback(type=BtnPWR.CB_TYPE.WAS_CLICKED, cb=btnPWR_wasClicked_event)
55+
BtnPWR.setCallback(type=BtnPWR.CB_TYPE.WAS_HOLD, cb=btnPWR_wasHold_event)
56+
57+
while True:
58+
M5.update()
59+
60+
61+
UIFLOW2 Example:
62+
63+
|example.svg|
64+
65+
66+
.. only:: builder_html
67+
68+
:download:`example.m5f2 <../../_static/hardware/button/example.m5f2>`
69+
70+
71+
class Button
72+
------------
73+
74+
.. important::
75+
76+
Methods of Button Class heavily rely on ``M5.begin()`` |M5.begin.svg| and ``M5.update()`` |M5.update.svg|.
77+
78+
All calls to methods of Button objects should be placed after ``M5.begin()`` |M5.begin.svg| and ``M5.update()`` |M5.update.svg| should be called in the main loop.
79+
80+
81+
Methods
82+
-------
83+
84+
.. method:: Button.isHolding()
85+
86+
Returns whether the Button object is in a long press state.
87+
88+
UIFLOW2:
89+
90+
|isHolding.svg|
91+
92+
93+
.. method:: Button.isPressed()
94+
95+
Returns whether the Button object is in a pressed state.
96+
97+
UIFLOW2:
98+
99+
|isPressed.svg|
100+
101+
102+
.. method:: Button.isReleased()
103+
104+
Returns whether the Button object is in a released state.
105+
106+
UIFLOW2:
107+
108+
|isReleased.svg|
109+
110+
111+
.. method:: Button.wasClicked()
112+
113+
Returns True when the Button object is briefly pressed and released.
114+
115+
UIFLOW2:
116+
117+
|wasClicked.svg|
118+
119+
120+
.. method:: Button.wasDoubleClicked()
121+
122+
Returns True when the Button object is double-clicked after a certain amount of time.
123+
124+
UIFLOW2:
125+
126+
|wasDoubleClicked.svg|
127+
128+
129+
.. method:: Button.wasHold()
130+
131+
Returns True when the Button object is held down for a certain amount of time.
132+
133+
UIFLOW2:
134+
135+
|wasHold.svg|
136+
137+
138+
.. method:: Button.wasPressed()
139+
140+
Returns True when the Button object is pressed.
141+
142+
UIFLOW2:
143+
144+
|wasPressed.svg|
145+
146+
147+
.. method:: Button.wasReleased()
148+
149+
Returns True when the Button object is released.
150+
151+
UIFLOW2:
152+
153+
|wasReleased.svg|
154+
155+
156+
.. method:: Button.wasSingleClicked()
157+
158+
Returns True when the Button object is single-clicked after a certain amount of time.
159+
160+
UIFLOW2:
161+
162+
|wasSingleClicked.svg|
163+
164+
165+
Event Handling
166+
--------------
167+
168+
.. method:: Button.setCallback(type:Callback_Type, cb)
169+
170+
Sets the event callback function.
171+
172+
UIFLOW2:
173+
174+
|setCallback.svg|
175+
176+
177+
Constants
178+
---------
179+
180+
.. data:: Button.CB_TYPE
181+
182+
A Callback_Type object.
183+
184+
185+
class Callback_Type
186+
-------------------
187+
188+
Constants
189+
---------
190+
191+
.. data:: Callback_Type.WAS_CLICKED
192+
193+
Single click event type.
194+
195+
196+
.. data:: Callback_Type.WAS_DOUBLECLICKED
197+
198+
Double click event type.
199+
200+
201+
.. data:: Callback_Type.WAS_HOLD
202+
203+
Long press event type.
204+
205+
206+
.. data:: Callback_Type.WAS_PRESSED
207+
208+
209+
Press event type
210+
211+
.. data:: Callback_Type.WAS_RELEASED
212+
213+
Release event type

0 commit comments

Comments
 (0)