local NS = rawget(_G, "MCDVoiceCooldownNS") or {}
_G.MCDVoiceCooldownNS = NS

local rawLocale = (type(GetLocale) == "function" and GetLocale()) or "enUS"
local activeLocale = (rawLocale == "zhCN" and "zhCN") or (rawLocale == "zhTW" and "zhTW") or "enUS"
NS.LOCALE = activeLocale

local enUS = {
    ADDON_DISPLAY_NAME = "MCD Fixed Cooldown Voice Alert",
    ADDON_SHORT_NAME = "CD Voice Alert",
    OPTION_NAME = "MCD Fixed Cooldown Voice Alert",
    AUTHOR_LINE = "Author: zhufei1000",
    OPTIONS_DESC = "Fixed-cooldown spell voice alerts: records successful casts via UNIT_SPELLCAST_SUCCEEDED, times cooldowns by the fixed CD you enter, and plays TTS or voice files when cooldowns finish, casts succeed, or Bloodlust is triggered.\n\nClick the button below to open the main settings window. You can also use /mcd or the minimap icon.",
    OPEN_MAIN_SETTINGS = "Open main settings",
    COMMANDS = "Commands: /mcd or /mcdtts",

    BTN_ADD_VOICE = "Add Voice", BTN_ADD_COLLECTION = "Add Group", BTN_EDIT = "Edit", BTN_DELETE = "Delete", BTN_REFRESH = "Refresh", BTN_IMPORT = "Import", BTN_EXPORT_FULL = "Export All", BTN_SAVE = "Save", BTN_TEST = "Test", BTN_CLOSE = "Close", BTN_SELECT_ALL = "Select All",
    TITLE_NEW_CONFIG = "New Alert", TITLE_EDIT_CONFIG = "Edit Alert", TITLE_BLOODLUST_SETTINGS = "Bloodlust Alert Settings", TITLE_ADD_COLLECTION = "New Group", TITLE_RENAME_COLLECTION = "Rename Group", TITLE_IMPORT_EXPORT = "Import / Export", TITLE_EXPORT = "Export", TITLE_IMPORT_SETTINGS = "Import Settings", EXPORT_ENTRY = "Export Alert", EXPORT_COLLECTION = "Export Group", DELETE_ENTRY = "Delete Alert", EDIT_ENTRY = "Edit Alert", DELETE_COLLECTION_WITH_ITEMS = "Delete group and alerts", EXPAND_COLLECTION = "Expand Group", COLLAPSE_COLLECTION = "Collapse Group", RENAME_COLLECTION = "Rename Group", EXPORT_FULL_TITLE = "Export All",

    TAB_COOLDOWN = "CD Alert", TAB_CAST = "Cast Success", TAB_BLOODLUST = "Bloodlust", SECTION_CLASS_SPEC = "Class / Spec", LABEL_CLASS = "Class", LABEL_SPEC = "Spec", SECTION_SPELL_PARAMS = "Spell Settings", LABEL_SPELL_ID = "Spell ID", LABEL_SPELL_NAME = "Spell Name", LABEL_FIXED_CD_SEC = "Fixed CD (sec)", LABEL_CHECK_TALENT = "Check Talent", LABEL_TALENT_ID = "Talent ID", LABEL_TALENT_NAME = "Talent Name", LABEL_TALENT_CD_SEC = "CD Changes To (sec)", SECTION_NOTIFY = "Notification", LABEL_BUILTIN_SOUND = "Built-in Sound", LABEL_USE_CUSTOM_SOUND = "Use custom sound path", LABEL_USE_TTS = "Use TTS text", LABEL_TTS_RATE = "TTS Rate", EDITOR_HINT = "When TTS and custom path are disabled, the built-in sound will be used. Click \"Test\" before saving to confirm.", SECTION_BLOODLUST_SOUND = "Bloodlust Sound Settings", LABEL_SOUND_PATH_N = "Sound Path %d", BLOODLUST_HINT = "Recommended path format: Interface\\AddOns\\MCDVoiceCooldown\\Media\\Sounds\\xxx.ogg. Empty paths will not be added to the random pool.",

    PLACEHOLDER_SELECT_CLASS = "Select Class", PLACEHOLDER_SELECT_SPEC = "Select Spec", PLACEHOLDER_SELECT_BUILTIN_SOUND = "Select built-in sound",
    COLLECTION_NAME = "Group Name", COLLECTION_ICON_ID = "Group Icon ID (optional)", COLLECTION_ICON_HINT = "Enter an in-game icon FileID, for example 134400. Leave it empty to use the default group icon.", COLLECTION_HINT = "After creation it appears in the Loaded area. Loaded and unloaded alerts can be dragged into groups; green/yellow/red dots show their status.", COLLECTION_DEFAULT_NAME = "New Group", COLLECTION_UNNAMED = "Unnamed Group", COLLECTION_LABEL = "Group", COLLECTION_COUNT = "%d items", COLLECTION_EMPTY_COUNT = "(empty)", DRAG_INTO_COLLECTION = "Drag alerts into this group",
    HEADER_LOADED = "Loaded", HEADER_UNLOADED = "Unloaded", EMPTY_CONFIG = "No alerts", ENTRY_TYPE_COOLDOWN = "CD Alert", ENTRY_TYPE_CAST = "Cast Success", ENTRY_TYPE_BLOODLUST = "Bloodlust", ENTRY_UNNAMED = "Unnamed", TALENT_ROW = "Talent:%s CD:%.2fs", TALENT_ROW_NO_CD = "Talent:%s", MODE_SOUND = "Sound", LOADED_TAG = " |cff00ff00Loaded|r", UNLOADED_TAG = " |cffff4040Unloaded|r",
    EXPORT_DESC = "Below is the compressed export string. Click \"Select All\" and press Ctrl+C to copy it. To import, paste this string into the same window.", IMPORT_DESC = "Paste an MCD export string and click \"Import\". Supports single alerts, groups, and full imports. Full imports overwrite matching spells and keep existing non-matching alerts.",
    MINIMAP_LEFT = "Left-click: open main settings", MINIMAP_RIGHT = "Right-click: open addon options", MINIMAP_DRAG = "Drag: move minimap icon", MINIMAP_ICON_FILE = "Icon file: AppIcon.png",
    MSG_PREFIX = "[MCD-CVA] ", MSG_MAIN_NOT_READY = "Main settings window is not ready yet.", MSG_MAIN_NOT_READY_LATER = "Main settings window is not ready yet. Please try again shortly.", MSG_NO_TTS = "No TTS voice is currently available.", MSG_TTS_FAILED = "TTS playback failed: %s", MSG_NO_CUSTOM_AUDIO = "This client cannot play custom audio.", MSG_SOUND_FAILED = "Voice file playback failed. Check path: %s", MSG_NO_SOUND_PATH = "This spell has no voice file path.", MSG_NO_CAST_SOUND_PATH = "Cast-success alert has no voice file path.", MSG_NO_BLOODLUST_SOUND_PATH = "Bloodlust alert has no voice path.", MSG_LOADED = "Loaded. Type /mcd or /mcdtts to open settings.", MSG_SCOPE_COUNT = "%d spell alerts saved in the current scope.", MSG_CURRENT_EDIT_SCOPE = "Current class/spec: %s / %s", MSG_SELECTED_NOT_EXIST = "The selected alert no longer exists.", MSG_INVALID_CLASS_SPEC = "Class or spec is invalid.", MSG_INVALID_SPELL_ID = "Spell ID is invalid.", MSG_INVALID_FIXED_CD = "Fixed CD is invalid.", MSG_NEED_TALENT_ID = "Talent check is enabled. Please enter a valid Talent ID.", MSG_NEED_TALENT_CD = "Talent check is enabled. Please enter a valid CD Changes To value.", MSG_NEED_TTS_TEXT = "TTS is enabled. Please enter announcement text.", MSG_NEED_SOUND_PATH = "Voice file is enabled. Please enter a sound path.", MSG_DUP_SPELL = "The current spec already has the same Spell ID.", MSG_SAVE_LIMIT = "Save limit reached.", MSG_CONFIG_SAVED = "Alert saved.", MSG_CHOOSE_CONFIG = "Please select an alert first.", MSG_CONFIG_DELETED = "Alert deleted.", MSG_IMPORT_FAILED = "Import failed: %s", MSG_IMPORT_UNKNOWN_TYPE = "Import failed: unknown import type.", MSG_IMPORT_DONE = "Import complete: %s, processed %d alerts.", MSG_IMPORT_EMPTY = "Import failed: no importable data.", MSG_MENU_MISSING = "Right-click menu component is not loaded by the client. Use the Edit/Delete buttons above.", MSG_DRAG_UNLOADED_TO_ROOT = "Unloaded alerts cannot be dragged to the loaded root area. Drag them into a loaded group instead.", MSG_DRAG_UNLOADED_TO_GROUP = "Unloaded alert added to this group. It will be shown with a red dot.",
    TTS_READY_DEFAULT = "Ready", TTS_CAST_SUCCESS_DEFAULT = "Cast success", FALLBACK_CLASS = "Class%s", FALLBACK_SPEC = "Spec%s",
}

