(value: KeyConfig)
| 67 | } |
| 68 | |
| 69 | function googleCheck(value: KeyConfig): CheckResult { |
| 70 | const invalidKeys = getInvalidStringKeys(value); |
| 71 | if (invalidKeys.length > 0) { |
| 72 | const reason = `字段类型无效: ${invalidKeys.join(", ")}`; |
| 73 | return { canSave: false, canEnable: false, saveReason: reason, enableReason: reason }; |
| 74 | } |
| 75 | const source = value.source; |
| 76 | if (is_empty_string(source)) { |
| 77 | return { |
| 78 | canSave: false, |
| 79 | canEnable: false, |
| 80 | saveReason: "翻译源不能为空", |
| 81 | enableReason: "翻译源不能为空", |
| 82 | }; |
| 83 | } |
| 84 | if (!googleSourceOptions.includes(source as GoogleSource)) { |
| 85 | return { |
| 86 | canSave: false, |
| 87 | canEnable: false, |
| 88 | saveReason: "翻译源无效", |
| 89 | enableReason: "翻译源无效", |
| 90 | }; |
| 91 | } |
| 92 | return { canSave: true, canEnable: true }; |
| 93 | } |
| 94 | |
| 95 | // 检查是否全空或全填写 |
| 96 | function emptyOrAllCheck(value: KeyConfig): CheckResult { |
nothing calls this directly
no test coverage detected