Interface IProject
Represents a project. Provides access to project information and settings, and provides functionality for modifying the project, running tasks etc.
Namespace: SdlSdl.ProjectAutomationCore
Assembly: Sdl.ProjectAutomation.Core.dll
Syntax
public interface IProject
Methods
AddBilingualReferenceFile(BilingualFileMapping)
Associates a bilingual reference file with a particular source file and target language using a BilingualFileMapping
Declaration
void AddBilingualReferenceFile(BilingualFileMapping mapping)
Parameters
Type | Name | Description |
---|---|---|
BilingualFileMapping | mapping | A BilingualFileMapping Object that holds the association |
Remarks
This is used to associate bilingual reference files prior to running the project prepare task sequance so that bilingual reference files can be associated with target files before the files have been copied to the target languages
AddBilingualReferenceFiles(BilingualFileMapping[])
Associates a number of Bilingual reference file to particular source file in a target language using an array of BilingualFileMapping
Declaration
void AddBilingualReferenceFiles(BilingualFileMapping[] mappings)
Parameters
Type | Name | Description |
---|---|---|
BilingualFileMapping | mappings | An array of BilingualFileMapping Objects |
Remarks
This is used to associate bilingual reference files prior to running the project prepare task sequance so that bilingual reference files can be associated with target files before the files have been copied to the target languages
AddFiles(string[])
Adds a set of files into the project, in the root folder.
Declaration
ProjectFile[] AddFiles(string[] filePaths)
Parameters
Type | Name | Description |
---|---|---|
string | filePaths | The paths of the files to add. These should be absolute paths. |
Returns
Type | Description |
---|---|
ProjectFile | The added files |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddFiles(string[], string)
Adds a set of files into the project, below a specified project folder.
Declaration
ProjectFile[] AddFiles(string[] filePaths, string folderPathInProject)
Parameters
Type | Name | Description |
---|---|---|
string | filePaths | The paths of the files to add. These should be absolute paths. |
string | folderPathInProject | The folder in this project below which the files should be added. If empty the files will be in the project root folder. |
Returns
Type | Description |
---|---|
ProjectFile | The added files |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddFolderWithFiles(string, bool)
Adds all the files from a folder into the project, in the root folder
Declaration
ProjectFile[] AddFolderWithFiles(string localFolderPath, bool recursive)
Parameters
Type | Name | Description |
---|---|---|
string | localFolderPath | The absolute path of the folder containing the files to add. |
bool | recursive | If |
Returns
Type | Description |
---|---|
ProjectFile | The added project files. |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddFolderWithFiles(string, string, bool)
Adds all the files from a folder into the project, below a specified project folder.
Declaration
ProjectFile[] AddFolderWithFiles(string localFolderPath, string folderPathInProject, bool recursive)
Parameters
Type | Name | Description |
---|---|---|
string | localFolderPath | The absolute path of the folder containing the files to add. |
string | folderPathInProject | The folder in this project below which the files should be added. If empty the files will be in the project root folder. |
bool | recursive | If |
Returns
Type | Description |
---|---|
ProjectFile | The added project files. |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddNewFileVersion(Guid, string)
Adds a new version of the file into the project.
Declaration
void AddNewFileVersion(Guid projectFileId, string filePath)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileId | The file to add a new version for. |
string | filePath | The absolute file path of the new version of the file. |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
CreateManualTask(string, string, DateTime, TaskFileInfo[])
Creates a manual task. A manual task includes a set of files that is assigned to a user. The created manual task can be used to create a project package using CreateProjectPackage(Guid, string, string, ProjectPackageCreationOptions, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Declaration
ManualTask CreateManualTask(string manualTaskName, string assignToUser, DateTime dueDate, TaskFileInfo[] inputFiles)
Parameters
Type | Name | Description |
---|---|---|
string | manualTaskName | The name of the manual task. Typically "Translate" or "Review", but other task names can be |
string | assignToUser | The user to assign the task to. |
DateTime | dueDate | The date by which the task should be completed. |
TaskFileInfo | inputFiles | The files to include in the task. |
Returns
Type | Description |
---|---|
ManualTask | The newly created manual task. |
CreateManualTask(string, string, DateTime, Guid[])
Creates a manual task. A manual task includes a set of files that is assigned to a user. The created manual task can be used to create a project package using CreateProjectPackage(Guid, string, string, ProjectPackageCreationOptions, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Declaration
ManualTask CreateManualTask(string manualTaskName, string assignToUser, DateTime dueDate, Guid[] projectFileIds)
Parameters
Type | Name | Description |
---|---|---|
string | manualTaskName | The name of the manual task. Typically "Translate" or "Review", but other task names can be |
string | assignToUser | The user to assign the task to. |
DateTime | dueDate | The date by which the task should be completed. |
Guid | projectFileIds | The project files to include in the task. Reference files will be marked as "read only" task files |
Returns
Type | Description |
---|---|
ManualTask | The newly created manual task. |
Remarks
This overload allows a list of project file IDs to be specified rather than TaskFileInfo objects. A project file will be marked as a "read only" task file if it has a role of Reference.
CreateMergedProjectFile(string, string, Guid[])
Creates a merged file from a number of translatable files in the project. This allows manipulating the content of all the child files within one physical file. For more information, see MergedProjectFile.
Declaration
MergedProjectFile CreateMergedProjectFile(string mergedFileName, string folderPathInProject, Guid[] projectFileIds)
Parameters
Type | Name | Description |
---|---|---|
string | mergedFileName | The file name for the newly created merged file. This must have the ".sdlxliff" extension. |
string | folderPathInProject | The folder in this project in which the merged file be added. If empty the merged file will be in the project root folder. |
Guid | projectFileIds | The IDs of the translatable files to be merged in to one. |
Returns
Type | Description |
---|---|
MergedProjectFile | The newly created and added merged project file. |
CreateProjectPackage(Guid, string, string, ProjectPackageCreationOptions)
Creates a project package. The package can then be obtained using SavePackageAs(Guid, string).
Declaration
ProjectPackageCreation CreateProjectPackage(Guid manualTaskId, string packageName, string comment, ProjectPackageCreationOptions options)
Parameters
Type | Name | Description |
---|---|---|
Guid | manualTaskId | The ID of the task that the package relates to. (The task defines which files are included in the package.) |
string | packageName | The name of the package. |
string | comment | Optional comment. |
ProjectPackageCreationOptions | options | Various options to control what will be included in a project package. |
Returns
Type | Description |
---|---|
ProjectPackageCreation | A ProjectPackageCreation object, which contains the results of the package creation. |
CreateProjectPackage(Guid, string, string, ProjectPackageCreationOptions, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Creates a project package. The package can then be obtained using SavePackageAs(Guid, string).
Declaration
ProjectPackageCreation CreateProjectPackage(Guid manualTaskId, string packageName, string comment, ProjectPackageCreationOptions options, EventHandler<ProgressEventArgs> statusEventHandler, EventHandler<MessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
Guid | manualTaskId | The ID of the task that the package relates to. (The task defines which files are included in the package.) |
string | packageName | The name of the package. |
string | comment | Optional comment. |
ProjectPackageCreationOptions | options | Various options to control what will be included in a project package. |
EventHandlerProgressEventArgs | statusEventHandler | Event handler for package creation status events. |
EventHandlerMessageEventArgs | messageEventHandler | Event handler for message events. |
Returns
Type | Description |
---|---|
ProjectPackageCreation | A ProjectPackageCreation object, which contains the results of the package creation. |
CreateReturnPackage(Guid[], string, string)
Creates a return package from a set of files. The files must all have previously been received as part of a project package in order for the return package to be created.
Declaration
ReturnPackageCreation CreateReturnPackage(Guid[] projectFileIds, string packageName, string comment)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileIds | The files to include in the return package. |
string | packageName | The name of the package. |
string | comment | A comment for the package. |
Returns
Type | Description |
---|---|
ReturnPackageCreation | A ReturnPackageCreation object, representing the results of the return package creation. |
Remarks
It is only valid to call this method if this project was created from a project package
CreateReturnPackage(Guid[], string, string, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Creates a return package from a set of files. The files must all have previously been received as part of a project package in order for the return package to be created.
Declaration
ReturnPackageCreation CreateReturnPackage(Guid[] projectFileIds, string packageName, string comment, EventHandler<ProgressEventArgs> statusEventHandler, EventHandler<MessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileIds | The files to include in the return package. |
string | packageName | The name of the package. |
string | comment | A comment for the package. |
EventHandlerProgressEventArgs | statusEventHandler | Event handler for status events |
EventHandlerMessageEventArgs | messageEventHandler | Event handler for message events |
Returns
Type | Description |
---|---|
ReturnPackageCreation |
Remarks
It is only valid to call this method if this project was created from a project package
GetAutomaticTask(Guid)
Retrieves an existing automatic task.
Declaration
AutomaticTask GetAutomaticTask(Guid automaticTaskId)
Parameters
Type | Name | Description |
---|---|---|
Guid | automaticTaskId | The ID of the automatic task. |
Returns
Type | Description |
---|---|
AutomaticTask |
GetFile(Guid)
Retrieves the file with specified ID.
Declaration
ProjectFile GetFile(Guid projectFileId)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileId | The ID of the file to retrieve. |
Returns
Type | Description |
---|---|
ProjectFile | The added project file. |
GetFileTypeConfiguration()
Returns the configuration for the file types asssociated to this project
Declaration
ProjectFileTypeConfiguration GetFileTypeConfiguration()
Returns
Type | Description |
---|---|
ProjectFileTypeConfiguration |
GetManualTask(Guid)
Retrieves an existing manual task.
Declaration
ManualTask GetManualTask(Guid manualTaskId)
Parameters
Type | Name | Description |
---|---|---|
Guid | manualTaskId | The ID of the manual task |
Returns
Type | Description |
---|---|
ManualTask |
GetProjectInfo()
Retrieves information about the project
Declaration
ProjectInfo GetProjectInfo()
Returns
Type | Description |
---|---|
ProjectInfo |
GetProjectStatistics()
Gets the aggregated analysis, word count and confirmation statistics for all the files in the project. This will not actually compute the statistics, but just return a snapshot of the statistics that where most recently computed. To update the statistics, run the relevant task: WordCount, AnalyzeFiles or TranslationCount.
Declaration
ProjectStatistics GetProjectStatistics()
Returns
Type | Description |
---|---|
ProjectStatistics | The aggregated analysis, word count and confirmation statistics for all the files in the project. |
GetSettings()
Gets the project-level settings.
Declaration
ISettingsBundle GetSettings()
Returns
Type | Description |
---|---|
ISettingsBundle | A settings bundle containing the project settings. Never returns |
Remarks
Project settings can be overridden for a specific target language using UpdateSettings(Language, ISettingsBundle). The override mechanism works on an individual setting level, not on a settings bundle or group level. This means that any setting that is not specifically defined/overridden on the target language level will be inherited from the project-level settings.
GetSettings(Language)
Gets the settings for a specific target language.
Declaration
ISettingsBundle GetSettings(Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The project target language for which to retrieve the settings. |
Returns
Type | Description |
---|---|
ISettingsBundle | A settings bundle containing the target language specific settings. The settings bundle returned will have a parent
settings bundle which represent the current project settings. Never returns |
Remarks
Target language settings override settings specified on the project level (see GetSettings(). The override mechanism works on an individual setting level, not on a settings bundle or group level. This means that any setting that is not specifically defined/overridden on the target language level will be inherited from the project-level settings.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when |
GetSourceLanguageFiles()
Retrieves all source language files.
Declaration
ProjectFile[] GetSourceLanguageFiles()
Returns
Type | Description |
---|---|
ProjectFile | All the source language files in this project. |
GetTargetLanguageFiles()
Retrieves all target language files.
Declaration
ProjectFile[] GetTargetLanguageFiles()
Returns
Type | Description |
---|---|
ProjectFile |
Remarks
For merged files (MergedProjectFile) with merge state NotMerged or Merged the merged file will be returned from this method, but not the child files. When the merge state is Split, only the child files are returned, not the merged file.
GetTargetLanguageFiles(Language)
Retrieves all files for the specified target language.
Declaration
ProjectFile[] GetTargetLanguageFiles(Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The target language to retrieve files for. |
Returns
Type | Description |
---|---|
ProjectFile |
Remarks
For merged files (MergedProjectFile) with merge state NotMerged or Merged the merged file will be returned from this method, but not the child files. When the merge state is Split, only the child files are returned, not the merged file.
GetTermbaseConfiguration(bool)
Retrieves all termbase-related settings that are associated with this project.
Declaration
TermbaseConfiguration GetTermbaseConfiguration(bool obtainCopy)
Parameters
Type | Name | Description |
---|---|---|
bool | obtainCopy |
Returns
Type | Description |
---|---|
TermbaseConfiguration | A TermbaseConfiguration object containing all termbase-related configuration for this project. |
GetTranslationProviderConfiguration()
Gets the translation provider configuration for this project.
Declaration
TranslationProviderConfiguration GetTranslationProviderConfiguration()
Returns
Type | Description |
---|---|
TranslationProviderConfiguration | The translation provider configuration. This never returns |
Remarks
The translation provider configuration can be overridden for a specific target language (see GetTranslationProviderConfiguration(Language)) and UpdateTranslationProviderConfiguration(Language, TranslationProviderConfiguration)).
GetTranslationProviderConfiguration(Language)
Gets the translation provider configuration for the specified target language. If no specific configuration has been specified for the specified target language,
this method returns an empty (not null
!) configuration.
Declaration
TranslationProviderConfiguration GetTranslationProviderConfiguration(Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The target language for which to get the translation provider configuration. |
Returns
Type | Description |
---|---|
TranslationProviderConfiguration | The translation provider configuration for the specified target language. This never returns |
ImportReturnPackage(string)
Imports a return package into this project.
Declaration
ReturnPackageImport ImportReturnPackage(string returnPackageFilePath)
Parameters
Type | Name | Description |
---|---|---|
string | returnPackageFilePath | The file path of the return package to import. Has file extension .sdlrpx |
Returns
Type | Description |
---|---|
ReturnPackageImport | Information about the import operation. |
ImportReturnPackage(string, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Imports a return package into this project.
Declaration
ReturnPackageImport ImportReturnPackage(string returnPackageFilePath, EventHandler<ProgressEventArgs> statusEventHandler, EventHandler<MessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
string | returnPackageFilePath | The file path of the return package to import. Has file extension .sdlrpx |
EventHandlerProgressEventArgs | statusEventHandler | Event handler for status events |
EventHandlerMessageEventArgs | messageEventHandler | Event handler for message events |
Returns
Type | Description |
---|---|
ReturnPackageImport | Information about the import operation. |
OpenProjectFileStream(Guid)
Returns a stream that can be used to save out the latest version of the file.
Declaration
Stream OpenProjectFileStream(Guid projectFileId)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileId | The file to obtain the stream for. |
Returns
Type | Description |
---|---|
Stream | A stream from which the file contents can be read. It is the responsibility of the caller to close this stream. |
RemoveBilingualReferenceFile(Guid)
Removes a Bilingual reference file from a target project file
Declaration
void RemoveBilingualReferenceFile(Guid ProjectTargetFileId)
Parameters
Type | Name | Description |
---|---|---|
Guid | ProjectTargetFileId | The file that where the bilingual reference needs to be removed |
RunAutomaticTask(Guid[], string)
Runs an automatic task on a set of files. Automatic task template IDs are defined in AutomaticTaskTemplateIds.
Declaration
AutomaticTask RunAutomaticTask(Guid[] projectFileIds, string taskTemplateId)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileIds | The files to run the task on. |
string | taskTemplateId | The ID of the task template (i.e. the type of task) to run. |
Returns
Type | Description |
---|---|
AutomaticTask | Information about the automatic task that has been run. |
Remarks
Multiple automatic tasks can be run together in a sequence using FileBasedProject.RunAutomaticTasks
RunAutomaticTask(Guid[], string, EventHandler<TaskStatusEventArgs>, EventHandler<TaskMessageEventArgs>)
Runs an automatic task on a set of files. Automatic task template IDs are defined in AutomaticTaskTemplateIds. This overload allows event handlers to be specified for task status and message events. These events support cancellation of the task.
Declaration
AutomaticTask RunAutomaticTask(Guid[] projectFileIds, string taskTemplateId, EventHandler<TaskStatusEventArgs> statusEventHandler, EventHandler<TaskMessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileIds | The files to run the task on. |
string | taskTemplateId | The ID of the task template (i.e. the type of task) to run. |
EventHandlerTaskStatusEventArgs | statusEventHandler | Event handler for task status events. |
EventHandlerTaskMessageEventArgs | messageEventHandler | Event handler for message events. |
Returns
Type | Description |
---|---|
AutomaticTask | Information about the automatic task that has been run. |
Remarks
Multiple automatic tasks can be run together in a sequence using FileBasedProject.RunAutomaticTasks
Save()
Persists the project file. The file has extension .sdlproj and is located in the folder given by LocalProjectFolder. .
Declaration
void Save()
Remarks
It is recommended to regularly save the project, for example after making a set of changes and after running a task.
SavePackageAs(Guid, string)
Saves out a created project or return package to a specified file location.
Declaration
void SavePackageAs(Guid packageId, string path)
Parameters
Type | Name | Description |
---|---|---|
Guid | packageId | The ID of the package to save. See PackageId. |
string | path | The file path to save the package to. |
SaveProjectFileAs(Guid, string)
Saves out the file to a specified file location.
Declaration
void SaveProjectFileAs(Guid projectFileId, string outputFilePath)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileId | The file to save. |
string | outputFilePath | The file path to save the project file to. |
SaveTaskReportAs(Guid, string, ReportFormat)
Saves the task report out to a file, in the specified format
Declaration
void SaveTaskReportAs(Guid reportId, string path, ReportFormat reportFormat)
Parameters
Type | Name | Description |
---|---|---|
Guid | reportId | The id of the task report to save. |
string | path | The file path to save the report to. |
ReportFormat | reportFormat | The format used when saving out the report. |
SetFileRole(Guid[], FileRole)
Changes the role of the file. A Scan task (Scan) should be run after changing the file role in this way.
Declaration
void SetFileRole(Guid[] projectFileIds, FileRole fileRole)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectFileIds | The IDs of the project files. |
FileRole | fileRole | The new FileRole value. |
UpdateProject(ProjectInfo)
Updates the project with the new information contained in projectInfo
.
Declaration
ProjectInfo UpdateProject(ProjectInfo projectInfo)
Parameters
Type | Name | Description |
---|---|---|
ProjectInfo | projectInfo | The updated project information. |
Returns
Type | Description |
---|---|
ProjectInfo | The updated project information. |
Remarks
It is only valid to update certain properties. See the comments in ProjectInfo properties for more details. It is recommended to first obtain a ProjectInfo object using GetProjectInfo(), then modify its properties before passing into this update method.
UpdateSettings(Language, ISettingsBundle)
Updates the settings for a specific target language.
Declaration
void UpdateSettings(Language targetLanguage, ISettingsBundle settings)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The target language for which to update the settings. |
ISettingsBundle | settings | A settings bundle representing the new target language settings. |
Remarks
Note that this method will only update the target-language settings. If you have changed the parent project-level settings too, thee need to be updated with a separate call to UpdateSettings(ISettingsBundle).
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when |
ArgumentNullException | Thrown if |
UpdateSettings(ISettingsBundle)
Updates the project-level settings.
Declaration
void UpdateSettings(ISettingsBundle settings)
Parameters
Type | Name | Description |
---|---|---|
ISettingsBundle | settings | A settings bundle object containing the new project settings. |
Remarks
The project settings will be completely replaced with the specified settings, so any settings not present in the updated settings bundle will revert to their defaults.
You can also override settings for a specific target language. See UpdateSettings(Language, ISettingsBundle).
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
UpdateTermbaseConfiguration(TermbaseConfiguration)
Updates the termbase-related settings for this project.
Declaration
void UpdateTermbaseConfiguration(TermbaseConfiguration termbaseConfiguration)
Parameters
Type | Name | Description |
---|---|---|
TermbaseConfiguration | termbaseConfiguration | A TermbaseConfiguration object containing all termbase-related configuration for this project. This can either be newly created termbase configuration object or one that was retrieved via GetTermbaseConfiguration(bool). |
UpdateTranslationProviderConfiguration(Language, TranslationProviderConfiguration)
Updates the translation provider configuration for a specific project target language.
Declaration
void UpdateTranslationProviderConfiguration(Language targetLanguage, TranslationProviderConfiguration translationProviderConfiguration)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The project target language for which to update the configuration. |
TranslationProviderConfiguration | translationProviderConfiguration | The translation provider configuration. Note that you need to set OverrideParent to in order for the configuration to be used. If this is
set to , the project-wide translation provider configuration will be used instead (GetTranslationProviderConfiguration()).
|
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when |
ArgumentNullException | Thrown when |
ArgumentException | Thrown when |
UpdateTranslationProviderConfiguration(TranslationProviderConfiguration)
Updates the project-wide translation provider configuration.
Declaration
void UpdateTranslationProviderConfiguration(TranslationProviderConfiguration translationProviderConfiguration)
Parameters
Type | Name | Description |
---|---|---|
TranslationProviderConfiguration | translationProviderConfiguration | The translation provider configuration. Note that the project-wide configuration might have been overridden for one or more specific project target languages (see UpdateTranslationProviderConfiguration(Language, TranslationProviderConfiguration)). The project-wide configuration will not be used for these target languages. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ArgumentException | Thrown when |