lang: return datas instead of directly putting them in self.datas
This commit is contained in:
parent
f40d2c9912
commit
59029068f1
1 changed files with 5 additions and 4 deletions
|
@ -31,8 +31,8 @@ local TRANSLATION_PATH = "datas/languages/"
|
|||
|
||||
function LanguageManager:new(controller)
|
||||
self.controller = controller
|
||||
self.datas = self:getTranslationData()
|
||||
self:setLang(self.controller.options.data.language)
|
||||
self:getTranslationData()
|
||||
end
|
||||
|
||||
function LanguageManager:setLang(lang)
|
||||
|
@ -46,12 +46,13 @@ end
|
|||
function LanguageManager:getTranslationData()
|
||||
local _path = TRANSLATION_PATH .. "init.lua"
|
||||
local fileinfo = love.filesystem.getInfo(_path)
|
||||
local datas = nil
|
||||
|
||||
if fileinfo ~= nil then
|
||||
self.datas = require(TRANSLATION_PATH)
|
||||
else
|
||||
self.datas = nil
|
||||
datas = require(TRANSLATION_PATH)
|
||||
end
|
||||
|
||||
return datas
|
||||
end
|
||||
|
||||
function LanguageManager:getStringList(library, file)
|
||||
|
|
Loading…
Reference in a new issue