How to bulk generate missing localization tables for new locales?

Is there an option to bulk generate any missing locale string tables for all collections rather than manually selecting each collection and pressing the add buttons manually?


This is a bit of a chore to do any time a new language will be added. Importing a CSV with a new language added does not automatically add the locales either.

If there’s not an option in the UI to do this, is there a code sample or documentation that I could reference to make an editor script to handle this?

Thank you.

Hi,
There’s no way to do this through the UI, but I will add a task to look into adding one to our backlog.
You can do this through script.

This should do what you need:

[MenuItem("Localization/Add Missing Tables")]
public static void AddMissingTables()
{
    foreach (var stringTableCollection in LocalizationEditorSettings.GetStringTableCollections())
    {
        foreach (var locale in LocalizationEditorSettings.GetLocales())
        {
            var table = stringTableCollection.GetTable(locale.Identifier);
            if (table == null)
            {
                // Add table
                table = stringTableCollection.AddNewTable(locale.Identifier);
            }
        }
    }
}
2 Likes

That does the trick, thank you for your assistance!

1 Like