Skip to content

Commit

Permalink
Merge pull request #7542 from ZQHcode/v3.12.x-fix-field
Browse files Browse the repository at this point in the history
处理模型实例国际化的问题
  • Loading branch information
ZQHcode authored Nov 9, 2023
2 parents 64b6dbc + d9c9840 commit d00b23f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
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

0 comments on commit d00b23f

Please sign in to comment.