#1: Add i18n support with basic translations from a translation service.

Flightkick [01-22-21 - 00:59]
#1: Add i18n support with basic translations from a translation service.
Filename
Outkasted.lua
Outkasted.txt
OutkastedMenu.lua
README.md
i18n/README.md
i18n/de.lua
i18n/en.lua
i18n/fr.lua
i18n/ru.lua
diff --git a/Outkasted.lua b/Outkasted.lua
index 1ab7c27..a0db395 100644
--- a/Outkasted.lua
+++ b/Outkasted.lua
@@ -42,50 +42,6 @@ function Outkasted.LeaveInstance(confirm)
 	end
 end

-function Outkasted.SetupLibHistCallback()
-	log:Debug("OUTKASTED >> Initializing LibHistoire Callback")
-	LibHistoire:RegisterCallback(LibHistoire.callback.INITIALIZED, function()
-		log:Debug("OUTKASTED >> LibHistoire Initialized callback received")
-		local function SetUpListener(guildId, category)
-			log:Debug("OUTKASTED >> Setting up listener for guild " .. guildId .. " with category " .. category)
-			local listener = LibHistoire:CreateGuildHistoryListener(guildId, category)
-			local key = listener:GetKey()
-			log:Debug("OUTKASTED >> Key: " .. key)
-			listener:SetAfterEventId(StringToId64(saveData.lastEventId[key]))
-
-			listener:SetNextEventCallback(function(eventType, eventId, eventTime, param1, param2, param3, param4, param5, param6)
-				-- the events received by this callback are in the correct historic order
-				log:Debug("OUTKASTED >> NEC >> eventType: " .. eventType)
-				log:Debug("OUTKASTED >> NEC >> eventId: " .. eventId)
-				log:Debug("OUTKASTED >> NEC >> eventTime: " .. eventTime)
-				log:Debug("OUTKASTED >> NEC >> param1: " .. param1)
-				log:Debug("OUTKASTED >> NEC >> param2: " .. param2)
-				log:Debug("OUTKASTED >> NEC >> param3: " .. param3)
-				log:Debug("OUTKASTED >> NEC >> param4: " .. param4)
-				log:Debug("OUTKASTED >> NEC >> param5: " .. param5)
-				log:Debug("OUTKASTED >> NEC >> param6: " .. param6)
-				saveData.lastEventId[key] = Id64ToString(eventId)
-			end)
-
-			listener:SetMissedEventCallback(function(eventType, eventId, eventTime, param1, param2, param3, param4, param5, param6)
-				log:Debug("OUTKASTED >> MEC >> eventType: " .. eventType)
-				log:Debug("OUTKASTED >> MEC >> eventId: " .. eventId)
-				log:Debug("OUTKASTED >> MEC >> eventTime: " .. eventTime)
-				log:Debug("OUTKASTED >> MEC >> param1: " .. param1)
-				log:Debug("OUTKASTED >> MEC >> param2: " .. param2)
-				log:Debug("OUTKASTED >> MEC >> param3: " .. param3)
-				log:Debug("OUTKASTED >> MEC >> param4: " .. param4)
-				log:Debug("OUTKASTED >> MEC >> param5: " .. param5)
-				log:Debug("OUTKASTED >> MEC >> param6: " .. param6)
-				-- events in this callback are out of order compared to what has been received by the next event callback and can even have an eventId smaller than what has been specified via SetAfterEventId.
-			end)
-			listener:Start()
-		end
-
-		SetUpListener(Outkasted.guildId, GUILD_HISTORY_GENERAL)
-	end)
-end
-
 function Outkasted.OnAddOnLoaded(_, addonName)
 	if addonName ~= Outkasted.name then return end
 	EVENT_MANAGER:UnregisterForEvent(Outkasted.name, EVENT_ADD_ON_LOADED)
@@ -93,10 +49,7 @@ function Outkasted.OnAddOnLoaded(_, addonName)

 	Outkasted.initMenu()

-	ZO_CreateStringId("SI_BINDING_NAME_TP_OUTKASTED_GUILD_HALL", GetString(OUTK_CONTROLS_TP_OUTKASTED_GUILD_HALL))
 	SLASH_COMMANDS["/guildhall"] = function() Outkasted.TeleportToGuildHall() end
-
-	ZO_CreateStringId("SI_BINDING_NAME_LEAVE_INSTANCE", GetString(OUTK_CONTROLS_LEAVE_INSTANCE))
 	SLASH_COMMANDS["/out"] = function() Outkasted.LeaveInstance(false) end

 	SLASH_COMMANDS["/website"] = function() RequestOpenUnsafeURL(Outkasted.website) end
@@ -104,4 +57,3 @@ function Outkasted.OnAddOnLoaded(_, addonName)
 end

 EVENT_MANAGER:RegisterForEvent(Outkasted.name, EVENT_ADD_ON_LOADED, Outkasted.OnAddOnLoaded)
-Outkasted.SetupLibHistCallback()
diff --git a/Outkasted.txt b/Outkasted.txt
index 85ada72..1e095ca 100644
--- a/Outkasted.txt
+++ b/Outkasted.txt
@@ -15,3 +15,6 @@
 bindings.xml
 Outkasted.lua
 OutkastedMenu.lua
+
+i18n/en.lua
+i18n/$(language).lua
diff --git a/OutkastedMenu.lua b/OutkastedMenu.lua
index 92216e5..131b232 100644
--- a/OutkastedMenu.lua
+++ b/OutkastedMenu.lua
@@ -13,7 +13,7 @@ function Outkasted.initMenu()
 		author = "Flightkick",
 		version = Outkasted.version,
 		registerForRefresh = true,
