✨ (bilimanga): 新增哔哩哔哩漫画书源并收进 src/

附协议分析笔记,沿用统一的 update.lua 与打包脚本。

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
GarfieldandCopilot committed 2026-11-18 14:23:10 +08:00
commit f9d07c95fb
17 files changed
+2455

No files matched your search

@@ -0,0 +1,37 @@
local M = {}
local catalog
local function currentLang()
local ok, GetText = pcall(require, "gettext")
local lang = ok and type(GetText) == "table" and GetText.current_lang or "zh_CN"
return (tostring(lang):gsub("%.[Uu][Tt][Ff]%-?8$", ""))
end
function M.candidates(lang)
if lang == "" or lang == "C" or lang:match("^en") then return { "en" } end
if lang:match("^zh_TW") or lang:match("^zh_HK") then return { "zh_TW" } end
if lang:match("^zh") then return {} end
local out = { lang }
local base = lang:match("^([^_]+)")
if base and base ~= lang then out[#out + 1] = base end
out[#out + 1] = "en"
return out
end
function M.load(lang)
catalog = {}
for _, name in ipairs(M.candidates(lang or currentLang())) do
local ok, t = pcall(require, "moonsource_bilimanga.l10n." .. name)
if ok and type(t) == "table" then catalog = t; break end
end
return catalog
end
function M.translate(msg, ...)
if not catalog then M.load() end
local s = catalog[msg] or msg
if select("#", ...) > 0 then return s:format(...) end
return s
end
return setmetatable(M, { __call = function(_, ...) return M.translate(...) end })