Class FileBasedLanguageResourcesTemplate
A language resources template implementation (ILanguageResourcesTemplate) that can be loaded from and saved to a file.
Inherited Members
Namespace: SdlSdl.LanguagePlatformTranslationMemoryApi
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public class FileBasedLanguageResourcesTemplate : ILanguageResourcesTemplate, ISupportPlaceables
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 |
---|---|---|
Guid | id |
FileBasedLanguageResourcesTemplate(string)
Loads a file-based language resources template from the specified file.
Declaration
public FileBasedLanguageResourcesTemplate(string filePath)
Parameters
Type | Name | Description |
---|---|---|
string | filePath | The location where the template should be loaded from. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
FileNotFoundException | Thrown if |
Properties
Description
Gets or sets the description of this template.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
string |
FilePath
Gets the location where this language resources template is located.
Declaration
public string FilePath { get; }
Property Value
Type | Description |
---|---|
string |
Id
gets the unique id of this template.
Declaration
public Guid Id { get; set; }
Property Value
Type | Description |
---|---|
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 |
---|---|
string |
Recognizers
Gets or sets the recognizers which are enabled for this template.
Declaration
public BuiltinRecognizers Recognizers { get; set; }
Property Value
Type | Description |
---|---|
BuiltinRecognizers |
TokenizerFlags
Gets or sets the flags affecting tokenizer behaviour for this language resource template.
Declaration
public TokenizerFlags? TokenizerFlags { get; set; }
Property Value
Type | Description |
---|---|
TokenizerFlags |
WordCountFlags
Gets or sets the flags affecting word count behaviour for this language resource template.
Declaration
public WordCountFlags? WordCountFlags { get; set; }
Property Value
Type | Description |
---|---|
WordCountFlags |
Methods
Refresh()
Reloads the template from the file.
Declaration
public void Refresh()
Exceptions
Type | Condition |
---|---|
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 |
---|---|
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 |
---|---|---|
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 |
---|---|---|
string | filePath | The location to save the template to. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |