feat: i18n

This commit is contained in:
ZacharyZcR
2025-02-07 13:10:06 +08:00
parent eb8cda3b7f
commit 3dde342d65
10 changed files with 1297 additions and 220 deletions
+6 -8
View File
@@ -1,7 +1,5 @@
package Common
import "fmt"
// 扫描模式常量 - 使用大写开头表示这是一个预设的扫描模式
const (
ModeAll = "All" // 全量扫描
@@ -48,7 +46,7 @@ var PluginGroups = map[string][]string{
// ParseScanMode 解析扫描模式
func ParseScanMode(mode string) {
LogInfo(fmt.Sprintf("解析扫描模式: %s", mode))
LogInfo(GetText("parse_scan_mode", mode))
// 检查是否是预设模式
presetModes := []string{
@@ -60,9 +58,9 @@ func ParseScanMode(mode string) {
if mode == presetMode {
ScanMode = mode
if plugins := GetPluginsForMode(mode); plugins != nil {
LogInfo(fmt.Sprintf("使用预设模式: %s, 包含插件: %v", mode, plugins))
LogInfo(GetText("using_preset_mode_plugins", mode, plugins))
} else {
LogInfo(fmt.Sprintf("使用预设模式: %s", mode))
LogInfo(GetText("using_preset_mode", mode))
}
return
}
@@ -71,14 +69,14 @@ func ParseScanMode(mode string) {
// 检查是否是有效的插件名
if _, exists := PluginManager[mode]; exists {
ScanMode = mode
LogInfo(fmt.Sprintf("使用单个插件: %s", mode))
LogInfo(GetText("using_single_plugin", mode))
return
}
// 默认使用All模式
ScanMode = ModeAll
LogInfo(fmt.Sprintf("未识别的模式,使用默认模式: %s", ModeAll))
LogInfo(fmt.Sprintf("包含插件: %v", PluginGroups[ModeAll]))
LogInfo(GetText("using_default_mode", ModeAll))
LogInfo(GetText("included_plugins", PluginGroups[ModeAll]))
}
// GetPluginsForMode 获取指定模式下的插件列表