local zhCN = setmetatable({
    ADDON_DISPLAY_NAME = "MCD 固定冷却语音提醒", ADDON_SHORT_NAME = "固定CD语音", OPTION_NAME = "MCD 固定冷却语音提醒", AUTHOR_LINE = "作者：zhufei1000",
    OPTIONS_DESC = "固定CD技能语音提醒插件：通过 UNIT_SPELLCAST_SUCCEEDED 记录施法成功事件，按你填写的固定CD计时，并在冷却结束、施法成功或嗜血触发时播放TTS或语音文件。\n\n点击下方按钮可打开主设置界面；也可以使用 /mcd 或点击小地图图标打开。", OPEN_MAIN_SETTINGS = "打开主设置界面", COMMANDS = "命令：/mcd 或 /mcdtts",
    BTN_ADD_VOICE = "新增语音", BTN_ADD_COLLECTION = "新增合集", BTN_EDIT = "编辑", BTN_DELETE = "删除", BTN_REFRESH = "刷新", BTN_IMPORT = "导入", BTN_EXPORT_FULL = "全量导出", BTN_SAVE = "保存", BTN_TEST = "试听", BTN_CLOSE = "关闭", BTN_SELECT_ALL = "全选",
    TITLE_NEW_CONFIG = "新增配置", TITLE_EDIT_CONFIG = "编辑配置", TITLE_BLOODLUST_SETTINGS = "嗜血提示设置", TITLE_ADD_COLLECTION = "新增合集", TITLE_RENAME_COLLECTION = "重命名合集", TITLE_IMPORT_EXPORT = "导入 / 导出", TITLE_EXPORT = "导出", TITLE_IMPORT_SETTINGS = "导入设置", EXPORT_ENTRY = "导出单条信息", EXPORT_COLLECTION = "导出合集", DELETE_ENTRY = "删除配置", EDIT_ENTRY = "编辑配置", DELETE_COLLECTION_WITH_ITEMS = "删除合集和其中语音", EXPAND_COLLECTION = "展开合集", COLLAPSE_COLLECTION = "收拢合集", RENAME_COLLECTION = "重命名合集", EXPORT_FULL_TITLE = "全量导出",
    TAB_COOLDOWN = "CD提示", TAB_CAST = "施法成功", TAB_BLOODLUST = "嗜血提示", SECTION_CLASS_SPEC = "职业 / 专精", LABEL_CLASS = "职业", LABEL_SPEC = "专精", SECTION_SPELL_PARAMS = "技能参数", LABEL_SPELL_ID = "技能ID", LABEL_SPELL_NAME = "技能名称", LABEL_FIXED_CD_SEC = "固定CD（秒）", LABEL_CHECK_TALENT = "检查天赋", LABEL_TALENT_ID = "天赋ID", LABEL_TALENT_NAME = "天赋名称", LABEL_TALENT_CD_SEC = "CD变为（秒）", SECTION_NOTIFY = "通知方式", LABEL_BUILTIN_SOUND = "内置语音", LABEL_USE_CUSTOM_SOUND = "启用自定义语音路径", LABEL_USE_TTS = "启用 TTS 文本", LABEL_TTS_RATE = "TTS 语速", EDITOR_HINT = "未启用 TTS 和自定义路径时，将使用内置语音。保存前可点击底部“试听”确认。", SECTION_BLOODLUST_SOUND = "嗜血音效设置", LABEL_SOUND_PATH_N = "语音路径 %d", BLOODLUST_HINT = "建议填写 Interface\\AddOns\\MCDVoiceCooldown\\Media\\Sounds\\xxx.ogg 这样的游戏内路径。未填写的路径不会加入随机池。",
    PLACEHOLDER_SELECT_CLASS = "请选择职业", PLACEHOLDER_SELECT_SPEC = "请选择专精", PLACEHOLDER_SELECT_BUILTIN_SOUND = "请选择内置语音",
    COLLECTION_NAME = "合集名称", COLLECTION_ICON_ID = "合集图标ID（可选）", COLLECTION_ICON_HINT = "输入游戏内图标 FileID，例如 134400。留空时使用默认合集图标。", COLLECTION_HINT = "创建后显示在已载入区域；已载入/未载入语音都可以拖入合集，合集内用绿/黄/红圆点区分状态。", COLLECTION_DEFAULT_NAME = "新建合集", COLLECTION_UNNAMED = "未命名合集", COLLECTION_LABEL = "合集", COLLECTION_COUNT = "%d 条", COLLECTION_EMPTY_COUNT = "（空）", DRAG_INTO_COLLECTION = "拖拽语音到这个合集里",
    HEADER_LOADED = "已载入", HEADER_UNLOADED = "未载入", EMPTY_CONFIG = "暂无配置", ENTRY_TYPE_COOLDOWN = "CD提示", ENTRY_TYPE_CAST = "施法成功", ENTRY_TYPE_BLOODLUST = "嗜血提示", ENTRY_UNNAMED = "未命名", TALENT_ROW = "天赋:%s CD:%.2fs", TALENT_ROW_NO_CD = "天赋:%s", MODE_SOUND = "语音", LOADED_TAG = " |cff00ff00已载入|r", UNLOADED_TAG = " |cffff4040未载入|r",
    EXPORT_DESC = "下面是压缩后的导出字符串。点击“全选”后用 Ctrl+C 复制；导入时把这段字符串粘贴到同一个窗口。", IMPORT_DESC = "粘贴 MCD 导出字符串后点击“导入”。支持单条信息、合集和全量导入；全量导入会按导入信息覆盖相同技能并保留不相同的现有信息。",
    MINIMAP_LEFT = "左键：打开主设置界面", MINIMAP_RIGHT = "右键：打开系统选项页", MINIMAP_DRAG = "拖动：移动小地图图标", MINIMAP_ICON_FILE = "图标文件：AppIcon.png",
    MSG_MAIN_NOT_READY = "主设置界面尚未准备好。", MSG_MAIN_NOT_READY_LATER = "主界面尚未准备好，请稍后再试。", MSG_NO_TTS = "当前没有可用的TTS语音。", MSG_TTS_FAILED = "TTS播放失败: %s", MSG_NO_CUSTOM_AUDIO = "当前客户端无法播放自定义音频。", MSG_SOUND_FAILED = "语音文件播放失败，请检查路径: %s", MSG_NO_SOUND_PATH = "这条技能未填写语音文件路径。", MSG_NO_CAST_SOUND_PATH = "施法成功提示未填写语音文件路径。", MSG_NO_BLOODLUST_SOUND_PATH = "嗜血提示未填写语音路径。", MSG_LOADED = "已载入，输入 /mcd 或 /mcdtts 打开配置。", MSG_SCOPE_COUNT = "当前保存作用域已保存 %d 条技能配置。", MSG_CURRENT_EDIT_SCOPE = "当前职业专精：%s / %s", MSG_SELECTED_NOT_EXIST = "选中的配置不存在。", MSG_INVALID_CLASS_SPEC = "职业或专精无效。", MSG_INVALID_SPELL_ID = "技能ID无效。", MSG_INVALID_FIXED_CD = "固定CD无效。", MSG_NEED_TALENT_ID = "已启用检查天赋，请填写有效的天赋ID。", MSG_NEED_TALENT_CD = "已启用检查天赋，请填写有效的 CD变为（秒）。", MSG_NEED_TTS_TEXT = "已启用TTS，请填写播报文本。", MSG_NEED_SOUND_PATH = "已启用语音文件，请填写语音路径。", MSG_DUP_SPELL = "当前专精下已经存在相同的技能ID。", MSG_SAVE_LIMIT = "已达到保存上限。", MSG_CONFIG_SAVED = "配置已保存。", MSG_CHOOSE_CONFIG = "请先选择一条配置。", MSG_CONFIG_DELETED = "配置已删除。", MSG_IMPORT_FAILED = "导入失败：%s", MSG_IMPORT_UNKNOWN_TYPE = "导入失败：未知导入类型。", MSG_IMPORT_DONE = "导入完成：%s，处理 %d 条语音配置。", MSG_IMPORT_EMPTY = "导入失败：没有可导入的数据。", MSG_MENU_MISSING = "当前客户端未加载右键菜单组件，请使用上方编辑/删除按钮。", MSG_DRAG_UNLOADED_TO_ROOT = "未载入条目不能单独拖到已载入区域，只能拖入已载入合集。", MSG_DRAG_UNLOADED_TO_GROUP = "已把未载入语音加入当前合集，状态会以红色圆点显示。",
    TTS_READY_DEFAULT = "好了", TTS_CAST_SUCCESS_DEFAULT = "施法成功", FALLBACK_CLASS = "职业%s", FALLBACK_SPEC = "专精%s",
}, { __index = enUS })

