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
pathstringThe path or the name of the file.
Returns
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
configurationPathstringThe full path of the configuration file.
isGeneratorInputboolWhether the generator processes the configuration; the generator requires the namespace and the class to be set.
projectDirectorystringThe directory of the project, used to find the files that the configuration names.
projectItemsIEnumerable<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.
cancellationTokenCancellationTokenA token that cancels the validation between files.
Returns
- ConfigurationValidationReport
The report. When
isGeneratorInputis 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
projectPathstringThe full path of the project file.
itemsIEnumerable<ProjectFile>The files that the project includes. A file may be listed more than once with different item types.
cancellationTokenCancellationTokenA token that cancels the validation between files.
Returns
- ProjectValidationReport
The report.