Skip to content

Spreadsheet

At some point you may look for an option to compile all the project scenario script and managed text localizations into spreadsheets. For example, you may want to share the text with a translation agency or editors for proofreading.

Spreadsheet tool allows extracting all the localizable text from the project to .csv sheets and then import it back.

cover

Usage

Before exporting the project data, always generate localization data with the localization tool (Naninovel -> Tools -> Localization). You can generate resources for all the locales defined in the project at once by selecting the localization root directory (Resources/Naninovel/Localization by default) for the Locale Folder property.

cover

For more information on how to use the tool, see localization guide.

When the localization data is up-to-date, open spreadsheet tool with Naninovel -> Tools -> Spreadsheet editor menu.

cover

Specify the required folders:

  • Input Script Folder — folder where you store source naninovel scenario scripts (.nani); usually in our example projects we store them under Assets/Scenario folder.
  • Input Text Folder — folder where managed text documents are generated to; it's Assets/Resources/Naninovel/Text by default. Make sure to generate managed text documents via associated tool in case the folder is missing.
  • Input Localization Folder — localization root where resources for all the different locales are stored; Assets/Resources/Naninovel/Localization by default.
  • Output Folder — folder where to store generated or import edited sheets from.

Click "Export" button to export sheets to the selected destination.

Each script and managed text document will be exported to an individual sheet. Each sheets will have "ID" column storing localizable text IDs and additional column per each locale. You're free to modify all the columns in the spreadsheet except "ID"; however, modifying column associated with the source locale won't have any effect on import.

When Include Annotations option is enabled, generated sheets will also contain a column with the source script content, such as author names, inlined commands and comments placed before localized lines. The column is ignored during import.

After performing required modifications, click "Import" button to import the data back to the project.

WARNING

Project's localization documents will be overwritten when importing from spreadsheet, so refrain from modifying them while the spreadsheet is being edited to prevent conflicts.

Custom Processor

It's possible to inject custom spreadsheet processor to customize the way sheets are generated as well as the import and export processes.

Create a custom processor class by inheriting built-in Naninovel.Spreadsheet.Processor handler. The utility will automatically pick the custom handler and use it instead of the built-in one.

Below is an example of a custom processor with some key override points.

csharp
using Naninovel.Spreadsheet;

public class CustomProcessor : Processor
{
    public CustomProcessor (ProcessorOptions options) : base(options)
    {
        // Access export/import process options, eg:
        // options.ScriptFolder
        // options.SourceLocale
        // ...etc
    }

    // Override how scripts are exported from project to sheets.
    protected override void ExportScripts () { }
    // Override how managed text is exported from project to sheets.
    protected override void ExportText () { }
    // Override how script are imported from sheets to project.
    protected override void ImportText () { }
    // Override how managed text is imported from sheets to project
    protected override void ImportScripts () { }
}

EXAMPLE

Find an example on how to set up and use the tool in the sample GitHub project ↗.