local zhTW = setmetatable({
    ADDON_DISPLAY_NAME = "MCD 固定冷卻語音提醒", ADDON_SHORT_NAME = "固定冷卻語音", OPTION_NAME = "MCD 固定冷卻語音提醒", AUTHOR_LINE = "作者：zhufei1000",
    OPTIONS_DESC = "固定冷卻技能語音提醒插件：透過 UNIT_SPELLCAST_SUCCEEDED 記錄施法成功事件，依照你填寫的固定冷卻計時，並在冷卻結束、施法成功或嗜血觸發時播放 TTS 或語音檔。\n\n點擊下方按鈕可開啟主設定介面；也可以使用 /mcd 或點擊小地圖圖示開啟。", OPEN_MAIN_SETTINGS = "開啟主設定介面", COMMANDS = "指令：/mcd 或 /mcdtts",
    BTN_ADD_VOICE = "新增語音", BTN_ADD_COLLECTION = "新增合集", BTN_EDIT = "編輯", BTN_DELETE = "刪除", BTN_REFRESH = "重新整理", BTN_IMPORT = "匯入", BTN_EXPORT_FULL = "全量匯出", BTN_SAVE = "儲存", BTN_TEST = "試聽", BTN_CLOSE = "關閉", BTN_SELECT_ALL = "全選",
    TITLE_NEW_CONFIG = "新增設定", TITLE_EDIT_CONFIG = "編輯設定", TITLE_BLOODLUST_SETTINGS = "嗜血提示設定", TITLE_ADD_COLLECTION = "新增合集", TITLE_RENAME_COLLECTION = "重命名合集", TITLE_IMPORT_EXPORT = "匯入 / 匯出", TITLE_EXPORT = "匯出", TITLE_IMPORT_SETTINGS = "匯入設定", EXPORT_ENTRY = "匯出單條資訊", EXPORT_COLLECTION = "匯出合集", DELETE_ENTRY = "刪除設定", EDIT_ENTRY = "編輯設定", DELETE_COLLECTION_WITH_ITEMS = "刪除合集和其中語音", EXPAND_COLLECTION = "展開合集", COLLAPSE_COLLECTION = "收合合集", EXPORT_FULL_TITLE = "全量匯出",
    TAB_COOLDOWN = "CD提示", TAB_CAST = "施法成功", TAB_BLOODLUST = "嗜血提示", SECTION_CLASS_SPEC = "職業 / 專精", LABEL_CLASS = "職業", LABEL_SPEC = "專精", SECTION_SPELL_PARAMS = "技能參數", LABEL_SPELL_ID = "技能ID", LABEL_SPELL_NAME = "技能名稱", LABEL_FIXED_CD_SEC = "固定CD（秒）", LABEL_CHECK_TALENT = "檢查天賦", LABEL_TALENT_ID = "天賦ID", LABEL_TALENT_NAME = "天賦名稱", LABEL_TALENT_CD_SEC = "CD變為（秒）", SECTION_NOTIFY = "通知方式", LABEL_BUILTIN_SOUND = "內建語音", LABEL_USE_CUSTOM_SOUND = "啟用自訂語音路徑", LABEL_USE_TTS = "啟用 TTS 文字", LABEL_TTS_RATE = "TTS 語速", EDITOR_HINT = "未啟用 TTS 和自訂路徑時，將使用內建語音。儲存前可點擊底部「試聽」確認。", SECTION_BLOODLUST_SOUND = "嗜血音效設定", LABEL_SOUND_PATH_N = "語音路徑 %d", BLOODLUST_HINT = "建議填寫 Interface\\AddOns\\MCDVoiceCooldown\\Media\\Sounds\\xxx.ogg 這樣的遊戲內路徑。未填寫的路徑不會加入隨機池。",
    PLACEHOLDER_SELECT_CLASS = "請選擇職業", PLACEHOLDER_SELECT_SPEC = "請選擇專精", PLACEHOLDER_SELECT_BUILTIN_SOUND = "請選擇內建語音",
    COLLECTION_NAME = "合集名稱", COLLECTION_ICON_ID = "合集圖示ID（可選）", COLLECTION_ICON_HINT = "輸入遊戲內圖示 FileID，例如 134400。留空時使用預設合集圖示。", COLLECTION_HINT = "建立後顯示在已載入區域；已載入/未載入語音都可以拖入合集，合集內用綠/黃/紅圓點區分狀態。", COLLECTION_DEFAULT_NAME = "新建合集", COLLECTION_UNNAMED = "未命名合集", COLLECTION_LABEL = "合集", COLLECTION_COUNT = "%d 條", COLLECTION_EMPTY_COUNT = "（空）", DRAG_INTO_COLLECTION = "拖曳語音到這個合集裡",
    HEADER_LOADED = "已載入", HEADER_UNLOADED = "未載入", EMPTY_CONFIG = "暫無設定", ENTRY_TYPE_COOLDOWN = "CD提示", ENTRY_TYPE_CAST = "施法成功", ENTRY_TYPE_BLOODLUST = "嗜血提示", ENTRY_UNNAMED = "未命名", TALENT_ROW = "天賦:%s CD:%.2fs", TALENT_ROW_NO_CD = "天賦:%s", MODE_SOUND = "語音", LOADED_TAG = " |cff00ff00已載入|r", UNLOADED_TAG = " |cffff4040未載入|r",
    MINIMAP_LEFT = "左鍵：開啟主設定介面", MINIMAP_RIGHT = "右鍵：開啟系統選項頁", MINIMAP_DRAG = "拖曳：移動小地圖圖示", MINIMAP_ICON_FILE = "圖示檔案：AppIcon.png",
    TTS_READY_DEFAULT = "好了", TTS_CAST_SUCCESS_DEFAULT = "施法成功", FALLBACK_CLASS = "職業%s", FALLBACK_SPEC = "專精%s",
}, { __index = zhCN })


