Skip to content

Commit 0540e62

Browse files
committed
feat: i18n adaption
1 parent a58f930 commit 0540e62

18 files changed

Lines changed: 31 additions & 103 deletions

File tree

.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
"UPPER_CASE",
4646
"PascalCase"
4747
],
48-
"leadingUnderscore": "allow", // 变量名以 _ 开头
49-
"trailingUnderscore": "forbid" // 变量名以 _ 结尾
48+
"leadingUnderscore": "allow",
49+
"trailingUnderscore": "forbid"
5050
},
5151
{
5252
"selector": "parameter",

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Script 小程序
1+
# Script
22

3-
通过编写简短的脚本,来减少重复任务所花费的时间,实现快捷的自定义能力
3+
Reduce the time spent on heavy tasks by writing simple scripts, and realize fast and fast customization capabilities

src/bundler/plugins/unpkg-path-plugin.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ export const unpkgPathPlugin = (inputCode: string) => {
77
return {
88
name: 'unpkg-path-plugin',
99
setup(build: esbuild.PluginBuild) {
10-
// 处理入口文件
10+
// process the entry file
1111
build.onResolve({ filter: /(^index\.js$)/ }, (args: any) => {
1212
return {
1313
path: 'index.js',
1414
namespace: RESOLVE_NAMESPACE
1515
};
1616
});
1717

18-
// 处理相对路径
18+
// handle relative paths
1919
build.onResolve({ filter: /^\.+\// }, (args: any) => {
2020
const url = new URL(args.path, `${CDN_URL}${args.resolveDir}/`)
2121

@@ -25,7 +25,7 @@ export const unpkgPathPlugin = (inputCode: string) => {
2525
};
2626
});
2727

28-
// 处理引入的文件
28+
// process imported files
2929
build.onResolve({ filter: /.*/ }, async (args: any) => {
3030
return {
3131
namespace: RESOLVE_NAMESPACE,

src/components/container/container.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ export const Container: FC = () => {
4949
defaultSizes={ATTACH_PANEL_DEFAULT_SIZES}
5050
className={'allotment'}
5151
>
52-
{/* 代码编辑器 */}
5352
<Allotment.Pane minSize={EDITOR_PANEL_MIN_HEIGHT}>
5453
<EditorPanel
5554
code={inputCode}
5655
onChange={(value) => setInputCode(value)}
5756
/>
5857
</Allotment.Pane>
5958

60-
{/* API 文档 */}
6159
<Allotment.Pane
6260
minSize={ATTACH_PANEL_MIN_HEIGHT}
6361
maxSize={isDocumentPaneOpen ? ATTACH_PANEL_MAX_HEIGHT : ATTACH_PANEL_MIN_HEIGHT}
@@ -74,7 +72,6 @@ export const Container: FC = () => {
7472
onVisibleChange={function noRefCheck() {}}
7573
defaultSizes={ATTACH_PANEL_DEFAULT_SIZES}
7674
>
77-
{/* 预览区 */}
7875
<Allotment.Pane>
7976
<div
8077
style={{
@@ -90,7 +87,6 @@ export const Container: FC = () => {
9087
</div>
9188
</Allotment.Pane>
9289

93-
{/* console 面板 */}
9490
<Allotment.Pane
9591
minSize={ATTACH_PANEL_MIN_HEIGHT}
9692
maxSize={isConsolePaneOpen ? ATTACH_PANEL_MAX_HEIGHT : ATTACH_PANEL_MIN_HEIGHT}

src/components/editor_panel/editor_panel.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export const EditorPanel = (props) => {
7171
onMount={onEditorDidMount}
7272
loading={<Loading />}
7373
options={{
74-
// 迷你地图
7574
minimap: {
7675
enabled: false,
7776
},

src/render_components/components/button/styled.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ export const ButtonBase = styled.button.attrs(applyDefaultTheme) <IButtonBasePro
183183
activeBgColor = getColor(btnColor).jellyActive || getActiveColor(bgColor);
184184
break;
185185
}
186-
// 禁用状态下,都是 hover 和 active 没反应。
187186
if (props.disabled) {
188187
hoverBgColor = bgColor;
189188
activeBgColor = bgColor;

src/render_components/components/input/input.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ const InputWrapper = styled.div.attrs(applyDefaultTheme)<IInputWrapperProps>`
6161
border-color: ${focusBorderColor};
6262
background-color: ${background.primary};
6363
}
64-
// 错误状态
6564
${error && css`
6665
&.error {
6766
border-color: ${palette.danger};

src/render_components/components/list_deprecate/interface.ts

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,35 @@
11
import { IUseListenTriggerInfo } from './use_listen_visual_height';
2-
import { HTMLAttributes, ReactElement, ReactNode } from 'react';
2+
import React, { HTMLAttributes, ReactElement, ReactNode } from 'react';
33

44
export interface IListDeprecateProps {
5-
65
/**
7-
* @description 每个选项包裹的组件,
8-
* 也就是绑定在 CommonList 组件上的静态组件
9-
* @type {ReactElement[]}
6+
* Child element
107
*/
118
children: ReactElement[];
129

1310
/**
14-
* @description 点击每个选项的处理函数
15-
* @param {(React.MouseEvent | null)} e
16-
* @param {number} index
11+
* click handler
1712
*/
1813
onClick(e: React.MouseEvent | null, index: number): void
1914

2015
/**
21-
* @description 没有数据时的提示
16+
* Tips when data is empty
2217
*/
2318
noDataTip?: string | (() => ReactNode)
2419

2520
/**
26-
* @description 组件底部区域的选软组件
21+
* Footer components
2722
*/
2823
footerComponent?: () => ReactNode;
2924

3025
className?: string;
3126
style?: React.CSSProperties
3227

3328
/**
34-
* @description 当前正在聚焦的 item 的位置,原本这个参数由组件内部控制,但是在 draft 中,需要维护编辑器自己的 index,因此需要像组件内部传入
35-
* @type {number}
29+
* The position of the item currently being focused
3630
*/
3731
activeIndex?: number
3832

39-
/**
40-
*
41-
*/
4233
searchProps?: ISearchProps
4334

4435
triggerInfo?: IUseListenTriggerInfo;
@@ -49,16 +40,12 @@ export interface IListDeprecateProps {
4940
export interface IListItemProps extends HTMLAttributes<HTMLDivElement> {
5041

5142
/**
52-
* @description 当前选项的下标
53-
* @type {number}
43+
* Current option index
5444
*/
5545
currentIndex: number;
5646

5747
/**
58-
* @description 在选项排序的时候会需要包裹一层其他的组件,但是对于内部不好处理
59-
* 所以可以通过这个属性传入一个包裹的函数
60-
* @param {*} children
61-
* @returns {ReactNode}
48+
* Wrapper component
6249
*/
6350
wrapperComponent?(children: ReactNode): ReactNode
6451

@@ -67,32 +54,29 @@ export interface IListItemProps extends HTMLAttributes<HTMLDivElement> {
6754

6855
export interface ISearchProps {
6956
/**
70-
* @description 给 Input 组件绑定的引用,用来 focus
71-
* @type {React.RefObject<IInputRef>}
57+
* Input reference
7258
*/
7359
inputRef?: React.RefObject<HTMLInputElement>;
7460

7561
/**
76-
* @description 自定义输入框的样式
77-
* @type {React.CSSProperties}
62+
* Custom inline styles
7863
*/
7964
style?: React.CSSProperties
8065

8166
/**
82-
* @description input 的提示语
83-
* @type {string}
67+
* Input placeholder
8468
*/
8569
placeholder?: string
8670

8771
/**
88-
* @description input 按下 Enter 键的回调函数
89-
* @param {() => void} clearKeyword 组件内部传入的处理函数,可以在这里处理一些组件内部的操作
90-
* 比如清除输入框内的数据
72+
* @description input enter event callback
73+
* @param {() => void} clearKeyword is the processing function passed in from the component,
74+
* where you can process some operations inside the component
9175
*/
9276
onInputEnter?(clearKeyword: () => void): void
9377

9478
/**
95-
* @description 输入内容后的回调
79+
* @description Search input callback
9680
* @param {React.ChangeEvent} e
9781
* @param {string} keyword
9882
*/

src/render_components/components/list_deprecate/line_search_input/line_search_input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const LineSearchInputBase: React.ForwardRefRenderFunction<{}, ILineSearch
4646
onFocus={onFocus}
4747
onChange={onChange}
4848
value={value}
49-
placeholder={placeholder || '搜索'}
49+
placeholder={placeholder || 'Search'}
5050
size={1}
5151
/>
5252
<SuffixIcon onClick={onCancelClick}>

src/render_components/components/list_deprecate/list.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { FootWrapper, ResultSpan, StyledListItem, StyledListWrapper, WrapperDiv
99

1010
export const ListDeprecate: React.FC<IListDeprecateProps> & { Item: React.FC<IListItemProps> } = (props) => {
1111
const {
12-
children, noDataTip = '空数据', activeIndex: DraftActiveIndex,
12+
children, noDataTip = 'Empty', activeIndex: DraftActiveIndex,
1313
footerComponent, onClick, className,
1414
searchProps, triggerInfo, autoHeight = false
1515
} = props;
@@ -120,11 +120,9 @@ export const ListDeprecate: React.FC<IListDeprecateProps> & { Item: React.FC<ILi
120120
onKeyDown={keydownForContainer}
121121
className={className}
122122
>
123-
{/* 搜索部分 */}
124123
{
125124
searchProps && <ListSearch setKeyword={setKeyword} keyword={keyword} {...searchProps} />
126125
}
127-
{/* 列表部分 */}
128126
{
129127
(showNoDataTip || showNoSearchResult) && <ResultSpan>
130128
{

0 commit comments

Comments
 (0)