-		website = "https://flightkick.gitlab.io/outkasted-website/",
+		website = "https://github.com/Flightkick/eso-outkasted-guild-addon",
 	}

 	local optionsData = {
diff --git a/README.md b/README.md
index 4aed3e6..0570ea7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
 # Outkasted Guild Add-On for ESO
-This is where the source code of the Outkasted Guild Add-On for the Elder Scrolls Online game is hosted.
+Outkasted is a guild in the Elder Scrolls Online, you can find our website here: https://outkastedguild.com
+This is where the source code of the Outkasted Guild Add-On is hosted.

 You can find the Add-On on esoui here: https://www.esoui.com/downloads/info2881-Outkasted.html
 It is recommended to download the Add-On with an Add-On manager like Minion https://minion.mmoui.com/
diff --git a/i18n/README.md b/i18n/README.md
new file mode 100644
index 0000000..ced7cdd
--- /dev/null
+++ b/i18n/README.md
@@ -0,0 +1,6 @@
+# i18n
+ESO has reserved filenames for files with the `_?(en|de|fr|ru).lua` pattern. Only the file for the current language is loaded.
+
+To quickly switch client language, use `/script SetCVar("language.2", "fr")` obviously with the correct language code.
+
+This Add-On only contains translations for public facing text. Internal debugging is always in English.
diff --git a/i18n/de.lua b/i18n/de.lua
new file mode 100644
index 0000000..eb0bdd8
--- /dev/null
+++ b/i18n/de.lua
@@ -0,0 +1,13 @@
+local strings = {
+    OUTK_LEAVEINSTANCE_ZOS_REPORTS_NOT_IN_TRIAL = "ZOS meldet, dass Sie sich derzeit nicht in einem Dungeon oder einer Prüfung befinden, aber da diese API instabil zu sein scheint, lassen Sie mich trotzdem versuchen, Sie herauszuholen.",
+    OUTK_LEAVEINSTANCE_EXITING_INSTANCE = "Verlassen der Instanz",
+
+    -- Key bindings
+    SI_BINDING_NAME_TP_OUTKASTED_GUILD_HALL = "Teleport zum Gildenhaus von Outkasted",
+    SI_BINDING_NAME_LEAVE_INSTANCE = "Instanz verlassen",
+}
+
+for stringId, stringValue in pairs(strings) do
+    ZO_CreateStringId(stringId, stringValue)
+    SafeAddVersion(stringId, 1)
+end
diff --git a/i18n/en.lua b/i18n/en.lua
new file mode 100644
index 0000000..64ea1ea
--- /dev/null
+++ b/i18n/en.lua
@@ -0,0 +1,13 @@
+local strings = {
+    OUTK_LEAVEINSTANCE_ZOS_REPORTS_NOT_IN_TRIAL = "ZOS reports you're currently not inside a dungeon or trial but since this API seems unstable let me try to get you out anyway.",
+    OUTK_LEAVEINSTANCE_EXITING_INSTANCE = "Exiting instance",
+
+    -- Key bindings
+    SI_BINDING_NAME_TP_OUTKASTED_GUILD_HALL = "Teleport to Outkasted guild house",
+    SI_BINDING_NAME_LEAVE_INSTANCE = "Leave instance",
+}
+
+for stringId, stringValue in pairs(strings) do
+    ZO_CreateStringId(stringId, stringValue)
+    SafeAddVersion(stringId, 1)
+end
diff --git a/i18n/fr.lua b/i18n/fr.lua
new file mode 100644
index 0000000..ff6462f
--- /dev/null
+++ b/i18n/fr.lua
@@ -0,0 +1,13 @@
+local strings = {
+    OUTK_LEAVEINSTANCE_ZOS_REPORTS_NOT_IN_TRIAL = "Le ZOS signale que vous n'êtes actuellement pas dans un donjon ou un procès mais comme cette API semble instable, laissez-moi quand même essayer de vous en faire sortir.",
+    OUTK_LEAVEINSTANCE_EXITING_INSTANCE = "Instance sortante",
+
+    -- Key bindings
+    SI_BINDING_NAME_TP_OUTKASTED_GUILD_HALL = "Téléport à la maison de guilde Outkasted",
+    SI_BINDING_NAME_LEAVE_INSTANCE = "Laisser l'instance",
+}
+
+for stringId, stringValue in pairs(strings) do
+    ZO_CreateStringId(stringId, stringValue)
+    SafeAddVersion(stringId, 1)
+end
diff --git a/i18n/ru.lua b/i18n/ru.lua
new file mode 100644
index 0000000..f3457b3
--- /dev/null
+++ b/i18n/ru.lua
@@ -0,0 +1,13 @@
+local strings = {
+    OUTK_LEAVEINSTANCE_ZOS_REPORTS_NOT_IN_TRIAL = "ZOS сообщает, что в настоящее время вы не находитесь в подземелье или в суде, но так как этот API кажется нестабильным, позвольте мне попытаться вытащить вас в любом случае.",
+    OUTK_LEAVEINSTANCE_EXITING_INSTANCE = "Выходящая инстанция",
+
+    -- Key bindings
+    SI_BINDING_NAME_TP_OUTKASTED_GUILD_HALL = "Телепорт в дом гильдии \"Отверженные\".",
+    SI_BINDING_NAME_LEAVE_INSTANCE = "Оставить заявку",
+}
+
+for stringId, stringValue in pairs(strings) do
+    ZO_CreateStringId(stringId, stringValue)
+    SafeAddVersion(stringId, 1)
+end