Skip to content

Commit

Permalink
Changed languages positions in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Creckeryop committed Aug 26, 2021
1 parent bdba238 commit f388546
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions source/assets/libs/extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,39 @@ function Extra.setChapters(manga, chapters, page)
end
end

local lang_to_code = {}
local langToCode = {}

function updateLanguagePick()
selectedExtraMenu = {}
langToCode = {}
local langNames = {}
for k, _ in pairs(Language) do
if k ~= "Default" then
langNames[#langNames + 1] = k
end
end
table.sort(langNames)
table.insert(langNames, 1, "Default")
for _, k in ipairs(langNames) do
if LanguageNames.English[k] then
langToCode[#langToCode + 1] = k
if k == Settings.Language then
selectedExtraMenu[#selectedExtraMenu + 1] = ">> " .. LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ") <<"
else
selectedExtraMenu[#selectedExtraMenu + 1] = LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ")"
end
end
end
end

function Extra.setLanguage()
mode = "setLanguage"
selectedExtraMenu = {}
lang_to_code = {}
langToCode = {}
status = "START"
oldFade = 1
slider.Y = -50
for k, _ in pairs(Language) do
lang_to_code[#lang_to_code + 1] = k
if k == Settings.Language then
selectedExtraMenu[#selectedExtraMenu + 1] = ">> " .. LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ") <<"
else
selectedExtraMenu[#selectedExtraMenu + 1] = LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ")"
end
end
updateLanguagePick()
extraSelector:resetSelected()
Timer.reset(fadeAnimationTimer)
extraMenuYDrawStart = 0
Expand Down Expand Up @@ -388,8 +404,8 @@ local function pressOption(id)
end
end
elseif mode == "setLanguage" then
if lang_to_code[id] then
Settings.Language = lang_to_code[id]
if langToCode[id] then
Settings.Language = langToCode[id]
GenPanels()
Settings.save()
end
Expand All @@ -414,14 +430,7 @@ function Extra.input(oldPad, pad, oldTouch, touch)
pressOption(id)
if mode == "setLanguage" then
if mode == "setLanguage" then
selectedExtraMenu = {}
for k, _ in pairs(Language) do
if k == Settings.Language then
selectedExtraMenu[#selectedExtraMenu + 1] = ">> " .. LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ") <<"
else
selectedExtraMenu[#selectedExtraMenu + 1] = LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ")"
end
end
updateLanguagePick()
end
end
end
Expand All @@ -433,14 +442,7 @@ function Extra.input(oldPad, pad, oldTouch, touch)
local id = extraSelector.getSelected()
pressOption(id)
if mode == "setLanguage" then
selectedExtraMenu = {}
for k, _ in pairs(Language) do
if k == Settings.Language then
selectedExtraMenu[#selectedExtraMenu + 1] = ">> " .. LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ") <<"
else
selectedExtraMenu[#selectedExtraMenu + 1] = LanguageNames[k][k] .. " (" .. LanguageNames.English[k] .. ")"
end
end
updateLanguagePick()
end
elseif Controls.check(pad, SCE_CTRL_CIRCLE) and not Controls.check(oldPad, SCE_CTRL_CIRCLE) then
status = "WAIT"
Expand Down

0 comments on commit f388546

Please sign in to comment.