Class LocaleColumns
Represents the localized value and Comment metadata from a StringTable.
Inherited Members
Namespace: UnityEditor.Localization.Plugins.CSV.Columns
Syntax
[Serializable]
public class LocaleColumns : CsvColumns, ISerializationCallbackReceiver
Properties
CommentFieldName
The comments field name when exporting and importing. When importing this name will be checked against the headers to determine if the field is present in the CSV data.
Declaration
public string CommentFieldName { get; set; }
Property Value
Type | Description |
---|---|
String |
FieldName
The value field name when exporting and importing. When importing this name will be checked against the headers to determine if the field is present in the CSV data.
Declaration
public string FieldName { get; set; }
Property Value
Type | Description |
---|---|
String |
IncludeComments
Should the Comment metadata be exported as a separate column?
Declaration
public bool IncludeComments { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
LocaleIdentifier
Used to extract the StringTable from the StringTableCollection when importing and exporting.
Declaration
public LocaleIdentifier LocaleIdentifier { get; set; }
Property Value
Type | Description |
---|---|
LocaleIdentifier |
Methods
ReadBegin(StringTableCollection, CsvReader)
Called when reading a CSV file column header row.
This call should be used to determine which column indexes to use during ReadRow(SharedTableData.SharedTableEntry, CsvReader).
Use reader.GetFieldIndex("Column Header", isTryGet: true)
to check for a column with a matching name.
Declaration
public override void ReadBegin(StringTableCollection collection, CsvReader csvReader)
Parameters
Type | Name | Description |
---|---|---|
StringTableCollection | collection | The target collection the CSV file is being imported into. |
CsvReader | csvReader | Provides acces to the CSV file. |
Overrides
ReadEnd(StringTableCollection)
Called when the CSV file has been imported. This can be used to perform any required cleanup.
Declaration
public override void ReadEnd(StringTableCollection collection)
Parameters
Type | Name | Description |
---|---|---|
StringTableCollection | collection | The target collection the CSV file was imported into. |
Overrides
ReadRow(SharedTableData.SharedTableEntry, CsvReader)
Called when reading each row of the CSV file. Unity recommends to store the indexes of the rows you are
interested in during ReadBegin(StringTableCollection, CsvReader) and then use them to access the row using reader.GetField
.
Declaration
public override void ReadRow(SharedTableData.SharedTableEntry keyEntry, CsvReader reader)
Parameters
Type | Name | Description |
---|---|---|
SharedTableData.SharedTableEntry | keyEntry | The current entry being read. |
CsvReader | reader | Provides read access to the CSV file. |
Overrides
SetDefaultFieldNames()
Sets the field names to their default values. The default values are UnityEngine.Localization.LocaleIdentifier.ToString for FieldName and FieldName + " Comments" for CommentFieldName.
Declaration
public void SetDefaultFieldNames()
WriteBegin(StringTableCollection, CsvWriter)
Called when writing the header row of the CSV file.
Each column that will be written to during WriteRow(SharedTableData.SharedTableEntry, IList<StringTableEntry>, CsvWriter) should have
its column header written here using writer.WriteField("Header Title")
.
Declaration
public override void WriteBegin(StringTableCollection collection, CsvWriter csvWriter)
Parameters
Type | Name | Description |
---|---|---|
StringTableCollection | collection | The collection being exported. |
CsvWriter | csvWriter | Provides access to write to a CSV file. |
Overrides
WriteRow(SharedTableData.SharedTableEntry, IList<StringTableEntry>, CsvWriter)
Called when writing each row of the CSV file. This is called in the same order as WriteBegin(StringTableCollection, CsvWriter) and expects each
column that was written to be populated each time. If a column will not always contain a value, you can use writer.WriteField(string.Empty)
.
Declaration
public override void WriteRow(SharedTableData.SharedTableEntry keyEntry, IList<StringTableEntry> tableEntries, CsvWriter writer)
Parameters
Type | Name | Description |
---|---|---|
SharedTableData.SharedTableEntry | keyEntry | The shared table data for the current entry that is being written to the row. |
IList<StringTableEntry> | tableEntries | The locale specific table entries for this row. |
CsvWriter | writer | Provides write acces to the CSV file. |