Table of Contents

Class TranslationValidator

Namespace
Tlumach.Validation
Assembly
Tlumach.dll

Finds the Tlumach configurations of a project and the translation files that they lead to, and checks that the library can load and process every one of them.

The translation files of a configuration are its default file, the files named in its translations section, and the files that TranslationManager finds by name next to the default file ({base}{separator}{culture}{extension}), including the files that the project links into that directory.

public static class TranslationValidator
Inheritance
TranslationValidator
Inherited Members

Methods

IsConfigurationFile(string)

Determines whether a file has the extension of a Tlumach configuration file.

public static bool IsConfigurationFile(string path)

Parameters

path string

The path or the name of the file.

Returns

bool

true when a configuration parser is registered for the extension.

ValidateConfiguration(string, bool, string, IEnumerable<ProjectFile>?, CancellationToken)

Validates one configuration and the translation files that it leads to.

public static ConfigurationValidationReport ValidateConfiguration(string configurationPath, bool isGeneratorInput, string projectDirectory, IEnumerable<ProjectFile>? projectItems = null, CancellationToken cancellationToken = default)

Parameters

configurationPath string

The full path of the configuration file.

isGeneratorInput bool

Whether the generator processes the configuration; the generator requires the namespace and the class to be set.

projectDirectory string

The directory of the project, used to find the files that the configuration names.

projectItems IEnumerable<ProjectFile>

The files that the project includes, if known; used to find the translation files linked into the directory of the default file and to check how ResX translations are embedded.

cancellationToken CancellationToken

A token that cancels the validation between files.

Returns

ConfigurationValidationReport

The report. When isGeneratorInput is false and the file is not a Tlumach configuration, the report contains no files and no messages.

ValidateProject(string, IEnumerable<ProjectFile>, CancellationToken)

Validates the translations of a project.

public static ProjectValidationReport ValidateProject(string projectPath, IEnumerable<ProjectFile> items, CancellationToken cancellationToken = default)

Parameters

projectPath string

The full path of the project file.

items IEnumerable<ProjectFile>

The files that the project includes. A file may be listed more than once with different item types.

cancellationToken CancellationToken

A token that cancels the validation between files.

Returns

ProjectValidationReport

The report.