Method CreateStringTableCollection
CreateStringTableCollection(string, string)
Creates a StringTableCollection using the project Locales.
Declaration
public static StringTableCollection CreateStringTableCollection(string tableName, string assetDirectory)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the new collection. Cannot be blank or whitespace, cannot contain invalid filename characters, and cannot contain "[]". |
string | assetDirectory | The directory to save the generated assets, must be in the project Assets directory. |
Returns
Type | Description |
---|---|
StringTableCollection | The created StringTableCollection collection. |
Examples
This example shows how to create a new StringTableCollection and add some English values.
var newCollection = LocalizationEditorSettings.CreateStringTableCollection("My Strings", "Assets/String Tables");
var table = newCollection.GetTable("en") as StringTable;
table.AddEntry("START_MENU", "Start Game");
table.AddEntry("OPTIONS_MENU", "Options");
table.AddEntry("EXIT_MENU", "Quit");
// Mark modified assets dirty so changes are saved.
EditorUtility.SetDirty(table);
EditorUtility.SetDirty(table.SharedData);
CreateStringTableCollection(string, string, IList<Locale>)
Creates a StringTableCollection using the provided Locales.
Declaration
public static StringTableCollection CreateStringTableCollection(string tableName, string assetDirectory, IList<Locale> selectedLocales)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the new collection. Cannot be blank or whitespace, cannot contain invalid filename characters, and cannot contain "[]". |
string | assetDirectory | The directory to save the generated assets, must be in the project Assets directory. |
IList<Locale> | selectedLocales | The locales to generate the collection with. A StringTable will be created for each Locale. |
Returns
Type | Description |
---|---|
StringTableCollection | The created StringTableCollection collection. |
Examples
This example shows how to create a new StringTableCollection which contains an English and Japanese StringTable.
var english = LocalizationEditorSettings.GetLocale("en-GB");
var japanese = LocalizationEditorSettings.GetLocale(SystemLanguage.Japanese);
// Create a collection with a English (UK) and Japanese table
var newCollection = LocalizationEditorSettings.CreateStringTableCollection("My Strings", "Assets/String Tables", new List<Locale> { english, japanese });
var table = newCollection.GetTable("en") as StringTable;
table.AddEntry("START_MENU", "Start Game");
table.AddEntry("OPTIONS_MENU", "Options");
table.AddEntry("EXIT_MENU", "Quit");