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
System.
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(CultureInfo, CultureInfo)
Instantiates a new object and initializes it with the provided language direction.
Declaration
public LanguagePair(CultureInfo srcCulture, CultureInfo trgCulture)
Parameters
Type | Name | Description |
---|---|---|
System. |
srcCulture | The source culture |
System. |
trgCulture | The target culture |
LanguagePair(String, String)
Instantiates a new object and initializes it with the provided language direction.
Declaration
public LanguagePair(string srcCultureName, string trgCultureName)
Parameters
Type | Name | Description |
---|---|---|
System. |
srcCultureName | The source culture name |
System. |
trgCultureName | The target culture name |
Properties
SourceCulture
Gets or sets the source culture
Declaration
public CultureInfo SourceCulture { get; set; }
Property Value
Type | Description |
---|---|
System. |
SourceCultureName
Gets or sets the source language in form of a culture code.
Declaration
public string SourceCultureName { get; set; }
Property Value
Type | Description |
---|---|
System. |
TargetCulture
Gets or sets the target culture
Declaration
public CultureInfo TargetCulture { get; set; }
Property Value
Type | Description |
---|---|
System. |
TargetCultureName
Gets or sets the target language in form of a culture code.
Declaration
public string TargetCultureName { get; set; }
Property Value
Type | Description |
---|---|
System. |
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 |
---|---|
System. |
A comparision result |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System. |
obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
System. |
true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System. |
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 |
---|---|
System. |
Reverse()
Creates a new language pair object with the reversed language direction.
Declaration
public LanguagePair Reverse()
Returns
Type | Description |
---|---|
Language |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
System. |
s | The input string |
Language |
lp | Will hold the deserialized (parsed) return value upon success, and is set to |
Returns
Type | Description |
---|---|
System. |
|