From 6ef13f644af261311a828b615f6a71bf5fef126d Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 20 Jul 2023 23:03:28 +0200 Subject: [PATCH] resolving comments --- objects/LuaScriptState.luascriptstate | 2 +- src/core/Global.ttslua | 11 +++++------ xml/OptionPanel.xml | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/objects/LuaScriptState.luascriptstate b/objects/LuaScriptState.luascriptstate index 63cc8fba..3404240e 100644 --- a/objects/LuaScriptState.luascriptstate +++ b/objects/LuaScriptState.luascriptstate @@ -1 +1 @@ -{"acknowledgedUpgradeVersions":[],"optionPanel":{"cardLanguage":"English","playAreaSnapTags":true,"showAttachmentHelper":false,"showChaosBagManager":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showSearchAssistant":[],"showTitleSplash":true,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}} +{"acknowledgedUpgradeVersions":[],"optionPanel":{"cardLanguage":"en","playAreaSnapTags":true,"showAttachmentHelper":false,"showChaosBagManager":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showSearchAssistant":[],"showTitleSplash":true,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}} diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index a1393669..d5178b80 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -850,15 +850,14 @@ end -- called by the language selection dropdown function languageSelected(_, selectedIndex, id) - optionPanel[id] = LANGUAGES[tonumber(selectedIndex) + 1].name + optionPanel[id] = LANGUAGES[tonumber(selectedIndex) + 1].code end -function returnLanguageId(name) +-- returns the ID (position in the table) for a provided language code +function returnLanguageId(code) for index, tbl in ipairs(LANGUAGES) do - for key, value in pairs(tbl) do - if key == "name" and value == name then - return index - end + if tbl.code == code then + return index end end end diff --git a/xml/OptionPanel.xml b/xml/OptionPanel.xml index f65a7aa9..c8f08bde 100644 --- a/xml/OptionPanel.xml +++ b/xml/OptionPanel.xml @@ -115,7 +115,7 @@ Card language - Downloading a supported campaign or importing a deck will use this language for the cards. + Downloading a campaign or importing a deck will use this language (if available).