-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dop): issue excel title support i18n (#6085)
* ExportExcelIssueRequest add ExportType (byFilter/full) * excel title support i18n * remove useless UpdatedAt field in excel * skip unknown common fields * no need to check projectIssueTotalNum, use exportType directly * polish code * fix start error by issue-excel.yaml
- Loading branch information
Showing
20 changed files
with
362 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
zh: | ||
# Common | ||
Common: 通用字段 | ||
ID: ID | ||
IterationName: 迭代 | ||
IssueType: 类型 | ||
IssueTitle: 标题 | ||
Content: 内容 | ||
State: 状态 | ||
Priority: 优先级 | ||
Complexity: 复杂度 | ||
Severity: 严重程度 | ||
CreatorName: 创建人 | ||
AssigneeName: 处理人 | ||
CreatedAt: 创建时间 | ||
PlanStartedAt: 计划开始时间 | ||
PlanFinishedAt: 计划结束时间 | ||
StartAt: 实际开始时间 | ||
FinishAt: 实际结束时间 | ||
EstimateTime: 预估耗时 | ||
Labels: 标签 | ||
ConnectionIssueIDs: 关联事项ID列表 | ||
CustomFields: 自定义字段 | ||
|
||
# RequirementOnly | ||
RequirementOnly: 需求专属字段 | ||
InclusionIssueIDs: 待办事项ID列表 | ||
|
||
# TaskOnly | ||
TaskOnly: 任务专属字段 | ||
TaskType: 任务类型 | ||
|
||
# BugOnly | ||
BugOnly: 缺陷专属字段 | ||
OwnerName: 负责人 | ||
Source: 来源 | ||
ReopenCount: 重开次数 | ||
|
||
en: # use key directly | ||
Common: Common # need this line to pass i18n provider validation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
internal/apps/dop/providers/issue/core/query/issueexcel/sheets/sheet_issue/field.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// Copyright (c) 2021 Terminus, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package sheet_issue | ||
|
||
import ( | ||
"github.com/erda-project/erda-infra/providers/i18n" | ||
"github.com/erda-project/erda/internal/apps/dop/providers/issue/core/query/issueexcel/vars" | ||
) | ||
|
||
const ( | ||
// Common | ||
fieldCommon = "Common" | ||
fieldID = "ID" | ||
fieldIterationName = "IterationName" | ||
fieldIssueType = "IssueType" | ||
fieldIssueTitle = "IssueTitle" | ||
fieldContent = "Content" | ||
fieldState = "State" | ||
fieldPriority = "Priority" | ||
fieldComplexity = "Complexity" | ||
fieldSeverity = "Severity" | ||
fieldCreatorName = "CreatorName" | ||
fieldAssigneeName = "AssigneeName" | ||
fieldCreatedAt = "CreatedAt" | ||
fieldPlanStartedAt = "PlanStartedAt" | ||
fieldPlanFinishedAt = "PlanFinishedAt" | ||
fieldStartAt = "StartAt" | ||
fieldFinishAt = "FinishAt" | ||
fieldEstimateTime = "EstimateTime" | ||
fieldLabels = "Labels" | ||
fieldConnectionIssueIDs = "ConnectionIssueIDs" | ||
fieldCustomFields = "CustomFields" | ||
|
||
// RequirementOnly | ||
fieldRequirementOnly = "RequirementOnly" | ||
fieldInclusionIssueIDs = "InclusionIssueIDs" | ||
|
||
// TaskOnly | ||
fieldTaskOnly = "TaskOnly" | ||
fieldTaskType = "TaskType" | ||
|
||
// BugOnly | ||
fieldBugOnly = "BugOnly" | ||
fieldOwnerName = "OwnerName" | ||
fieldSource = "Source" | ||
fieldReopenCount = "ReopenCount" | ||
) | ||
|
||
var excelFields = []string{ | ||
// Common | ||
fieldCommon, | ||
fieldID, | ||
fieldIterationName, | ||
fieldIssueType, | ||
fieldIssueTitle, | ||
fieldContent, | ||
fieldState, | ||
fieldPriority, | ||
fieldComplexity, | ||
fieldSeverity, | ||
fieldCreatorName, | ||
fieldAssigneeName, | ||
fieldCreatedAt, | ||
fieldPlanStartedAt, | ||
fieldPlanFinishedAt, | ||
fieldStartAt, | ||
fieldFinishAt, | ||
fieldEstimateTime, | ||
fieldLabels, | ||
fieldConnectionIssueIDs, | ||
fieldCustomFields, | ||
|
||
// RequirementOnly | ||
fieldRequirementOnly, | ||
fieldInclusionIssueIDs, | ||
|
||
// TaskOnly | ||
fieldTaskOnly, | ||
fieldTaskType, | ||
|
||
// BugOnly | ||
fieldBugOnly, | ||
fieldOwnerName, | ||
fieldSource, | ||
fieldReopenCount, | ||
} | ||
|
||
var ( | ||
i18nMapByText = make(map[string]string) | ||
) | ||
|
||
func InitI18nMap(data *vars.DataForFulfill) { | ||
for _, key := range excelFields { | ||
i18nMapByText[key] = key // self | ||
// en-US | ||
enLang, _ := i18n.ParseLanguageCode("en-US") | ||
i18nMapByText[data.Tran.Text(enLang, key)] = key | ||
// zh-CN | ||
zhLang, _ := i18n.ParseLanguageCode("zh-CN") | ||
i18nMapByText[data.Tran.Text(zhLang, key)] = key | ||
} | ||
} |
Oops, something went wrong.