1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

Add support for ContentDB package translation (#14410)

This commit is contained in:
rubenwardy
2024-02-25 22:09:52 +00:00
committed by GitHub
parent 4caf0e4cb9
commit f4eba3bfba
3 changed files with 32 additions and 2 deletions

View File

@@ -154,7 +154,9 @@ local function start_install(package, reason)
if conf_path then
local conf = Settings(conf_path)
conf:set("title", package.title)
if not conf:get("title") then
conf:set("title", package.title)
end
if not name_is_title then
conf:set("name", package.name)
end
@@ -642,8 +644,21 @@ local function fetch_pkgs()
end
end
local languages
local current_language = core.get_language()
if current_language ~= "" then
languages = { current_language, "en;q=0.8" }
else
languages = { "en" }
end
local http = core.get_http_api()
local response = http.fetch_sync({ url = url })
local response = http.fetch_sync({
url = url,
extra_headers = {
"Accept-Language: " .. table.concat(languages, ", ")
},
})
if not response.succeeded then
return
end