Search Results for

    Show / Hide Table of Contents

    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 CultureInfo objects, the culture can also be specified using the name.

    Inheritance
    object
    LanguagePair
    Implements
    IComparable<LanguagePair>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    [DataContract]
    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
    CultureCode srcCulture

    The source culture name

    CultureCode trgCulture

    The target culture name

    Properties

    SourceCulture

    Gets or sets the source culture

    Declaration
    public CultureCode SourceCulture { get; set; }
    Property Value
    Type Description
    CultureCode

    SourceCultureName

    Gets or sets the source language in form of a culture code.

    Declaration
    [DataMember]
    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
    CultureCode

    TargetCultureName

    Gets or sets the target language in form of a culture code.

    Declaration
    [DataMember]
    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
    LanguagePair other
    Returns
    Type Description
    int

    A comparision result

    Equals(object)

    System.Object.Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)

    GetHashCode()

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for this object

    Overrides
    object.GetHashCode()

    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 (AreCompatible(CultureInfo, CultureInfo)).

    Declaration
    public bool IsCompatible(LanguagePair other)
    Parameters
    Type Name Description
    LanguagePair other
    Returns
    Type Description
    bool

    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 (AreCompatibleCodesAsync(CultureCode, CultureCode, ICultureMetadataManager)).

    Declaration
    public Task<bool> IsCompatiblePairAsync(LanguagePair other, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    LanguagePair other
    ICultureMetadataManager cultureMetadataManager
    Returns
    Type Description
    Task<bool>

    Reverse()

    Creates a new language pair object with the reversed language direction.

    Declaration
    public LanguagePair Reverse()
    Returns
    Type Description
    LanguagePair

    ToString()

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of the object, for display purposes.

    Overrides
    object.ToString()

    TryParse(string, out LanguagePair)

    Attempts to parse a language pair represented by a string, as produced by ToString().

    Declaration
    public static bool TryParse(string s, out LanguagePair lp)
    Parameters
    Type Name Description
    string s

    The input string

    LanguagePair lp

    Will hold the deserialized (parsed) return value upon success, and is set to null otherwise.

    Returns
    Type Description
    bool

    true if the parsing was successful, false otherwise.

    Implements

    IComparable<T>
    In this article
    • Constructors
      • LanguagePair()
      • LanguagePair(CultureCode, CultureCode)
    • Properties
      • SourceCulture
      • SourceCultureName
      • TargetCulture
      • TargetCultureName
    • Methods
      • CompareTo(LanguagePair)
      • Equals(object)
      • GetHashCode()
      • IsCompatible(LanguagePair)
      • IsCompatiblePairAsync(LanguagePair, ICultureMetadataManager)
      • Reverse()
      • ToString()
      • TryParse(string, out LanguagePair)
    • Implements
    Back to top Generated by DocFX