Search Results for

    Show / Hide Table of Contents

    Class DateTimeToken

    A Token which represents a date or time expression.

    Inheritance
    object
    SegmentElement
    Token
    DateTimeToken
    Implements
    ILocalizableToken
    Inherited Members
    Token.SetTokenType(TokenType)
    Token.GetWeakHashCode()
    Token.GetBundleSimilarity(SegmentElement)
    Token.GetIdentityStringAsync()
    Token.TokenizationContext
    Token.Text
    Token.Span
    Token.Type
    Token.IsWord
    Token.IsPunctuation
    Token.IsWhitespace
    Token.Culture
    SegmentElement.GetSimilarity(SegmentElement)
    SegmentElement.GetSimilarity(SegmentElement, bool)
    SegmentElement.GetSimilarityAsync(SegmentElement)
    SegmentElement.GetSimilarityAsync(SegmentElement, bool)
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core.Tokenization
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    [DataContract]
    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
    string text

    The text to assign to the token

    DateTime dateTime

    The 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
    string text

    The text to assign to the token

    DateTime dateTime

    The DateTime object to assign to the token's value

    DateTimePatternType type

    The type of the date or time token

    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
    [DataMember]
    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
    [DataMember]
    public string FormatString { get; set; }
    Property Value
    Type Description
    string

    IsDateToken

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

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

    IsPlaceable

    IsPlaceable. Always true for this class.

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

    IsSubstitutable

    IsSubstitutable. Always true for this class.

    Declaration
    public override bool IsSubstitutable { get; }
    Property Value
    Type Description
    bool
    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
    bool

    Value

    Gets or sets the value

    Declaration
    [DataMember]
    public DateTime Value { get; set; }
    Property Value
    Type Description
    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()

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

    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
    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
    Token.Equals(object)

    GetHashCode()

    System.Object.GetHashCode(object)

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    Token.GetHashCode()

    GetTokenType()

    Type

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

    Localize(CultureInfo, AutoLocalizationSettings)

    See LocalizeAsync(CultureInfo, AutoLocalizationSettings, ICultureMetadataManager)

    Declaration
    public bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings)
    Parameters
    Type Name Description
    CultureInfo culture
    AutoLocalizationSettings autoLocalizationSettings
    Returns
    Type Description
    bool

    Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool)

    See LocalizeAsync(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool, ICultureMetadataManager)

    Declaration
    public bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ILocalizableToken originalMemoryToken, bool adjustCasing)
    Parameters
    Type Name Description
    CultureInfo culture
    AutoLocalizationSettings autoLocalizationSettings
    ILocalizableToken originalMemoryToken
    bool adjustCasing
    Returns
    Type Description
    bool

    LocalizeAsync(CultureInfo, AutoLocalizationSettings, ICultureMetadataManager)

    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 Task<bool> LocalizeAsync(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    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.

    ICultureMetadataManager cultureMetadataManager
    Returns
    Type Description
    Task<bool>

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

    LocalizeAsync(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool, ICultureMetadataManager)

    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 Task<bool> LocalizeAsync(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ILocalizableToken originalMemoryToken, bool adjustCasing, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    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.

    bool 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.

    ICultureMetadataManager cultureMetadataManager
    Returns
    Type Description
    Task<bool>

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

    SetValue(Token, bool)

    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

    bool keepNumericSeparators

    Applicable to numeric (number and measurement) tokens only: if true, do not override the original group and decimal separators.

    Returns
    Type Description
    bool

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

    Implements

    ILocalizableToken
    In this article
    • 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()
      • GetTokenType()
      • Localize(CultureInfo, AutoLocalizationSettings)
      • Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool)
      • LocalizeAsync(CultureInfo, AutoLocalizationSettings, ICultureMetadataManager)
      • LocalizeAsync(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool, ICultureMetadataManager)
      • SetValue(Token, bool)
    • Implements
    Back to top Generated by DocFX