MCPcopy
hub / github.com/InkTimeRecord/TTime / buildTranslateService

Function buildTranslateService

src/renderer/src/utils/translateServiceUtil.ts:95–121  ·  view source on GitHub ↗
(type: any)

Source from the content-addressed store, hash-verified

93}
94
95export const buildTranslateService = (type: any): {} => {
96 const info: {
97 name: string
98 // 是否需要秘钥
99 isKey: boolean
100 // 是否单秘钥
101 isOneAppKey: boolean
102 // 构建时默认信息
103 defaultInfo: object
104 // 翻译语言
105 languageList: []
106 } = TranslateServiceBuilder.getServiceConfigInfo(type)
107 if (isNull(info.defaultInfo)) {
108 info.defaultInfo = {}
109 }
110 if (info?.isKey) {
111 return ServiceConfig.buildKeyService({
112 type: type,
113 ...info.defaultInfo
114 })
115 } else {
116 return ServiceConfig.buildIsBuiltInService({
117 type: type,
118 ...info.defaultInfo
119 })
120 }
121}
122
123export class TranslateServiceBuilder {
124 /**

Callers

nothing calls this directly

Calls 2

isNullFunction · 0.90
getServiceConfigInfoMethod · 0.45

Tested by

no test coverage detected