Search Results for

    Show / Hide Table of Contents

    Class DateTimeToken

    A Token which represents a date or time expression.

    Inheritance
    System.Object
    SegmentElement
    Token
    DateTimeToken
    Implements
    ILocalizableToken
    Inherited Members
    Token.SetTokenType(TokenType)
    Token.GetWeakHashCode()
    Token.GetBundleSimilarity(SegmentElement)
    Token.TokenizationContext
    Token.Text
    Token.Span
    Token.Type
    Token.IsWord
    Token.IsPunctuation
    Token.IsWhitespace
    Token.Culture
    SegmentElement.GetSimilarity(SegmentElement, Boolean)
    System.Object.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core.Tokenization
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    public class DateTimeToken : Token, ILocalizableToken

    Constructors

    DateTimeToken()

    Initializes a new instance with default values.

    Declaration
    public DateTimeToken()

    DateTimeToken(DateTimeToken)

    Initializes a new instance with the values of another token, creating a deep copy.

    Declaration
    public DateTimeToken(DateTimeToken other)
    Parameters
    Type Name Description
    DateTimeToken other

    The other token (must not be null)

    DateTimeToken(String, DateTime, DateTimePatternType)

    Initializes a new instance with the specified values.

    Declaration
    public DateTimeToken(string text, DateTime dateTime, DateTimePatternType type)
    Parameters
    Type Name Description
    System.String text

    The text to assign to the token

    System.DateTime dateTime

    The System.DateTime object to assign to the token's value

    DateTimePatternType type

    The type of the date or time token

    DateTimeToken(String, DateTime, DateTimePatternType, String)

    Initializes a new instance with the specified values.

    Declaration
    public DateTimeToken(string text, DateTime dateTime, DateTimePatternType type, string formatString)
    Parameters
    Type Name Description
    System.String text

    The text to assign to the token

    System.DateTime dateTime

    The System.DateTime object to assign to the token's value

    DateTimePatternType type

    The type of the date or time token

    System.String formatString

    The format string describing this value, used to generate new values in the same format

    Properties

    DateTimePatternType

    Gets or sets the pattern type

    Declaration
    public DateTimePatternType DateTimePatternType { get; set; }
    Property Value
    Type Description
    DateTimePatternType

    FormatString

    Gets or sets the format string corresponding to the text representation of this date value, if available. See https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

    Declaration
    public string FormatString { get; set; }
    Property Value
    Type Description
    System.String

    IsDateToken

    Gets a value to indicate whether this token represents a date or not.

    Declaration
    public bool IsDateToken { get; }
    Property Value
    Type Description
    System.Boolean

    IsPlaceable

    IsPlaceable. Always true for this class.

    Declaration
    public override bool IsPlaceable { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    Token.IsPlaceable

    IsSubstitutable

    IsSubstitutable. Always true for this class.

    Declaration
    public override bool IsSubstitutable { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    Token.IsSubstitutable

    IsTimeToken

    Gets a value to indicate whether this token represents a time or not.

    Declaration
    public bool IsTimeToken { get; }
    Property Value
    Type Description
    System.Boolean

    Value

    Gets or sets the value

    Declaration
    public DateTime Value { get; set; }
    Property Value
    Type Description
    System.DateTime

    Methods

    AcceptSegmentElementVisitor(ISegmentElementVisitor)

    Visitor pattern implementation. Calls VisitDateTimeToken(DateTimeToken).

    Declaration
    public override void AcceptSegmentElementVisitor(ISegmentElementVisitor visitor)
    Parameters
    Type Name Description
    ISegmentElementVisitor visitor

    The visitor instance

    Overrides
    SegmentElement.AcceptSegmentElementVisitor(ISegmentElementVisitor)

    Duplicate()

    See Duplicate()

    Declaration
    public override SegmentElement Duplicate()
    Returns
    Type Description
    SegmentElement

    A new instance that is a deep copy of this instance.

    Overrides
    SegmentElement.Duplicate()

    Equals(Object)

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

    The object to compare with the current object.

    Returns
    Type Description
    System.Boolean

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

    Overrides
    Token.Equals(Object)

    GetHashCode()

    System.Object.GetHashCode(object)
    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    Token.GetHashCode()

    GetSimilarity(SegmentElement)

    GetSimilarity(SegmentElement)
    Declaration
    public override SegmentElement.Similarity GetSimilarity(SegmentElement other)
    Parameters
    Type Name Description
    SegmentElement other

    The other instance.

    Returns
    Type Description
    SegmentElement.Similarity

    A value indicating the degree of similarity to the provided segment element.

    Overrides
    SegmentElement.GetSimilarity(SegmentElement)

    GetTokenType()

    Type
    Declaration
    protected override TokenType GetTokenType()
    Returns
    Type Description
    TokenType
    Overrides
    Token.GetTokenType()

    Localize(CultureInfo, AutoLocalizationSettings)

    Auto-localizes the token according to the settings of the specified target culture and the provided auto-localization settings. The text of the token will be changed, but not the values.

    For some token types, special AutoLocalizationSettings will be used, if provided.

    Declaration
    public virtual bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings)
    Parameters
    Type Name Description
    System.Globalization.CultureInfo culture

    The target culture

    AutoLocalizationSettings autoLocalizationSettings

    Contains the AutoLocalizationSettings to use for some token types. May be null, in which case default settings will be used.

    Returns
    Type Description
    System.Boolean

    true if the token text has been changed, and false otherwise

    Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, Boolean)

    Auto-localizes the token according to the settings of the specified target culture and the provided auto-localization settings. The text of the token will be changed, but not the values.

    For some token types, special AutoLocalizationSettings will be used, if provided.

    Declaration
    public virtual bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ILocalizableToken originalMemoryToken, bool adjustCasing)
    Parameters
    Type Name Description
    System.Globalization.CultureInfo culture

    The target culture

    AutoLocalizationSettings autoLocalizationSettings

    Contains the AutoLocalizationSettings to use for some token types. May be null, in which case default settings will be used.

    ILocalizableToken originalMemoryToken

    The original memory token. Some auto-localization settings will be derived from the token, if provided.

    System.Boolean adjustCasing

    If true, it is assumed that the token is in segment-initial position. Then, casing will be adjusted if the original memory token is supplied as well.

    Returns
    Type Description
    System.Boolean

    true if the token text has been changed, and false otherwise

    SetValue(Token, Boolean)

    Overwrites the current token's value with the value from blueprint, which also must be a DateTimeToken. Note that only the value and the type are overwritten, not the textual representation.

    Declaration
    public virtual bool SetValue(Token blueprint, bool keepNumericSeparators)
    Parameters
    Type Name Description
    Token blueprint

    The token to take the value from

    System.Boolean keepNumericSeparators

    (ignored)

    Returns
    Type Description
    System.Boolean

    A flag indicating whether the token's value or type were changed.

    Implements

    ILocalizableToken

    On this page

    • Constructors
      • DateTimeToken()
      • DateTimeToken(DateTimeToken)
      • DateTimeToken(String, DateTime, DateTimePatternType)
      • DateTimeToken(String, DateTime, DateTimePatternType, String)
    • Properties
      • DateTimePatternType
      • FormatString
      • IsDateToken
      • IsPlaceable
      • IsSubstitutable
      • IsTimeToken
      • Value
    • Methods
      • AcceptSegmentElementVisitor(ISegmentElementVisitor)
      • Duplicate()
      • Equals(Object)
      • GetHashCode()
      • GetSimilarity(SegmentElement)
      • GetTokenType()
      • Localize(CultureInfo, AutoLocalizationSettings)
      • Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, Boolean)
      • SetValue(Token, Boolean)
    • Implements
    Back to top Generated by DocFX