Skip to content

Commit d0cb614

Browse files
committed
feat: turbo后台信息国际化 TencentBlueKing#86
1 parent 98ecbb8 commit d0cb614

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/service/TurboEngineConfigService.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,20 @@ class TurboEngineConfigService @Autowired constructor(
319319
paramConfig = paramConfig?.map {
320320
ParamConfigModel(
321321
paramKey = it.paramKey,
322-
paramName = it.paramName,
322+
paramName = I18NUtil.getMessage("$engineCode.paramConfig.${it.paramKey}.paramName"),
323323
paramType = it.paramType,
324324
paramProps = it.paramProps,
325325
paramEnum = it.paramEnum?.map { paramEnumEntity ->
326+
val paramName = I18NUtil.getMessage("$engineCode.paramConfig.${it.paramKey
327+
}.paramEnum.${paramEnumEntity.paramValue}")
326328
ParamEnumModel(
327329
paramValue = paramEnumEntity.paramValue,
328330
paramName = paramEnumEntity.paramName,
329331
visualRange = paramEnumEntity.visualRange
330332
)
331333
},
332-
tips = it.tips,
334+
tips = if (!it.tips.isNullOrBlank()) I18NUtil.getMessage("$engineCode.paramConfig.${it
335+
.paramKey}.tips") else it.tips,
333336
displayed = it.displayed,
334337
defaultValue = it.defaultValue,
335338
required = it.required
@@ -587,10 +590,12 @@ class TurboEngineConfigService @Autowired constructor(
587590
paramEnumEntity.visualRange.isNullOrEmpty() ||
588591
paramEnumEntity.visualRange.contains(projectId)
589592
}?.map { paramEnumEntity ->
593+
// 兼容部分无需国际化的值
594+
val paramName = I18NUtil.getMessage("${it.engineCode}.paramConfig.${param.paramKey
595+
}.paramEnum.${paramEnumEntity.paramValue}")
590596
ParamEnumModel(
591597
paramValue = paramEnumEntity.paramValue,
592-
paramName = I18NUtil.getMessage("${it.engineCode}.paramConfig.${param.paramKey
593-
}.paramEnum.${paramEnumEntity.paramValue}"),
598+
paramName = if (I18NUtil.ERROR == paramName) paramEnumEntity.paramName else paramName,
594599
visualRange = paramEnumEntity.visualRange
595600
)
596601
},

0 commit comments

Comments
 (0)