Class FileBasedLanguageResourcesTemplate
A language resources template implementation (ILanguageResourcesTemplate) that can be loaded from and saved to a file.
Inheritance
Implements
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemoryApi
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public class FileBasedLanguageResourcesTemplate : ILanguageResourcesTemplate
Constructors
FileBasedLanguageResourcesTemplate()
Creates a new file-based language resources template.
Declaration
public FileBasedLanguageResourcesTemplate()
FileBasedLanguageResourcesTemplate(Guid)
Creates a new file-based language resources template with the provided ID. This is useful during copying.
Declaration
public FileBasedLanguageResourcesTemplate(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
FileBasedLanguageResourcesTemplate(String)
Loads a file-based language resources template from the specified file.
Declaration
public FileBasedLanguageResourcesTemplate(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The location where the template should be loaded from. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.IO.FileNotFoundException | Thrown if |
Properties
Description
Gets or sets the description of this template.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FilePath
Gets the location where this language resources template is located.
Declaration
public string FilePath { get; }
Property Value
Type | Description |
---|---|
System.String |
Id
gets the unique id of this template.
Declaration
public Guid Id { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
LanguageResourceBundles
Gets the collection of language resource bundles in this template.
Declaration
public LanguageResourceBundleCollection LanguageResourceBundles { get; }
Property Value
Type | Description |
---|---|
LanguageResourceBundleCollection |
Name
Gets or sets the name of this template. Not that this is not necessarily the same as the file name.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Refresh()
Reloads the template from the file.
Declaration
public void Refresh()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when trying to call this method on an unsaved template. |
Save()
Saves the template to the location specified in FilePath. If this is the first time the template is saved, use SaveAs(String) instead.
Declaration
public void Save()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown if this template has not been saved before. Use SaveAs and specify a file path instead. |
Save(Stream)
Saves this template to the specified stream.
Declaration
public void Save(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to which the template should be saved. |
SaveAs(String)
Saves the template to the specified location. This also updates the current FilePath. Subsequent calls to Save() will save the template to this new location.
Declaration
public void SaveAs(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The location to save the template to. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |