From 37b6613c4a34e9c9af2a554474a39601e7805ab2 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 14 Apr 2019 11:25:28 +0200 Subject: [PATCH] lang: adapt lang name functions to the new medata format --- gamecore/lang.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gamecore/lang.lua b/gamecore/lang.lua index 0e0f33d..95cfd85 100644 --- a/gamecore/lang.lua +++ b/gamecore/lang.lua @@ -60,14 +60,20 @@ function LanguageManager:getStringList(library, file) return require(self.lang .. "." .. library .. "." .. file) end +function LanguageManager:getLangMetadata(lang) + local langfilepath = self.data.path .. lang + + return require(langfilepath) +end + function LanguageManager:getLangName(lang) - local langnames = langs.available_langs - return langnames[lang] + local metadata = self:getLangMetadata(lang) + + return metadata.name end function LanguageManager:getCurrentLangName() - local langnames = langs.available_langs - return langnames[self.lang] + return self:getLangName(self.data.current) end return LanguageManager