-- Additional legacy/utility UI strings.
enUS.BTN_CREATE = "Create"; enUS.BTN_CANCEL = "Cancel"
enUS.CREATE_CHILD_COLLECTION = "Create Child Group"; enUS.CREATE_VOICE_IN_COLLECTION = "Create Alert in Group"
enUS.MSG_BLOODLUST_SUMMARY = "After Bloodlust/Heroism is triggered, one of %d valid voice paths will be played randomly."
enUS.MSG_BLOODLUST_SAVED = "Bloodlust voice settings saved."
enUS.MSG_INVALID_SCOPE = "Please select a valid class/spec first."
enUS.MSG_COLLECTION_NAME_EMPTY = "Group name cannot be empty."
enUS.MSG_COLLECTION_ADDED = "Group added: %s"
enUS.MSG_COLLECTION_RENAMED = "Group renamed: %s"
enUS.MSG_COLLECTION_DELETED = "Group deleted, and %d alerts inside it were also deleted."
enUS.MSG_GROUP_SORT_ONLY_CURRENT = "Groups can only be sorted within the currently loaded spec."
enUS.MSG_UNLOADED_ONLY_TO_LOADED_GROUP = "Unloaded alerts can only be dragged into groups in the currently loaded area."
enUS.MSG_EXPORT_MISSING_LIBS = "Export failed: AceSerializer or LibDeflate is missing."
enUS.MSG_EXPORT_DEFLATE_FAILED = "Export failed: data compression failed."
enUS.ERR_IMPORT_EMPTY = "Import string is empty."
enUS.ERR_IMPORT_MISSING_LIBS = "AceSerializer or LibDeflate is missing."
enUS.ERR_IMPORT_BAD_PREFIX = "This is not an MCD Fixed Cooldown Voice Alert import string."
enUS.ERR_IMPORT_DECODE_FAILED = "Import string decode failed."
enUS.ERR_IMPORT_DEFLATE_FAILED = "Import string decompression failed."
enUS.ERR_IMPORT_DESERIALIZE_FAILED = "Import string deserialization failed."
enUS.ERR_IMPORT_VERSION_MISMATCH = "Import string version mismatch."
enUS.MSG_EXPORT_ENTRY_NOT_FOUND = "Export failed: saved alert not found."
enUS.MSG_EXPORT_COLLECTION_INVALID = "Export failed: invalid group."
enUS.MSG_EXPORT_COLLECTION_NOT_FOUND = "Export failed: group not found."
enUS.IMPORT_COLLECTION_NAME = "Imported Group"
enUS.MODE_SOUND_FILE = "Voice file"; enUS.MODE_TTS_TEXT = "Text to speech"
enUS.STATUS_EXPAND = "Expand"; enUS.STATUS_COLLAPSE = "Collapse"
enUS.MSG_CHOOSE_SAVED_ENTRY = "Please select an alert in the saved area first."

zhCN.BTN_CREATE = "创建"; zhCN.BTN_CANCEL = "取消"
zhCN.CREATE_CHILD_COLLECTION = "创建子合集"; zhCN.CREATE_VOICE_IN_COLLECTION = "创建语音"
zhCN.MSG_BLOODLUST_SUMMARY = "嗜血/英勇触发后将从 %d 条有效语音路径中随机播放。"
zhCN.MSG_BLOODLUST_SAVED = "嗜血语音配置已保存。"
zhCN.MSG_INVALID_SCOPE = "请先选择有效的职业/专精。"
zhCN.MSG_COLLECTION_NAME_EMPTY = "合集名称不能为空。"
zhCN.MSG_COLLECTION_ADDED = "已新增合集：%s"
zhCN.MSG_COLLECTION_RENAMED = "合集已重命名：%s"
zhCN.MSG_COLLECTION_DELETED = "合集已删除，并删除其中 %d 条语音配置。"
zhCN.MSG_GROUP_SORT_ONLY_CURRENT = "合集只能在当前已载入专精内排序。"
zhCN.MSG_UNLOADED_ONLY_TO_LOADED_GROUP = "未载入条目只能拖入当前已载入区域的合集。"
zhCN.MSG_EXPORT_MISSING_LIBS = "导出失败：缺少 AceSerializer 或 LibDeflate。"
zhCN.MSG_EXPORT_DEFLATE_FAILED = "导出失败：压缩数据失败。"
zhCN.ERR_IMPORT_EMPTY = "导入字符串为空。"
zhCN.ERR_IMPORT_MISSING_LIBS = "缺少 AceSerializer 或 LibDeflate。"
zhCN.ERR_IMPORT_BAD_PREFIX = "不是 MCD 固定冷却语音提醒的导入字符串。"
zhCN.ERR_IMPORT_DECODE_FAILED = "导入字符串解码失败。"
zhCN.ERR_IMPORT_DEFLATE_FAILED = "导入字符串解压失败。"
zhCN.ERR_IMPORT_DESERIALIZE_FAILED = "导入字符串反序列化失败。"
zhCN.ERR_IMPORT_VERSION_MISMATCH = "导入字符串版本不匹配。"
zhCN.MSG_EXPORT_ENTRY_NOT_FOUND = "导出失败：找不到这条保存信息。"
zhCN.MSG_EXPORT_COLLECTION_INVALID = "导出失败：合集无效。"
zhCN.MSG_EXPORT_COLLECTION_NOT_FOUND = "导出失败：找不到合集。"
zhCN.IMPORT_COLLECTION_NAME = "导入合集"
zhCN.MODE_SOUND_FILE = "语音文件"; zhCN.MODE_TTS_TEXT = "文本转语音"
zhCN.STATUS_EXPAND = "展开"; zhCN.STATUS_COLLAPSE = "收拢"
zhCN.MSG_CHOOSE_SAVED_ENTRY = "请先在已保存区域选择一条配置。"

zhTW.BTN_CREATE = "建立"; zhTW.BTN_CANCEL = "取消"
zhTW.CREATE_CHILD_COLLECTION = "建立子合集"; zhTW.CREATE_VOICE_IN_COLLECTION = "建立語音"
zhTW.MSG_BLOODLUST_SUMMARY = "嗜血/英勇觸發後將從 %d 條有效語音路徑中隨機播放。"
zhTW.MSG_BLOODLUST_SAVED = "嗜血語音設定已儲存。"
zhTW.MSG_INVALID_SCOPE = "請先選擇有效的職業/專精。"
zhTW.MSG_COLLECTION_NAME_EMPTY = "合集名稱不能為空。"
zhTW.MSG_COLLECTION_ADDED = "已新增合集：%s"
zhTW.MSG_COLLECTION_RENAMED = "合集已重新命名：%s"
zhTW.MSG_COLLECTION_DELETED = "合集已刪除，並刪除其中 %d 條語音設定。"
zhTW.MSG_GROUP_SORT_ONLY_CURRENT = "合集只能在目前已載入專精內排序。"
zhTW.MSG_UNLOADED_ONLY_TO_LOADED_GROUP = "未載入條目只能拖入目前已載入區域的合集。"
zhTW.MSG_EXPORT_MISSING_LIBS = "匯出失敗：缺少 AceSerializer 或 LibDeflate。"
zhTW.MSG_EXPORT_DEFLATE_FAILED = "匯出失敗：壓縮資料失敗。"
zhTW.ERR_IMPORT_EMPTY = "匯入字串為空。"
zhTW.ERR_IMPORT_MISSING_LIBS = "缺少 AceSerializer 或 LibDeflate。"
zhTW.ERR_IMPORT_BAD_PREFIX = "不是 MCD 固定冷卻語音提醒的匯入字串。"
zhTW.ERR_IMPORT_DECODE_FAILED = "匯入字串解碼失敗。"
zhTW.ERR_IMPORT_DEFLATE_FAILED = "匯入字串解壓失敗。"
zhTW.ERR_IMPORT_DESERIALIZE_FAILED = "匯入字串反序列化失敗。"
zhTW.ERR_IMPORT_VERSION_MISMATCH = "匯入字串版本不相符。"
zhTW.MSG_EXPORT_ENTRY_NOT_FOUND = "匯出失敗：找不到這條儲存資訊。"
zhTW.MSG_EXPORT_COLLECTION_INVALID = "匯出失敗：合集無效。"
zhTW.MSG_EXPORT_COLLECTION_NOT_FOUND = "匯出失敗：找不到合集。"
zhTW.IMPORT_COLLECTION_NAME = "匯入合集"
zhTW.MODE_SOUND_FILE = "語音檔"; zhTW.MODE_TTS_TEXT = "文字轉語音"
zhTW.STATUS_EXPAND = "展開"; zhTW.STATUS_COLLAPSE = "收合"
zhTW.MSG_CHOOSE_SAVED_ENTRY = "請先在已儲存區域選擇一條設定。"



