Interface IProject
Represents a project. Provides access to project information and settings, and provides functionality for modifying the project, running tasks etc.
Namespace: Sdl.ProjectAutomation.Core
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 |
---|---|---|
Bilingual |
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 |
---|---|---|
Bilingual |
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 |
---|---|
Project |
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 |
---|---|
Project |
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, Boolean)
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. |
Boolean | recursive | If |
Returns
Type | Description |
---|---|
Project |
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, Boolean)
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. |
Boolean | recursive | If |
Returns
Type | Description |
---|---|
Project |
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. |
Date |
dueDate | The date by which the task should be completed. |
Task |
inputFiles | The files to include in the task. |
Returns
Type | Description |
---|---|
Manual |
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. |
Date |
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 |
---|---|
Manual |
The newly created manual task. |
Remarks
This overload allows a list of project file IDs to be specified rather than Task
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 Merged
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 |
---|---|
Merged |
The newly created and added merged project file. |
CreateProjectPackage(Guid, String, String, ProjectPackageCreationOptions)
Creates a project package. The package can then be obtained using Save
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. |
Project |
options | Various options to control what will be included in a project package. |
Returns
Type | Description |
---|---|
Project |
A Project |
CreateProjectPackage(Guid, String, String, ProjectPackageCreationOptions, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Creates a project package. The package can then be obtained using Save
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. |
Project |
options | Various options to control what will be included in a project package. |
Event |
statusEventHandler | Event handler for package creation status events. |
Event |
messageEventHandler | Event handler for message events. |
Returns
Type | Description |
---|---|
Project |
A Project |
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 |
---|---|
Return |
A Return |
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. |
Event |
statusEventHandler | Event handler for status events |
Event |
messageEventHandler | Event handler for message events |
Returns
Type | Description |
---|---|
Return |
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 |
---|---|
Automatic |
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 |
---|---|
Project |
The added project file. |
GetFileTypeConfiguration()
Returns the configuration for the file types asssociated to this project
Declaration
ProjectFileTypeConfiguration GetFileTypeConfiguration()
Returns
Type | Description |
---|---|
Project |
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 |
---|---|
Manual |
GetProjectInfo()
Retrieves information about the project
Declaration
ProjectInfo GetProjectInfo()
Returns
Type | Description |
---|---|
Project |
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: Word
Declaration
ProjectStatistics GetProjectStatistics()
Returns
Type | Description |
---|---|
Project |
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 |
---|---|
ISettings |
A settings bundle containing the project settings. Never returns |
Remarks
Project settings can be overridden for a specific target language using Update
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 |
---|---|
ISettings |
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 Get
Exceptions
Type | Condition |
---|---|
System. |
Thrown when |
GetSourceLanguageFiles()
Retrieves all source language files.
Declaration
ProjectFile[] GetSourceLanguageFiles()
Returns
Type | Description |
---|---|
Project |
All the source language files in this project. |
GetTargetLanguageFiles()
Retrieves all target language files.
Declaration
ProjectFile[] GetTargetLanguageFiles()
Returns
Type | Description |
---|---|
Project |
Remarks
For merged files (Merged
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 |
---|---|
Project |
Remarks
For merged files (Merged
GetTermbaseConfiguration(Boolean)
Retrieves all termbase-related settings that are associated with this project.
Declaration
TermbaseConfiguration GetTermbaseConfiguration(bool obtainCopy)
Parameters
Type | Name | Description |
---|---|---|
Boolean | obtainCopy |
Returns
Type | Description |
---|---|
Termbase |
A Termbase |
GetTranslationProviderConfiguration()
Gets the translation provider configuration for this project.
Declaration
TranslationProviderConfiguration GetTranslationProviderConfiguration()
Returns
Type | Description |
---|---|
Translation |
The translation provider configuration. This never returns |
Remarks
The translation provider configuration can be overridden for a specific target language
(see Get
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 |
---|---|
Translation |
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 |
---|---|
Return |
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 |
Event |
statusEventHandler | Event handler for status events |
Event |
messageEventHandler | Event handler for message events |
Returns
Type | Description |
---|---|
Return |
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 Automatic
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 |
---|---|
Automatic |
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 Automatic
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. |
Event |
statusEventHandler | Event handler for task status events. |
Event |
messageEventHandler | Event handler for message events. |
Returns
Type | Description |
---|---|
Automatic |
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 Local
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 Package |
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. |
Report |
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. |
File |
fileRole | The new File |
UpdateProject(ProjectInfo)
Updates the project with the new information contained in projectInfo
.
Declaration
ProjectInfo UpdateProject(ProjectInfo projectInfo)
Parameters
Type | Name | Description |
---|---|---|
Project |
projectInfo | The updated project information. |
Returns
Type | Description |
---|---|
Project |
The updated project information. |
Remarks
It is only valid to update certain properties. See the comments in Project
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. |
ISettings |
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 Update
Exceptions
Type | Condition |
---|---|
System. |
Thrown when |
System. |
Thrown if |
UpdateSettings(ISettingsBundle)
Updates the project-level settings.
Declaration
void UpdateSettings(ISettingsBundle settings)
Parameters
Type | Name | Description |
---|---|---|
ISettings |
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 Update
Exceptions
Type | Condition |
---|---|
System. |
Thrown if |
UpdateTermbaseConfiguration(TermbaseConfiguration)
Updates the termbase-related settings for this project.
Declaration
void UpdateTermbaseConfiguration(TermbaseConfiguration termbaseConfiguration)
Parameters
Type | Name | Description |
---|---|---|
Termbase |
termbaseConfiguration | A Termbase |
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. |
Translation |
translationProviderConfiguration | The translation provider configuration. Note that you need to set
Override in order for the configuration to be used. If this is
set to , the project-wide translation provider configuration will be used instead (Get |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when |
System. |
Thrown when |
System. |
Thrown when |
UpdateTranslationProviderConfiguration(TranslationProviderConfiguration)
Updates the project-wide translation provider configuration.
Declaration
void UpdateTranslationProviderConfiguration(TranslationProviderConfiguration translationProviderConfiguration)
Parameters
Type | Name | Description |
---|---|---|
Translation |
translationProviderConfiguration | The translation provider configuration. Note that the project-wide configuration might have been
overridden for one or more specific project target languages (see Update |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when |
System. |
Thrown when |