Skip to content

Instantly share code, notes, and snippets.

@karljj1
Created February 5, 2024 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karljj1/d448e71ba8f396555a04d5b07260da00 to your computer and use it in GitHub Desktop.
Save karljj1/d448e71ba8f396555a04d5b07260da00 to your computer and use it in GitHub Desktop.
Example of removing a locale and its assets
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));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment