hi there
im trying to create an editor tool that copies certain entries with their keys and table meta data for each locale from a table to another, but when i run the code it will only copy the keys without any table meta data.
how can i fix this problem ?
here is my code:
void CopyKeys(bool find)
{
int counter = 0;
var initialTable = LocalizationEditorSettings.GetStringTableCollection(fromTable);
var finalTable = LocalizationEditorSettings.GetStringTableCollection(toTable);
for (int i = 0; i < initialTable.SharedData.Entries.Count; i++)
{
if (initialTable.SharedData.Entries[i].Key.Contains(searchString))
{
counter++;
if (!find)
{
int id = finalTable.SharedData.Entries.Count;
finalTable.SharedData.Entries.Add(initialTable.SharedData.Entries[i]);
finalTable.SharedData.Entries[id].Metadata = initialTable.SharedData.Entries[i].Metadata;
EditorUtility.SetDirty(finalTable);
EditorUtility.SetDirty(finalTable.SharedData);
}
}
}
if (!find)
Debug.Log("Added " + counter + " Entries");
else
Debug.Log("Found " + counter + " Entries");
}
thanks
↧