Skip to content

Commit

Permalink
chore: replace Chinese comments for English ones (#3552)
Browse files Browse the repository at this point in the history
* chore: remove Chinese comments

* chore: translate missing Chinese
  • Loading branch information
Wendell authored and vthinkxie committed Jun 22, 2019
1 parent 0566331 commit 4660690
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 71 deletions.
1 change: 0 additions & 1 deletion components/affix/affix.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ describe('affix', () => {

function setupInitialState(options: { offsetTop?: number } = {}): void {
componentObject.offsetYTo(componentObject.elementRef(), options.offsetTop || startOffset);
// 20ms显示器的重绘频率
tick(20);
fixture.detectChanges();
componentObject.emitScroll(window, 0);
Expand Down
4 changes: 2 additions & 2 deletions components/anchor/nz-anchor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export class NzAnchorComponent implements OnDestroy, AfterViewInit {
distinctUntilChanged()
)
.subscribe(() => this.handleScroll());
// 浏览器在刷新时保持滚动位置,会倒置在dom未渲染完成时计算不正确,因此延迟重新计算
// 与之相对应可能会引起组件移除后依然触发 `handleScroll` 的 `detectChanges`
// Browser would maintain the scrolling position when refreshing.
// So we have to delay calculation in avoid of getting a incorrect result.
setTimeout(() => this.handleScroll());
}

Expand Down
82 changes: 41 additions & 41 deletions components/cascader/nz-cascader.spec.ts

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions components/core/scroll/nz-scroll.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class NzScrollService {
this.doc = doc;
}

/** 设置 `el` 滚动条位置 */
/** Set the position of the scroll bar of `el`. */
setScrollTop(el: Element | Window, topValue: number = 0): void {
if (el === window) {
this.doc.body.scrollTop = topValue;
Expand All @@ -42,7 +42,7 @@ export class NzScrollService {
}
}

/** 获取 `el` 相对于视窗距离 */
/** Get position of `el` against window. */
getOffset(el: Element): { top: number; left: number } {
const ret = {
top: 0,
Expand All @@ -65,7 +65,7 @@ export class NzScrollService {
return ret;
}

/** 获取 `el` 滚动条位置 */
/** Get the position of the scoll bar of `el`. */
// TODO: remove '| Window' as the fallback already happens here
getScroll(el?: Element | Window, top: boolean = true): number {
const target = el ? el : window;
Expand All @@ -81,12 +81,12 @@ export class NzScrollService {
}

/**
* 使用动画形式将 `el` 滚动至某位置
* Scroll `el` to some position with animation.
*
* @param containerEl 容器,默认 `window`
* @param targetTopValue 滚动至目标 `top` 值,默认:0,相当于顶部
* @param easing 动作算法,默认:`easeInOutCubic`
* @param callback 动画结束后回调
* @param containerEl container, `window` by default
* @param targetTopValue Scroll to `top`, 0 by default
* @param easing Transition curve, `easeInOutCubic` by default
* @param callback callback invoked when transition is done
*/
scrollTo(containerEl: Element | Window, targetTopValue: number = 0, easing?: EasyingFn, callback?: () => void): void {
const target = containerEl ? containerEl : window;
Expand Down
2 changes: 1 addition & 1 deletion components/core/tree/nz-tree-base-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class NzTreeNode {
}

/**
* 支持按索引位置插入,叶子节点不可添加
* Support appending child nodes by position. Leaf node cannot be appended.
*/
// tslint:disable-next-line:no-any
public addChildren(children: any[], childPos: number = -1): void {
Expand Down
3 changes: 1 addition & 2 deletions components/core/tree/nz-tree-base.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ export class NzTreeBaseService implements OnDestroy {
*/
conductUp(node: NzTreeNode): void {
const parentNode = node.getParentNode();
// 全禁用节点不选中
if (parentNode) {
if (!isCheckDisabled(parentNode)) {
if (parentNode.children.every(child => isCheckDisabled(child) || (!child.isHalfChecked && child.isChecked))) {
Expand Down Expand Up @@ -487,7 +486,7 @@ export class NzTreeBaseService implements OnDestroy {
}
} else {
const targetIndex = this.rootNodes.indexOf(targetNode) + tIndex;
// 根节点插入
// Insert root node.
this.rootNodes.splice(targetIndex, 0, this.selectedNode);
this.rootNodes[targetIndex].parentNode = null;
this.rootNodes[targetIndex].level = 0;
Expand Down
1 change: 1 addition & 0 deletions components/form/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ input[type='checkbox'] {
text-align: center;
}

// 表单下的输入框尺寸唯一: 大尺寸
form {
.has-feedback {
.@{ant-prefix}-input {
Expand Down
1 change: 0 additions & 1 deletion components/i18n/languages/date-picker/et_EE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import CalendarLocale from '../calendar/et_EE';
import TimePickerLocale from '../time-picker/et_EE';

// 统一合并为完整的 Locale
const locale = {
lang: {
placeholder: 'Vali kuupäev',
Expand Down
1 change: 0 additions & 1 deletion components/i18n/languages/date-picker/sk_SK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import CalendarLocale from '../calendar/sk_SK';
import TimePickerLocale from '../time-picker/sk_SK';

// 统一合并为完整的 Locale
const locale = {
lang: {
placeholder: 'Vybrať dátum',
Expand Down
2 changes: 1 addition & 1 deletion components/tree/nz-tree-node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export class NzTreeNodeComponent implements OnInit, OnChanges, OnDestroy {
}

/**
* 监听拖拽事件
* Listening to dragging events.
*/
handDragEvent(): void {
this.ngZone.runOutsideAngular(() => {
Expand Down
11 changes: 3 additions & 8 deletions components/upload/demo/custom-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class NzDemoUploadCustomRequestComponent {
constructor(private http: HttpClient) {}

customReq = (item: UploadXHRArgs) => {
// 构建一个 FormData 对象,用于存储文件或其他参数
// Create a FormData here to store files and other parameters.
const formData = new FormData();
// tslint:disable-next-line:no-any
formData.append('file', item.file as any);
Expand All @@ -24,29 +24,26 @@ export class NzDemoUploadCustomRequestComponent {
reportProgress: true,
withCredentials: true
});
// 始终返回一个 `Subscription` 对象,nz-upload 会在适当时机自动取消订阅
// Always returns a `Subscription` object. nz-upload would automatically unsubscribe it at correct time.
return this.http.request(req).subscribe(
(event: HttpEvent<{}>) => {
if (event.type === HttpEventType.UploadProgress) {
if (event.total! > 0) {
// tslint:disable-next-line:no-any
(event as any).percent = (event.loaded / event.total!) * 100;
}
// 处理上传进度条,必须指定 `percent` 属性来表示进度
item.onProgress!(event, item.file!);
} else if (event instanceof HttpResponse) {
// 处理成功
item.onSuccess!(event.body, item.file!, event);
}
},
err => {
// 处理失败
item.onError!(err, item.file!);
}
);
};

// 一个简单的分片上传
// A simple sliced upload.
customBigReq = (item: UploadXHRArgs) => {
const size = item.file.size;
const chunkSize = parseInt(size / 3 + '', 10);
Expand All @@ -71,11 +68,9 @@ export class NzDemoUploadCustomRequestComponent {
});
return forkJoin(...reqs).subscribe(
() => {
// 处理成功
item.onSuccess!({}, item.file!, event);
},
err => {
// 处理失败
item.onError!(err, item.file!);
}
);
Expand Down
10 changes: 5 additions & 5 deletions components/upload/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import { Observable, Subscription } from 'rxjs';

import { IndexableObject } from 'ng-zorro-antd/core';

/** 状态 */
/** Status */
export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';

/** 上传方式 */
/** Uploading type. */
export type UploadType = 'select' | 'drag';

/** 上传列表的内建样式 */
/** Built-in styles of the uploading list. */
export type UploadListType = 'text' | 'picture' | 'picture-card';

/** 文件对象 */
/** File object. */
export interface UploadFile {
uid: string;
size: number;
Expand All @@ -45,7 +45,7 @@ export interface UploadChangeParam {
file: UploadFile;
fileList: UploadFile[];
event?: { percent: number };
/** 回调类型 */
/** Callback type. */
type?: string;
}

Expand Down

0 comments on commit 4660690

Please sign in to comment.