Interface ILocalizableToken
Defines the interface for auto-localizable tokens. Localizable tokens have a value, and their surface representation ("text") can be automatically converted into a target culture representation, given the token's value and the target culture.
Namespace: Sdl.LanguagePlatform.Core.Tokenization
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
public interface ILocalizableToken
Properties
TokenizationContext
The TokenizationContext in which to apply localization etc.
Declaration
TokenizationContext TokenizationContext { get; set; }
Property Value
Type | Description |
---|---|
TokenizationContext |
Methods
Localize(CultureInfo, AutoLocalizationSettings)
Declaration
bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | |
AutoLocalizationSettings | autoLocalizationSettings |
Returns
Type | Description |
---|---|
System.Boolean |
Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, Boolean)
Declaration
bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ILocalizableToken originalMemoryToken, bool adjustCasing)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | |
AutoLocalizationSettings | autoLocalizationSettings | |
ILocalizableToken | originalMemoryToken | |
System.Boolean | adjustCasing |
Returns
Type | Description |
---|---|
System.Boolean |
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
Task<bool> LocalizeAsync(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ICultureMetadataManager cultureMetadataManager)
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. |
Sdl.Core.Globalization.CultureMetadataManager.ICultureMetadataManager | cultureMetadataManager |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> |
|
LocalizeAsync(CultureInfo, AutoLocalizationSettings, ILocalizableToken, Boolean, 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
Task<bool> LocalizeAsync(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ILocalizableToken originalMemoryToken, bool adjustCasing, ICultureMetadataManager cultureMetadataManager)
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. |
Sdl.Core.Globalization.CultureMetadataManager.ICultureMetadataManager | cultureMetadataManager |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> |
|
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
bool SetValue(Token blueprint, bool keepNumericSeparators)
Parameters
Type | Name | Description |
---|---|---|
Token | blueprint | The token to take the value from |
System.Boolean | keepNumericSeparators | Applicable to numeric (number and measurement) tokens only: if true, do not override the original group and decimal separators. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the token's value or type were changed. |