This contains the source code documentation of the class DialogicCsvFile
.
DialogicCsvFile
Inherits: RefCounted
Handles translation of a DialogicTimeline to a CSV file.
Properties
Name | Type | Default |
---|---|---|
lines | PackedStringArray[] | [] |
old_lines | Dictionary | {} |
column_count | int | 0 |
is_new_file | bool | false |
file | FileAccess | |
used_file_path | String | |
updated_rows | int | 0 |
new_rows | int | 0 |
add_separator | bool | false |
Methods
Returns | Method |
---|---|
void | collect_lines_from_characters ( characters : Dictionary ) |
void | add_translation_keys_to_glossary ( glossary : DialogicGlossary ) |
void | collect_lines_from_glossary ( glossary : DialogicGlossary ) |
void | collect_lines_from_timeline ( timeline : DialogicTimeline ) |
void | update_csv_file_on_disk ( ) |
Constants
No description available.
No description available.
No description available.
const TRANSLATION_ID = "_translation_id"
No description available.
Property Descriptions
No description available.
Dictionary of lines from the original file. Key: String, Value: PackedStringArray
The amount of columns the CSV file has after loading it. Used to add trailing commas to new lines.
Whether this CSV file was able to be loaded a defined file path.
The underlying file used to read and write the CSV file.
File path used to load the CSV file.
The amount of events that were updated in the CSV file.
The amount of events that were added to the CSV file.
Whether this CSV handler should add newlines as a separator between sections. A section may be a new character, new timeline, or new glossary item inside a per-project file.
Method Descriptions
func collect_lines_from_characters ( characters
: Dictionary ) ⇒ void
Collects names from the given characters
and adds them to the lines
. If this is the character name CSV file, use this method to take previously collected characters from other DialogicCsvFiles.
func add_translation_keys_to_glossary ( glossary
: DialogicGlossary ) ⇒ void
Reads all lines
and adds them to the given glossary
's internal collection of words-to-translation-key mappings. Populate the CSV's lines with the method collect_lines_from_glossary before.
func collect_lines_from_glossary ( glossary
: DialogicGlossary ) ⇒ void
Collects properties from glossary entries from the given glossary
and adds them to the lines
.
func collect_lines_from_timeline ( timeline
: DialogicTimeline ) ⇒ void
Collects translatable events from the given timeline
and adds them to the lines
.
func update_csv_file_on_disk ( ) ⇒ void
Clears the CSV file on disk and writes the current lines
array to it. Uses the old_lines
dictionary to update existing translations. If a translation row misses a column, a trailing comma will be added to conform to the CSV file format. If the locale CSV line was collected only, a new file won't be created and already existing translations won't be updated.