Skip to content

Commit c9ab15a

Browse files
committed
Update the docs for the Universal Translator API
1 parent a2f6e19 commit c9ab15a

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

seleniumbase/console_scripts/ReadMe.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,20 @@ See: http://www.katalon.com/automation-recorder
6666
``--ru`` / ``--Russian`` | ``--es`` / ``--Spanish``
6767

6868
* Actions:
69-
``-p`` / ``--print`` (Only print output. No changes to files.)
69+
``-p`` / ``--print`` (Print translation output to the screen)
7070
``-o`` / ``--overwrite`` (Overwrite the file being translated)
7171
``-c`` / ``--copy`` (Copy the translation to a new ``.py`` file)
7272

7373
* Output:
7474
Translates a SeleniumBase Python file into the language
7575
specified. Method calls and "import" lines get swapped.
7676
Both a language and an action must be specified.
77-
When running with ``-c`` (or ``--copy``) the new file name
77+
The ``-p`` action can be paired with one other action.
78+
When running with ``-c`` (or ``--copy``), the new file name
7879
will be the orginal name appended with an underscore
7980
plus the 2-letter language code of the new language.
80-
(Example: Translating ``test_1.py`` into Japanese with
81-
``-c`` will create a new file called ``test_1_ja.py``).
81+
(Example: Translating "test_1.py" into Japanese with
82+
``-c`` will create a new file called "test_1_ja.py".)
8283

8384

8485
### extract-objects

seleniumbase/console_scripts/run.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,19 @@ def show_translate_usage():
152152
print(" --ko / --Korean | --pt / --Portuguese")
153153
print(" --ru / --Russian | --es / --Spanish")
154154
print(" Actions:")
155-
print(" -p / --print (Only print output. No changes to files.)")
155+
print(" -p / --print (Print translation output to the screen)")
156156
print(" -o / --overwrite (Overwrite the file being translated)")
157157
print(" -c / --copy (Copy the translation to a new .py file)")
158158
print(" Output:")
159159
print(" Translates a SeleniumBase Python file into the language")
160160
print(' specified. Method calls and "import" lines get swapped.')
161161
print(" Both a language and an action must be specified.")
162-
print(' When running with "-c" (or "--copy") the new file name')
162+
print(' The "-p" action can be paired with one other action.')
163+
print(' When running with "-c" (or "--copy"), the new file name')
163164
print(' will be the orginal name appended with an underscore')
164165
print(" plus the 2-letter language code of the new language.")
165166
print(' (Example: Translating "test_1.py" into Japanese with')
166-
print(' "-c" will create a new file called "test_1_ja.py").')
167+
print(' "-c" will create a new file called "test_1_ja.py".)')
167168
print("")
168169

169170

seleniumbase/translate/translator.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
"""
2-
Translates a SeleniumBase Python file into a different language.
2+
Translates a SeleniumBase Python file into a different language
33
44
Usage:
5-
seleniumbase translate [SELENIUMBASE_FILE].py [LANGUAGE]
5+
seleniumbase translate [SB_FILE].py [LANGUAGE] [ACTION]
6+
Languages:
7+
--en / --English | --zh / --Chinese
8+
--nl / --Dutch | --fr / --French
9+
--it / --Italian | --ja / --Japanese
10+
--ko / --Korean | --pt / --Portuguese
11+
--ru / --Russian | --es / --Spanish
12+
Actions:
13+
-p / --print (Print translation output to the screen)
14+
-o / --overwrite (Overwrite the file being translated)
15+
-c / --copy (Copy the translation to a new .py file)
616
Output:
717
Translates a SeleniumBase Python file into the language
818
specified. Method calls and "import" lines get swapped.
919
Both a language and an action must be specified.
10-
When running with "-c" (or "--copy") the new file name
20+
The "-p" action can be paired with one other action.
21+
When running with "-c" (or "--copy"), the new file name
1122
will be the orginal name appended with an underscore
1223
plus the 2-letter language code of the new language.
1324
(Example: Translating "test_1.py" into Japanese with
14-
"-c" will create a new file called "test_1_ja.py").
25+
"-c" will create a new file called "test_1_ja.py".)
1526
"""
1627

17-
# import codecs
28+
import codecs
1829
import colorama
19-
# import os
2030
import re
2131
import sys
2232
from seleniumbase.translate import master_dict
@@ -36,18 +46,19 @@ def invalid_run_command(msg=None):
3646
exp += " --ko / --Korean | --pt / --Portuguese\n"
3747
exp += " --ru / --Russian | --es / --Spanish\n"
3848
exp += " Actions:\n"
39-
exp += " -p / --print (Only print output. No changes to files.)\n"
49+
exp += " -p / --print (Print translation output to the screen)\n"
4050
exp += " -o / --overwrite (Overwrite the file being translated)\n"
4151
exp += " -c / --copy (Copy the translation to a new .py file)\n"
4252
exp += " Output:\n"
4353
exp += " Translates a SeleniumBase Python file into the language\n"
4454
exp += ' specified. Method calls and "import" lines get swapped.\n'
4555
exp += " Both a language and an action must be specified.\n"
46-
exp += ' When running with "-c" (or "--copy") the new file name\n'
56+
exp += ' The "-p" action can be paired with one other action.\n'
57+
exp += ' When running with "-c" (or "--copy"), the new file name\n'
4758
exp += ' will be the orginal name appended with an underscore\n'
4859
exp += " plus the 2-letter language code of the new language.\n"
4960
exp += ' (Example: Translating "test_1.py" into Japanese with\n'
50-
exp += ' "-c" will create a new file called "test_1_ja.py").\n'
61+
exp += ' "-c" will create a new file called "test_1_ja.py".)\n'
5162
if not msg:
5263
raise Exception('INVALID RUN COMMAND!\n\n%s' % exp)
5364
else:

0 commit comments

Comments
 (0)