How to delete localization string tables (and others)

I started using the localization package provided by unity and I already am having trouble managing string tables. I can’t figure out how to delete a table through the UI. So I went to the assets created for the table and deleted them manually. Now I get a warning indicating that the table is obviously still being referenced by the chain of assets and dont really know what to do.

The table’s name was settings

Collection settings is invalid and will be ignored because SharedTableData is null.
UnityEditor.Localization.UI.LocalizationTablesWindow:OnEnable () (at Library/PackageCache/com.unity.localization@1.0.5/Editor/UI/Tables/LocalizationTablesWindow.cs:102)

Looking in the documentation didn’t tell me how to delete these assets.

I looked in the Addressable Groups and did not see the old table in there.

Did you want to delete the whole collection or just a single language? There are at least 3 assets you need to delete if you want to delete the whole thing.
Shared table data, collection asset and the table.
Could you please file a bug report with the issues you are having so we can improve it?
Table deletion is not an area we have a lot of support for.

Hey Karl. I am talking about just the string table. So like I create a table, end up not wanting it anymore, then delete.

Seems like bad design to not allow the deletion of a table as if Localization is an add only feature. I will file a bug to bring this to light.

A single table can be removed through the collection editor. Select the collection asset and the option is in the inspector. Once it’s removed you can delete it.

How do we delete a WHOLE locale in unity 2022.3.18f1?? because everyday i open up the project to keep working on it i have the surprise that the files regarding a certain language that we wont longer support appear again.

Did you delete all the string/asset tables for that locale?

You mean like one by one? shouldnt that be automatic? and if its not, is there any way to really wipe everything related to a certain language of the project, that wouldnt be as time consuming as going over houndreds of files? (we are making a narrative game, so its really heavy on text)

Deleting a locale won’t touch the string tables. We don’t have support for deleting an entire language, it’s not something people typically do. We do have plans for disabling languages in the future. For now you will need to delete the string tables for the language you are removing. You could write a script to iterate through the string tables collections and do it. LocalizationEditorSettongs.GetStringTableCollections().

oof, sounds like a nightmare. can you help me with a more practical example? lets say how would it be a script to erase portuguese and italian?

Something like this should do it

public static void RemoveLocale(LocaleIdentifier localeIdentifier)
{
    foreach (var collectionStrings in LocalizationEditorSettings.GetStringTableCollections())
    {
        var table = collectionStrings.GetTable(localeIdentifier);
        if (table != null)
        {
            collectionStrings.RemoveTable(table);
            AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(table));
        }
    }

    foreach (var collectionAssets in LocalizationEditorSettings.GetAssetTableCollections())
    {
        var table = collectionAssets.GetTable(localeIdentifier);
        if (table != null)
        {
            collectionAssets.RemoveTable(table);
            AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(table));
        }
    }

    var locale = LocalizationEditorSettings.GetLocale(localeIdentifier);
    if (locale != null)
    {
        LocalizationEditorSettings.RemoveLocale(locale);
        AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(locale));
    }
}
3 Likes