Class FileBasedLanguageResourcesTemplate
A language resources template implementation (ILanguageResourcesTemplate) that can be loaded from and saved to a file.
Inheritance
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemoryApi
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 |
---|---|---|
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 |
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 |
---|---|
System.Nullable<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 |
---|---|
System.Nullable<WordCountFlags> |
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 |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |