Enables scripted content fragments to retrieve localized text and format data.
- Properties
- FormatAgoDate
- FormatDataSize
- FormatDate
- FormatDateAndTime
- FormatNumber
- FormatString
- FormatTime
- FormatUrl
- GetInitials
- GetResource
- Lowercase
- RemoveHtml
- Truncate
- Uppercase
Properties
Name | Access | Type | Description |
---|---|---|---|
Code | Read | String | Identifies the current language code, for example, en. |
CodeAndLocale | Read | String | Identifies the current language code and locale, for example, en-us. |
IsRightToLeft | Read | Boolean | Identifies if the accessing user's language is rendered right to left. |
NewLine | Read | String | Environment-aware new line character |
Methods
FormatAgoDate
FormatAgoDate Overload 1
Formats a date as a readable 'time ago' format
Velocity
#set($stringResponse = $core_v2_language.FormatAgoDate($date))
JavaScript
var stringResponse = core_v2_language.FormatAgoDate(date);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required |
FormatAgoDate Overload 2
Formats a date as a readable 'time ago' format. DEPRECATED: Parameter "useUserTime" is no longer supported
Velocity
#set($stringResponse = $core_v2_language.FormatAgoDate($date, $useUserTime))
JavaScript
var stringResponse = core_v2_language.FormatAgoDate(date, useUserTime);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required | ||
useUserTime | Boolean | Use User Time | Required |
Returns
String
FormatDataSize
Formats a data size
Velocity
#set($stringResponse = $core_v2_language.FormatDataSize($size))
JavaScript
var stringResponse = core_v2_language.FormatDataSize(size);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
size | Int32 | Size | Required |
Returns
String
FormatDate
FormatDate Overload 1
Formats a date to the default date format
Velocity
#set($stringResponse = $core_v2_language.FormatDate($date))
JavaScript
var stringResponse = core_v2_language.FormatDate(date);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required |
FormatDate Overload 2
Formats a date to a custom date format
Velocity
#set($stringResponse = $core_v2_language.FormatDate($date, $format))
JavaScript
var stringResponse = core_v2_language.FormatDate(date, format);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required | ||
format | String | Supports standard and custom datetime formats as defined msdn.microsoft.com/.../az4se3k1.aspx and msdn.microsoft.com/.../8kb3ddd4.aspx | Required |
FormatDate Overload 3
Formats a date to a custom date format and or adjusted time zone
Velocity
#set($stringResponse = $core_v2_language.FormatDate($date, "%{ AdjustTimeZone = $adjustTimeZoneArg, Format = $formatArg, TimeZoneId = $timeZoneIdArg }"))
JavaScript
var stringResponse = core_v2_language.FormatDate(date, { AdjustTimeZone: adjustTimeZoneArg, Format: formatArg, TimeZoneId: timeZoneIdArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required | ||
options | Options | Set of optional parameters including: | Required | ||
AdjustTimeZone | Boolean | When true, converts to accessing user's time zone. DEPRECATED: this parameter is no longer supported | Optional | True | |
Format | String | Custom format | Optional | ||
TimeZoneId | String | TimeZone Id | Optional |
Returns
String
FormatDateAndTime
FormatDateAndTime Overload 1
Formats a date to the default date and time format
Velocity
#set($stringResponse = $core_v2_language.FormatDateAndTime($date))
JavaScript
var stringResponse = core_v2_language.FormatDateAndTime(date);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required |
FormatDateAndTime Overload 2
Formats a date to the default date and time format
Velocity
#set($stringResponse = $core_v2_language.FormatDateAndTime($date, "%{ AdjustTimeZone = $adjustTimeZoneArg }"))
JavaScript
var stringResponse = core_v2_language.FormatDateAndTime(date, { AdjustTimeZone: adjustTimeZoneArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required | ||
options | Options | Set of optional parameters including: | Required | ||
AdjustTimeZone | Boolean | When true, converts to accessing user's time zone. DEPRECATED: this parameter is no longer supported | Optional | True |
Returns
String
FormatNumber
FormatNumber Overload 1
Formats a number
Velocity
#set($stringResponse = $core_v2_language.FormatNumber($number))
JavaScript
var stringResponse = core_v2_language.FormatNumber(number);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
number | Int32 | Number | Required |
FormatNumber Overload 2
Formats a number
Velocity
#set($stringResponse = $core_v2_language.FormatNumber($number))
JavaScript
var stringResponse = core_v2_language.FormatNumber(number);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
number | Double | Number | Required |
Returns
String
FormatString
FormatString Overload 1
Replaces each format item in a specified string with the text equivalent of a corresponding object's value.
Velocity
#set($stringResponse = $core_v2_language.FormatString($format, $parameters))
JavaScript
var stringResponse = core_v2_language.FormatString(format, parameters);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
format | String | Format string including indexed placeholders: {0}, {1}, {2}, etc | Required | ||
parameters | Array of String | Parameters | Required |
FormatString Overload 2
Replaces each format item of the format {NAME} with the value of the item with that name in the parameters dictionary.
Velocity
#set($stringResponse = $core_v2_language.FormatString($format, "%{}"))
JavaScript
var stringResponse = core_v2_language.FormatString(format, {});
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
format | String | Format string including named parameters in the format {name}. | Required | ||
parameters | Options | Set of optional parameters including: | Required |
Returns
String
FormatTime
Formats the time component of a date/time using the site default time format.
Velocity
#set($stringResponse = $core_v2_language.FormatTime($time))
JavaScript
var stringResponse = core_v2_language.FormatTime(time);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
time | DateTime | Time | Required |
Returns
String
FormatUrl
Formats a URL
Velocity
#set($stringResponse = $core_v2_language.FormatUrl($url))
JavaScript
var stringResponse = core_v2_language.FormatUrl(url);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
url | String | Url | Required |
Returns
String
GetInitials
Returns initials for a full Name
Velocity
#set($stringResponse = $core_v2_language.GetInitials($fullName))
JavaScript
var stringResponse = core_v2_language.GetInitials(fullName);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
fullName | String | Full Name | Required |
Returns
String
GetResource
Gets the widget-specified language resource defined by a resource name
Velocity
#set($stringResponse = $core_v2_language.GetResource($resourceName))
JavaScript
var stringResponse = core_v2_language.GetResource(resourceName);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
resourceName | String | Resource Name | Required |
Returns
String
Lowercase
Converts a string to lower-case
Velocity
#set($stringResponse = $core_v2_language.Lowercase($text))
JavaScript
var stringResponse = core_v2_language.Lowercase(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Text | Required |
Returns
String
RemoveHtml
Removes HTML from a string
Velocity
#set($stringResponse = $core_v2_language.RemoveHtml($html))
JavaScript
var stringResponse = core_v2_language.RemoveHtml(html);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
html | String | Html | Required |
Returns
String
Truncate
Truncate Overload 1
Truncates text as close to the desiredLength as possible without breaking words. Also removes HTML
Velocity
#set($stringResponse = $core_v2_language.Truncate($text, $desiredLength, $ellipsis))
JavaScript
var stringResponse = core_v2_language.Truncate(text, desiredLength, ellipsis);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Text | Required | ||
desiredLength | Int32 | Desired Length | Required | ||
ellipsis | String | String to truncate | Required |
Truncate Overload 2
Truncates text as close to the desiredLength as possible without breaking words.
Velocity
#set($stringResponse = $core_v2_language.Truncate($text, $desiredLength, "%{ Ellipsis = $ellipsisArg, MaintainHtmlFormatting = $maintainHtmlFormattingArg }"))
JavaScript
var stringResponse = core_v2_language.Truncate(text, desiredLength, { Ellipsis: ellipsisArg, MaintainHtmlFormatting: maintainHtmlFormattingArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | String to truncate | Required | ||
desiredLength | Int32 | Desired length to truncate at. Truncation will break on the next word boundary. | Required | ||
options | Options | Set of optional parameters including: | Required | ||
Ellipsis | String | String to append after the truncated string. | Optional | ... | |
MaintainHtmlFormatting | Boolean | When true, maintains HTML formatting within the trucated string. | Optional | False |
Returns
String
Uppercase
Converts a string to upper-case
Velocity
#set($stringResponse = $core_v2_language.Uppercase($text))
JavaScript
var stringResponse = core_v2_language.Uppercase(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Text | Required |
Returns
String