Class LanguagePair
A LanguagePair represents a combination of a source language and a target language.
Languages are specified using their culture or the culture which usually maps to
CultureInfo.Name. However, since the XmlSerializer cannot serialize
Culture
Inheritance
Implements
Inherited Members
Namespace: Sdl.LanguagePlatform.Core
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
public class LanguagePair : IComparable<LanguagePair>
Constructors
LanguagePair()
Instantiates a new object and initializes both languages to the invariant culture.
Declaration
public LanguagePair()
LanguagePair(CultureCode, CultureCode)
Instantiates a new object and initializes it with the provided language direction.
Declaration
public LanguagePair(CultureCode srcCulture, CultureCode trgCulture)
Parameters
Type | Name | Description |
---|---|---|
Culture |
srcCulture | The source culture name |
Culture |
trgCulture | The target culture name |
Properties
SourceCulture
Gets or sets the source culture
Declaration
public CultureCode SourceCulture { get; set; }
Property Value
Type | Description |
---|---|
Culture |
SourceCultureName
Gets or sets the source language in form of a culture code.
Declaration
public string SourceCultureName { get; set; }
Property Value
Type | Description |
---|---|
String |
TargetCulture
Gets or sets the target culture
Declaration
public CultureCode TargetCulture { get; set; }
Property Value
Type | Description |
---|---|
Culture |
TargetCultureName
Gets or sets the target language in form of a culture code.
Declaration
public string TargetCultureName { get; set; }
Property Value
Type | Description |
---|---|
String |
Methods
CompareTo(LanguagePair)
Compares the language directions, which is achieved by lexically comparing the source and target culture names.
Declaration
public int CompareTo(LanguagePair other)
Parameters
Type | Name | Description |
---|---|---|
Language |
other |
Returns
Type | Description |
---|---|
Int32 | A comparision result |
Equals(Object)
System.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
System.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this object |
Overrides
IsCompatible(LanguagePair)
Checks whether a language pair is compatible to another language pair, which is the case
if the source and target cultures of both language pairs are non-null and are pairwise
compatible with each other (Are
Declaration
public bool IsCompatible(LanguagePair other)
Parameters
Type | Name | Description |
---|---|---|
Language |
other |
Returns
Type | Description |
---|---|
Boolean |
IsCompatiblePairAsync(LanguagePair, ICultureMetadataManager)
Checks whether a language pair is compatible to another language pair, which is the case
if the source and target cultures of both language pairs are non-null and are pairwise
compatible with each other (Are
Declaration
public Task<bool> IsCompatiblePairAsync(LanguagePair other, ICultureMetadataManager cultureMetadataManager)
Parameters
Type | Name | Description |
---|---|---|
Language |
other | |
ICulture |
cultureMetadataManager |
Returns
Type | Description |
---|---|
Task<Boolean> |
Reverse()
Creates a new language pair object with the reversed language direction.
Declaration
public LanguagePair Reverse()
Returns
Type | Description |
---|---|
Language |
ToString()
System.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A string representation of the object, for display purposes. |
Overrides
TryParse(String, out LanguagePair)
Attempts to parse a language pair represented by a string, as produced by To
Declaration
public static bool TryParse(string s, out LanguagePair lp)
Parameters
Type | Name | Description |
---|---|---|
String | s | The input string |
Language |
lp | Will hold the deserialized (parsed) return value upon success, and is set to |
Returns
Type | Description |
---|---|
Boolean |
|