How to localize an array of strings in script

Hi,

I am trying to get localization with the Localization package to work with some strings in my script. But I’m not sure how to achieve that. This is what I’ve got so far:

[SerializeField] private LocalizedString[] myStrings;

private string[] localizedTexts  = new string[16];

private void OnEnable()
{
    for (int i = 0; i < myStrings.Length; i++)
    {
        myStrings*.StringChanged += UpdateString;*

}
}

private void OnDisable()
{
for (int i = 0; i < myStrings.Length; i++)
{
myStrings*.StringChanged -= UpdateString;*
}
}

private void UpdateString(string s)
{
localizedTexts[0] = s;
}
What I want to accomplish is for the localized text in myStrings at a given index to go into localizedTexts at the same index. E.g. the localized text in myStrings[4] should be passed to localizedTexts[4], instead of always being passed to index 0 as the script is written now.
I’ve never accessed Unity’s localization system through scripting before, so I do not know of any preferred practices.

CODE NOT TESTED

[SerializeField] private LocalizedString[] myStrings;
private ChangeHandler[] callbacks;
private string[] localizedTexts;

private void OnEnable()
{
    callbacks = new ChangeHandler[myStrings.Length];
    localizedTexts = new string[myStrings.Length];
    for (int i = 0; i < myStrings.Length; i++)
    {
        int index = i;// needed to avoid closure problem
        callbacks *= delegate(string s){ localizedTexts[index] = s; }*

myStrings_.StringChanged += callbacks*;
}
}*_

private void OnDisable()
{
for (int i = 0; i < myStrings.Length; i++)
{
myStrings_.StringChanged -= callbacks*;
}
}*_