zhTW.EXPORT_DESC = "下面是壓縮後的匯出字串。點擊「全選」後用 Ctrl+C 複製；匯入時把這段字串貼到同一個視窗。"
zhTW.IMPORT_DESC = "貼上 MCD 匯出字串後點擊「匯入」。支援單條資訊、合集和全量匯入；全量匯入會按匯入資訊覆蓋相同技能並保留不相同的現有資訊。"
zhTW.MSG_MAIN_NOT_READY = "主設定介面尚未準備好。"
zhTW.MSG_MAIN_NOT_READY_LATER = "主介面尚未準備好，請稍後再試。"
zhTW.MSG_NO_TTS = "目前沒有可用的 TTS 語音。"
zhTW.MSG_TTS_FAILED = "TTS播放失敗: %s"
zhTW.MSG_NO_CUSTOM_AUDIO = "目前客戶端無法播放自訂音訊。"
zhTW.MSG_SOUND_FAILED = "語音檔播放失敗，請檢查路徑: %s"
zhTW.MSG_NO_SOUND_PATH = "這條技能未填寫語音檔路徑。"
zhTW.MSG_NO_CAST_SOUND_PATH = "施法成功提示未填寫語音檔路徑。"
zhTW.MSG_NO_BLOODLUST_SOUND_PATH = "嗜血提示未填寫語音路徑。"
zhTW.MSG_LOADED = "已載入，輸入 /mcd 或 /mcdtts 開啟設定。"
zhTW.MSG_SCOPE_COUNT = "目前儲存作用域已儲存 %d 條技能設定。"
zhTW.MSG_CURRENT_EDIT_SCOPE = "目前職業專精：%s / %s"
zhTW.MSG_SELECTED_NOT_EXIST = "選中的設定不存在。"
zhTW.MSG_INVALID_CLASS_SPEC = "職業或專精無效。"
zhTW.MSG_INVALID_SPELL_ID = "技能ID無效。"
zhTW.MSG_INVALID_FIXED_CD = "固定CD無效。"
zhTW.MSG_NEED_TALENT_ID = "已啟用檢查天賦，請填寫有效的天賦ID。"
zhTW.MSG_NEED_TALENT_CD = "已啟用檢查天賦，請填寫有效的 CD變為（秒）。"
zhTW.MSG_NEED_TTS_TEXT = "已啟用TTS，請填寫播報文字。"
zhTW.MSG_NEED_SOUND_PATH = "已啟用語音檔，請填寫語音路徑。"
zhTW.MSG_DUP_SPELL = "目前專精下已經存在相同的技能ID。"
zhTW.MSG_SAVE_LIMIT = "已達到儲存上限。"
zhTW.MSG_CONFIG_SAVED = "設定已儲存。"
zhTW.MSG_CHOOSE_CONFIG = "請先選擇一條設定。"
zhTW.MSG_CONFIG_DELETED = "設定已刪除。"
zhTW.MSG_IMPORT_FAILED = "匯入失敗：%s"
zhTW.MSG_IMPORT_UNKNOWN_TYPE = "匯入失敗：未知匯入類型。"
zhTW.MSG_IMPORT_DONE = "匯入完成：%s，處理 %d 條語音設定。"
zhTW.MSG_IMPORT_EMPTY = "匯入失敗：沒有可匯入的資料。"
zhTW.MSG_MENU_MISSING = "目前客戶端未載入右鍵選單元件，請使用上方編輯/刪除按鈕。"
zhTW.MSG_DRAG_UNLOADED_TO_ROOT = "未載入條目不能單獨拖到已載入區域，只能拖入已載入合集。"
zhTW.MSG_DRAG_UNLOADED_TO_GROUP = "已把未載入語音加入目前合集，狀態會以紅色圓點顯示。"

enUS.BTN_IMPORT_RURUTIA_PRESET = "Import Rurutia"
zhCN.BTN_IMPORT_RURUTIA_PRESET = "导入露露预设"
zhTW.BTN_IMPORT_RURUTIA_PRESET = "匯入露露預設"

