local e=import("\046\047\066\097\115\101\073\110\115\116\097\110\099\101")local f=import("\046\046\047\073\110\115\116\097\110\099\101\080\114\111\112\101\114\116\121")local O=import("\046\046\047\106\115\111\110")local k=e:extend("\076\111\099\097\108\105\122\097\116\105\111\110\084\097\098\108\101",{creatable=true})k.properties.SourceLocaleId=f.normal({getDefault=function()return"\101\110-\117\115"end})function k.init(f,e)(getmetatable(e)).instance.contents={}end function k.prototype.SetContents(f,e)(getmetatable(f)).instance.contents=O.decode(e)end function k.prototype.GetString(O,e,f)local k=(getmetatable(O)).instance.contents for O,k in ipairs(k)do if k.key==f then return k.values[e]end end return nil end return k
local BaseInstance = import("./BaseInstance")
local InstanceProperty = import("../InstanceProperty")
local json = import("../json")

local LocalizationTable = BaseInstance:extend("LocalizationTable", {
	creatable = true,
})

LocalizationTable.properties.SourceLocaleId = InstanceProperty.normal({
	getDefault = function()
		return "en-us"
	end,
})

function LocalizationTable:init(instance)
	getmetatable(instance).instance.contents = {}
end

function LocalizationTable.prototype:SetContents(contents)
	getmetatable(self).instance.contents = json.decode(contents)
end

function LocalizationTable.prototype:GetString(targetLocaleId, key)
	local contents = getmetatable(self).instance.contents

	for _, entry in ipairs(contents) do
		if entry.key == key then
			return entry.values[targetLocaleId]
		end
	end

	return nil
end

return LocalizationTable