docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetStringTableCollections

    GetStringTableCollections()

    Returns all StringTableCollection that are in the project.

    Declaration
    public static ReadOnlyCollection<StringTableCollection> GetStringTableCollections()
    Returns
    Type Description
    ReadOnlyCollection<StringTableCollection>
    Examples

    This example shows how to print out the contents of all the StringTableCollection in the project.

    [MenuItem("Localization Samples/Print All String Table Collection Contents")]
    public static void PrintStringTableCollectionContents()
    {
        // This example prints out the contents of every String Table Collection
        var stringBuilder = new StringBuilder();
        foreach (var stringTableCollection in LocalizationEditorSettings.GetStringTableCollections())
        {
            stringBuilder.AppendLine($"String Table Collection Name: {stringTableCollection.TableCollectionName}");
            foreach (var stringTable in stringTableCollection.StringTables)
            {
                stringBuilder.AppendLine($"\tTable {stringTable.LocaleIdentifier}");
                foreach (var stringTableValue in stringTable.Values)
                {
                    stringBuilder.AppendLine($"\t\t{stringTableValue.Key} - {stringTableValue.LocalizedValue}");
                    if (stringTableValue.MetadataEntries.Count > 0)
                    {
                        foreach (var metadataEntry in stringTableValue.MetadataEntries)
                        {
                            stringBuilder.AppendLine($"\t\t\t{metadataEntry}");
                        }
                    }
                }
            }
        }
    
        Debug.Log(stringBuilder.ToString());
    }
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)