local G=import("\046\046\047\073\110\115\116\097\110\099\101")local q=import("\046\046\047\102\117\110\099\116\105\111\110\115\047\116\121\112\101\111\102")describe("\105\110\115\116\097\110\099\101\115\046\076\111\099\097\108\105\122\097\116\105\111\110\084\097\098\108\101",function()it("\115\104\111\117\108\100 \105\110\115\116\097\110\116\105\097\116\101",function()local q=G.new("\076\111\099\097\108\105\122\097\116\105\111\110\084\097\098\108\101")assert.not_nil(q)end)describe("\083\111\117\114\099\101\076\111\099\097\108\101\073\100",function()it("\115\104\111\117\108\100 \098\101 \097 \115\116\114\105\110\103",function()local K=G.new("\076\111\099\097\108\105\122\097\116\105\111\110\084\097\098\108\101")assert.equals(q(K.SourceLocaleId),"\115\116\114\105\110\103")end)it("\115\104\111\117\108\100 \098\101 \119\114\105\116\101\097\098\108\101",function()local q=G.new("\076\111\099\097\108\105\122\097\116\105\111\110\084\097\098\108\101")local K="\084\101\115\116\086\097\108\117\101"q.SourceLocaleId=K assert.equals(q.SourceLocaleId,K)end)end)it("\115\104\111\117\108\100 \116\114\097\110\115\108\097\116\101 \116\101\120\116",function()local q=G.new("\076\111\099\097\108\105\122\097\116\105\111\110\084\097\098\108\101")local K="\t\t\t\091\n\t\t\t\t\123\n\t\t\t\t\t\"\107\101\121\"\058 \"\084\069\083\084\095\083\084\082\073\078\071\"\044\n\t\t\t\t\t\"\118\097\108\117\101\115\"\058 \123\n\t\t\t\t\t\t\"\101\115-\109\120\"\058 \"\083\080\065\078\073\083\072\"\044\n\t\t\t\t\t\t\"\101\110-\117\115\"\058 \"\086\065\076\085\069\"\n\t\t\t\t\t\125\n\t\t\t\t\125\n\t\t\t\093\n\t\t"q:SetContents(K)assert.equals(q:GetString("\101\110-\117\115","\084\069\083\084\095\083\084\082\073\078\071"),"\086\065\076\085\069")assert.equals(q:GetString("\101\115-\109\120","\084\069\083\084\095\083\084\082\073\078\071"),"\083\080\065\078\073\083\072")assert.equals(q:GetString("\108\097\110\103\117\097\103\101-\110\111\116-\100\101\102\105\110\101\100","\084\069\083\084\095\083\084\082\073\078\071"),nil)assert.equals(q:GetString("\101\110-\117\115","\083\084\082\073\078\071\095\075\069\089\095\078\079\084\095\068\069\070\073\078\069\068"),nil)end)end)
local Instance = import("../Instance")
local typeof = import("../functions/typeof")

describe("instances.LocalizationTable", function()
	it("should instantiate", function()
		local instance = Instance.new("LocalizationTable")

		assert.not_nil(instance)
	end)

	describe("SourceLocaleId", function()
		it("should be a string", function()
			local instance = Instance.new("LocalizationTable")
			assert.equals(typeof(instance.SourceLocaleId), "string")
		end)

		it("should be writeable", function()
			local instance = Instance.new("LocalizationTable")
			local value = "TestValue"
			instance.SourceLocaleId = value
			assert.equals(instance.SourceLocaleId, value)
		end)
	end)

	it("should translate text", function()
		local instance = Instance.new("LocalizationTable")

		local translationDictionary = [[
			[
				{
					"key": "TEST_STRING",
					"values": {
						"es-mx": "SPANISH",
						"en-us": "VALUE"
					}
				}
			]
		]]

		instance:SetContents(translationDictionary)

		assert.equals(instance:GetString("en-us", "TEST_STRING"), "VALUE")
		assert.equals(instance:GetString("es-mx", "TEST_STRING"), "SPANISH")
		assert.equals(instance:GetString("language-not-defined", "TEST_STRING"), nil)
		assert.equals(instance:GetString("en-us", "STRING_KEY_NOT_DEFINED"), nil)
	end)
end)