Skip to content

Commit ffce18b

Browse files
committed
moving intl deeper into the toolkit
1 parent f35c252 commit ffce18b

File tree

26 files changed

+1967
-5371
lines changed

26 files changed

+1967
-5371
lines changed

packages/selenium-ide/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"react-dnd": "^16.0.1",
141141
"react-dnd-html5-backend": "^16.0.1",
142142
"react-dom": "^18.2.0",
143+
"react-intl": "^6.6.5",
143144
"react-resizable-panels": "^1.0.8",
144145
"scroll-into-view-if-needed": "^3.0.10",
145146
"selenium-webdriver": "^4.16.0",
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
import { Commands as commandMapEnglish } from '@seleniumhq/side-model'
2+
3+
const windowTabEnglish = {
4+
file: '&File',
5+
edit: '&Edit',
6+
view: '&View',
7+
help: '&Help',
8+
title: 'Project Editor',
9+
}
10+
11+
const electronMenuTreeEnglish = {
12+
about: 'About Electron',
13+
services: 'Services',
14+
hideElectron: 'Hide Electron',
15+
hideOthers: 'Hide Others',
16+
showAll: 'Show All',
17+
quit: 'Quit',
18+
}
19+
20+
const fileMenuTreeEnglish = {
21+
newProject: 'New Project',
22+
loadProject: 'Load Project',
23+
recentProjects: 'Recent Projects',
24+
saveProject: 'Save Project',
25+
saveProjectAs: 'Save Project As...',
26+
}
27+
28+
const editMenuTreeEnglish = {
29+
undo: 'Undo (for input)',
30+
redo: 'Redo (for input)',
31+
cut: 'Cut (for input)',
32+
copy: 'Copy (for input)',
33+
paste: 'Paste (for input)',
34+
}
35+
36+
const viewMenuTreeEnglish = {
37+
showDevTools: 'Show DevTools',
38+
resetPlaybackWindows: 'Reset Playback Windows',
39+
refreshPlaybackWindow: 'Refresh Playback Window',
40+
}
41+
42+
const helpMenuTreeEnglish = {
43+
dumpSession: 'Dump Session To File',
44+
}
45+
46+
const mainMenuEnglish = { tests: 'Tests', suites: 'Suites', config: 'Config' }
47+
48+
const configTabEnglish = {
49+
project: 'Project',
50+
system: 'System',
51+
outPut: 'outPut',
52+
}
53+
54+
const outPutConfigEnglish = {
55+
webLink: 'click to jump to the testing platform',
56+
platformUrl: 'test platform address',
57+
platformUrlHelper: 'The final use case is displayed on this front-end page',
58+
serviceHost: 'backend service address',
59+
serviceHostHelper:
60+
'export the address of the use case to the backend service',
61+
businessListUrl: 'business list url address',
62+
businessListUrlHelper:
63+
'url address of the business list to which the use case belongs',
64+
caseInBusiness: 'business to which the use case belongs',
65+
caseInBusinessHelper: 'test cases will be classified under this business',
66+
exportUrl: 'export interface url address',
67+
exportUrlHelper: 'export the url address of the test case',
68+
exportBtn: 'export',
69+
platformError: 'please enter the testing platform address!',
70+
checkUrlError:
71+
'please enter the backend service address and the url address for exporting the test case!',
72+
checkBusinessUrlError:
73+
'please check if the backend service address and the corresponding business list URL address are correct!',
74+
warn: 'warn',
75+
success: 'export success',
76+
fail: 'export fail',
77+
caseId: 'exported test case id:',
78+
failMessage: 'please contact the backend developer for assistance!',
79+
}
80+
81+
const systemConfigEnglish = {
82+
theme: 'Theme preference',
83+
themeHelper: 'restart required to take effect',
84+
commandInsert: 'New command insert preference',
85+
camelCase: 'Camel case various names in UI',
86+
ignoreErrors: 'Ignore Certificate/SSL errors',
87+
codeExport: 'Disable code export compatibility mode',
88+
bidi: 'Use Bidi',
89+
bidiHelper: 'Bidi settings (Experimental / Non working)',
90+
playbackBrowser: 'Selected Playback Browser',
91+
restartDriver: 'restart driver',
92+
}
93+
94+
const projectConfigEnglish = {
95+
name: 'name',
96+
stepTimeout: 'Step Timeout (MILLISECONDS)',
97+
stepTimeoutHelper: 'Steps will fail if they take longer than this setting',
98+
stepDelay: 'Step Delay (MILLISECONDS)',
99+
stepDelayHelper: 'Each step will pause by this setting',
100+
projectPlugins: 'Project Plugins',
101+
}
102+
103+
const suitesTabEnglish = {
104+
testInSuite: 'Tests in suite',
105+
dropTests: 'Drop Tests Here',
106+
AvailableTests: 'Available tests',
107+
name: 'Name',
108+
timeout: 'Timeout (MILLISECONDS)',
109+
parallel: 'Parallel',
110+
persistSession: 'Persist Session',
111+
dialogTitle: 'Please specify the new suite name',
112+
suiteName: 'Suite Name',
113+
cancel: 'Cancel',
114+
create: 'Create',
115+
deleteNotice: 'Delete this suite?',
116+
tooltip:
117+
'double click to modify the name,right click to export or delete suites',
118+
notDeleteNotice: 'only one suites is not allowed to be deleted!',
119+
noSuiteSelected: 'No Suite Selected',
120+
playSuite: 'Play Suite',
121+
deleteSuite: 'Delete suite(s)',
122+
exportSuite: 'Export suite(s) to ',
123+
}
124+
125+
const testsTabEnglish = {
126+
allTests: '[All tests]',
127+
deleteNotice: 'Delete this test?',
128+
tooltip:
129+
'double click to modify the name,right click to export or delete test case',
130+
notDeleteNotice: 'only one test case is not allowed to be deleted!',
131+
dialogTitle: 'Please specify the new test name',
132+
testName: 'Test Name',
133+
cancel: 'Cancel',
134+
create: 'Create',
135+
noTestSelected: 'No Test Selected',
136+
noCommandsSelected: 'No commands selected',
137+
add: 'Add',
138+
remove: 'Remove',
139+
deleteTest: 'Delete test(s)',
140+
exportTest: 'Export test(s) to ',
141+
}
142+
143+
const playbackEnglish = {
144+
content: 'This is where recording and playback will occur',
145+
windowSize:
146+
'Force panel window dimensions (will zoom out if larger than panel and crop if smaller)',
147+
width: 'W',
148+
height: 'H',
149+
url: 'URL',
150+
}
151+
152+
const splashEnglish = {
153+
present: 'Welcome to the Selenium IDE client',
154+
logPath: 'Your log file path:',
155+
openNotice: 'You can load or create one project',
156+
loadProject: 'load project',
157+
createProject: 'create project',
158+
openRecent: 'open recent',
159+
languageSelect: 'choose language',
160+
}
161+
162+
// 用例编辑页面
163+
const testCoreEnglish = {
164+
play: 'Play',
165+
stop: 'Stop',
166+
record: 'Record',
167+
pause: 'Pause',
168+
removeCommand: 'Remove Command',
169+
addCommand: 'Add Command',
170+
stepCommand: 'Command',
171+
openNewWindow: 'Opens a new window',
172+
notOpenNewWindow: 'Does not open a new window',
173+
enableCommand: 'Enable this command',
174+
disableCommand: 'Disable this command',
175+
comment: 'Comment',
176+
target: 'Target',
177+
value: 'Value',
178+
windowHandleName: 'Window Handle Name',
179+
windowHandleNameNote: 'Variable name to set to the new window handle',
180+
commands: 'Commands',
181+
tabCommand: 'Cmd',
182+
tabTarget: 'Target',
183+
tabValue: 'Value',
184+
cutCommand: 'Cut Command',
185+
copyCommand: 'Copy Command',
186+
pasteCommand: 'Paste Command',
187+
disableCommandSide: 'Disable Command',
188+
deleteCommand: 'Delete Command',
189+
appendCommand: 'Append Command',
190+
insertCommand: 'Insert Command',
191+
recordFromHere: 'Record From Here',
192+
playToHere: 'Play To Here',
193+
playFromHere: 'Play From Here',
194+
playThisStep: 'Play This Step',
195+
playFromStart: 'Play From Start',
196+
}
197+
198+
const langaugeMap = {
199+
windowTab: windowTabEnglish,
200+
electronMenuTree: electronMenuTreeEnglish,
201+
fileMenuTree: fileMenuTreeEnglish,
202+
editMenuTree: editMenuTreeEnglish,
203+
viewMenuTree: viewMenuTreeEnglish,
204+
helpMenuTree: helpMenuTreeEnglish,
205+
mainMenu: mainMenuEnglish,
206+
testsTab: testsTabEnglish,
207+
suitesTab: suitesTabEnglish,
208+
configTab: configTabEnglish,
209+
systemConfig: systemConfigEnglish,
210+
projectConfig: projectConfigEnglish,
211+
outPutConfig: outPutConfigEnglish,
212+
splash: splashEnglish,
213+
playback: playbackEnglish,
214+
testCore: testCoreEnglish,
215+
commandMap: commandMapEnglish,
216+
}
217+
218+
// Creating a type of this so other locales are prompted to be filled in by
219+
// the developer
220+
export type LanguageMap = typeof langaugeMap
221+
222+
export default langaugeMap
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import en, { LanguageMap } from './en'
2+
3+
const processOneLevel = (
4+
prefix: string,
5+
obj: LanguageMap
6+
): LanguageMap => {
7+
return Object.entries(obj).reduce((acc, [key, value]) => {
8+
const keyPath = `${prefix}.${key}`;
9+
if (typeof value === 'string') {
10+
// @ts-expect-error - we know this is a string
11+
acc[key] = keyPath;
12+
} else {
13+
// @ts-expect-error - we know this is an object
14+
acc[key] = processOneLevel(keyPath, value);
15+
}
16+
return acc;
17+
}, {} as LanguageMap);
18+
}
19+
20+
/**
21+
* Take this nested object, keep the shape, but make the final keys the dot delimited string
22+
* path of the nested key
23+
*/
24+
export default processOneLevel('en', en)

0 commit comments

Comments
 (0)