Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

处理模型实例国际化的问题 #7542

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions resources/language/default/property.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"common_property_bk_inst_name": "实例名",
"common_property_bk_inst_id": "实例ID",
"common_property_bk_created_at": "创建时间",
"common_property_bk_created_by": "创建人",
"common_property_bk_updated_at": "更新时间",
"common_property_bk_updated_by": "更新人",
"biz_property_bk_biz_name": "业务名",
"biz_property_life_cycle": "生命周期",
"biz_property_bk_biz_maintainer": "运维人员",
Expand Down
6 changes: 5 additions & 1 deletion resources/language/en/property.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"common_property_bk_inst_name": "Instance name",
"common_property_bk_inst_name": "Instance Name",
"common_property_bk_inst_id": "Instance ID",
"common_property_bk_created_at": "Created At",
"common_property_bk_created_by": "Created By",
"common_property_bk_updated_at": "Updated At",
"common_property_bk_updated_by": "Updated By",
"biz_property_bk_biz_name": "Business name",
"biz_property_life_cycle": "Lifecycle",
"biz_property_bk_biz_maintainer": "Maintainer",
Expand Down
12 changes: 10 additions & 2 deletions src/source_controller/coreservice/service/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,17 @@ func (s *coreService) TranslateInstName(defLang language.DefaultCCLanguageIf, ob
return util.FirstNotEmptyString(defLang.Language("inst_"+obj.ObjectID), obj.ObjectName, obj.ObjectID)
}

// TranslatePropertyName TODO
// TranslatePropertyName translate property name
func (s *coreService) TranslatePropertyName(defLang language.DefaultCCLanguageIf, att *metadata.Attribute) string {
return util.FirstNotEmptyString(defLang.Language(att.ObjectID+"_property_"+att.PropertyID), att.PropertyName,
var prefix string
switch att.PropertyID {
case common.BKInstNameField, common.BKCreatedAt, common.BKCreatedBy, common.BKUpdatedAt, common.BKUpdatedBy:
prefix = "common"
default:
prefix = att.ObjectID
}

return util.FirstNotEmptyString(defLang.Language(prefix+"_property_"+att.PropertyID), att.PropertyName,
att.PropertyID)
}

Expand Down