View Single Post
03/16/22, 10:08 AM   #8
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Originally Posted by Kelinmiriel View Post
I would love to see an addon like that.

If you make it, make sure you set it up from the beginning to use localization support. When I created my addon a few years ago, I knew nothing about writing addons when I started it, and I wish I had started it with localization support. It's the biggest regret I have about it. I'm going to have to completely re-write the thing at this point to do that. Which I will, when I get a chance, because it's important.
I totally agree here!
Here is an example how to easily add localization via extra language files in your txt file of your addon:
Code:
path/lang/en.lua
path/lang/$(language).lua
https://wiki.esoui.com/How_to_add_localization_support

I would though not use the ZO_CreateStringId approach (like described at the Wiki link above) here as you need to create SO MANY new texts!

Just build yourself a table like
Code:
myAddon = {}
And add a localization subTable:
Code:
myAddon.localization = {}
In the language file en.lua, which get's loaded by default (as fallback e.g.) add the texts in there:
Code:
myAddon.localization = {
  [questId1] = {
    ["text1"] = "Hello world",
    ["text2"] = "Hello world2",
   ...
   },
  [questId1] = {
    ["text1"] = "Hello world",
    ["text2"] = "Hello world2",
   ...
   },
 ...
}
And in the other language files de.lua, fr.lua, ru.lua etc. do the same so they will just overwrite the table myAddon.localization with the appropriate client language texts.
  Reply With Quote