enUS.ALL_SPECS = "All Specs"
zhCN.ALL_SPECS = "全专精"
zhTW.ALL_SPECS = "全專精"


-- All class / all spec and spell-or-item unified labels.
enUS.ALL_CLASSES = "All Classes"
zhCN.ALL_CLASSES = "全职业"
zhTW.ALL_CLASSES = "全職業"

enUS.ALL_SPECS = enUS.ALL_SPECS or "All Specs"
zhCN.ALL_SPECS = zhCN.ALL_SPECS or "全专精"
zhTW.ALL_SPECS = zhTW.ALL_SPECS or "全專精"

enUS.LABEL_SPELL_ID = "Spell / Item ID"
zhCN.LABEL_SPELL_ID = "技能/物品ID"
zhTW.LABEL_SPELL_ID = "技能/物品ID"

enUS.LABEL_SPELL_NAME = "Spell / Item Name"
zhCN.LABEL_SPELL_NAME = "技能/物品名称"
zhTW.LABEL_SPELL_NAME = "技能/物品名稱"

enUS.MSG_INVALID_SPELL_ID = "Spell / item ID is invalid."
zhCN.MSG_INVALID_SPELL_ID = "技能/物品ID无效。"
zhTW.MSG_INVALID_SPELL_ID = "技能/物品ID無效。"

enUS.MSG_DUP_SPELL = "The current scope already has the same spell/item ID and alert type."
zhCN.MSG_DUP_SPELL = "当前范围下已经存在相同的技能/物品ID和提醒类型。"
zhTW.MSG_DUP_SPELL = "目前範圍下已經存在相同的技能/物品ID和提醒類型。"

enUS.MSG_NO_SOUND_PATH = "This spell/item has no voice file path."
zhCN.MSG_NO_SOUND_PATH = "这条技能/物品未填写语音文件路径。"
zhTW.MSG_NO_SOUND_PATH = "這條技能/物品未填寫語音檔路徑。"

enUS.ENTRY_OBJECT_SPELL_ID = "Spell / Item ID"
zhCN.ENTRY_OBJECT_SPELL_ID = "技能/物品ID"
zhTW.ENTRY_OBJECT_SPELL_ID = "技能/物品ID"

enUS.ENTRY_OBJECT_ITEM_ID = "Spell / Item ID"
zhCN.ENTRY_OBJECT_ITEM_ID = "技能/物品ID"
zhTW.ENTRY_OBJECT_ITEM_ID = "技能/物品ID"



enUS.SECTION_SPELL_PARAMS = "Spell / Item Settings"
zhCN.SECTION_SPELL_PARAMS = "技能/物品参数"
zhTW.SECTION_SPELL_PARAMS = "技能/物品參數"


-- Collection rename labels.
enUS.TITLE_RENAME_COLLECTION = enUS.TITLE_RENAME_COLLECTION or "Rename Group"
zhCN.TITLE_RENAME_COLLECTION = zhCN.TITLE_RENAME_COLLECTION or "重命名合集"
zhTW.TITLE_RENAME_COLLECTION = zhTW.TITLE_RENAME_COLLECTION or "重新命名合集"
enUS.RENAME_COLLECTION = enUS.RENAME_COLLECTION or "Rename Group"
zhCN.RENAME_COLLECTION = zhCN.RENAME_COLLECTION or "重命名合集"
zhTW.RENAME_COLLECTION = zhTW.RENAME_COLLECTION or "重新命名合集"
enUS.MSG_COLLECTION_RENAMED = enUS.MSG_COLLECTION_RENAMED or "Group renamed: %s"
zhCN.MSG_COLLECTION_RENAMED = zhCN.MSG_COLLECTION_RENAMED or "合集已重命名：%s"
zhTW.MSG_COLLECTION_RENAMED = zhTW.MSG_COLLECTION_RENAMED or "合集已重新命名：%s"

-- Saved list voice detail labels.
enUS.SAVED_VOICE_BUILTIN = "Voice  Built-in: %s"
zhCN.SAVED_VOICE_BUILTIN = "语音  内置语音：%s"
zhTW.SAVED_VOICE_BUILTIN = "語音  內建語音：%s"

enUS.SAVED_VOICE_CUSTOM = "Voice  Custom: %s"
zhCN.SAVED_VOICE_CUSTOM = "语音  自定义语音：%s"
zhTW.SAVED_VOICE_CUSTOM = "語音  自訂語音：%s"

enUS.SAVED_VOICE_TTS = "Voice  TTS text: %s"
zhCN.SAVED_VOICE_TTS = "语音  TTS文本：%s"
zhTW.SAVED_VOICE_TTS = "語音  TTS文字：%s"

local selected = (activeLocale == "zhCN" and zhCN) or (activeLocale == "zhTW" and zhTW) or enUS
NS.L_TABLE = selected
NS.L_ENUS = enUS
function NS.L(key, ...)
    local value = selected[key] or enUS[key] or tostring(key or "")
    if select("#", ...) > 0 then
        return string.format(value, ...)
    end
    return value
end
NS.ADDON_DISPLAY_NAME = NS.L("ADDON_DISPLAY_NAME")
NS.ADDON_SHORT_NAME = NS.L("ADDON_SHORT_NAME")
