Skip to content

Commit ae84b01

Browse files
committed
Update the docs
1 parent 49fa8f4 commit ae84b01

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

examples/translations/ReadMe.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Russian / Русский
1515
* Spanish / Español
1616

17+
Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>].
18+
1719
Multi-language tests are run with **pytest** like any other test. Every test method has a one-to-one mapping to every other supported language.<br /><i>Examples:</i>
1820
```
1921
self.开启网址(URL) <=> self.open(URL)

help_docs/translations.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/README.md"><img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_m.png" title="SeleniumBase" height="48" /></a></h3>
2+
3+
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3.png" title="SeleniumBase" height="32"> Multi-Language Tests (Python 3 Only!)
4+
5+
**SeleniumBase** supports the following 10 languages:
6+
* English
7+
* Chinese / 中文
8+
* Dutch / Nederlands
9+
* French / Français
10+
* Italian / Italiano
11+
* Japanese / 日本語
12+
* Korean / 한국어
13+
* Portuguese / Português
14+
* Russian / Русский
15+
* Spanish / Español
16+
17+
Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>].
18+
19+
Multi-language tests are run with **pytest** like any other test. Every test method has a one-to-one mapping to every other supported language.<br /><i>Examples:</i>
20+
```
21+
self.开启网址(URL) <=> self.open(URL)
22+
self.нажмите(SELECTOR) <=> self.click(SELECTOR)
23+
```
24+
25+
--------
26+
27+
You can use SeleniumBase to translate any test from one language to another by using the console scripts interface:
28+
29+
```bash
30+
seleniumbase translate
31+
```
32+
33+
```
34+
* Usage:
35+
seleniumbase translate [SB_FILE].py [LANGUAGE] [ACTION]
36+
37+
* Languages:
38+
``--en`` / ``--English`` | ``--zh`` / ``--Chinese``
39+
``--nl`` / ``--Dutch`` | ``--fr`` / ``--French``
40+
``--it`` / ``--Italian`` | ``--ja`` / ``--Japanese``
41+
``--ko`` / ``--Korean`` | ``--pt`` / ``--Portuguese``
42+
``--ru`` / ``--Russian`` | ``--es`` / ``--Spanish``
43+
44+
* Actions:
45+
``-p`` / ``--print`` (Print translation output to the screen)
46+
``-o`` / ``--overwrite`` (Overwrite the file being translated)
47+
``-c`` / ``--copy`` (Copy the translation to a new ``.py`` file)
48+
49+
* Examples:
50+
Translate test_1.py into Chinese and only print the output:
51+
>>> seleniumbase translate test_1.py --zh -p
52+
Translate test_2.py into Portuguese and overwrite the file:
53+
>>> seleniumbase translate test_2.py --pt -o
54+
Translate test_3.py into Dutch and make a copy of the file:
55+
>>> seleniumbase translate test_3.py --nl -c
56+
57+
* Output:
58+
Translates a SeleniumBase Python file into the language
59+
specified. Method calls and ``import`` lines get swapped.
60+
Both a language and an action must be specified.
61+
The ``-p`` action can be paired with one other action.
62+
When running with ``-c`` (or ``--copy``) the new file name
63+
will be the orginal name appended with an underscore
64+
plus the 2-letter language code of the new language.
65+
(Example: Translating ``test_1.py`` into Japanese with
66+
``-c`` will create a new file called ``test_1_ja.py``.)
67+
```

0 commit comments

Comments
 (0)