1
1
"""
2
- Translates a SeleniumBase Python file into a different language.
2
+ Translates a SeleniumBase Python file into a different language
3
3
4
4
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)
6
16
Output:
7
17
Translates a SeleniumBase Python file into the language
8
18
specified. Method calls and "import" lines get swapped.
9
19
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
11
22
will be the orginal name appended with an underscore
12
23
plus the 2-letter language code of the new language.
13
24
(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".)
15
26
"""
16
27
17
- # import codecs
28
+ import codecs
18
29
import colorama
19
- # import os
20
30
import re
21
31
import sys
22
32
from seleniumbase .translate import master_dict
@@ -36,18 +46,19 @@ def invalid_run_command(msg=None):
36
46
exp += " --ko / --Korean | --pt / --Portuguese\n "
37
47
exp += " --ru / --Russian | --es / --Spanish\n "
38
48
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 "
40
50
exp += " -o / --overwrite (Overwrite the file being translated)\n "
41
51
exp += " -c / --copy (Copy the translation to a new .py file)\n "
42
52
exp += " Output:\n "
43
53
exp += " Translates a SeleniumBase Python file into the language\n "
44
54
exp += ' specified. Method calls and "import" lines get swapped.\n '
45
55
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 '
47
58
exp += ' will be the orginal name appended with an underscore\n '
48
59
exp += " plus the 2-letter language code of the new language.\n "
49
60
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 '
51
62
if not msg :
52
63
raise Exception ('INVALID RUN COMMAND!\n \n %s' % exp )
53
64
else :
0 commit comments