add_truncation_text
Appends or formats a truncation indicator to a given string, using a localized default or a provided template that supports optional string replacement.
def add_truncation_text(
text: string,
truncate: string = null
) - > string
Appends a truncation indicator to a string or formats it using a provided template to signal that content has been shortened.
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The original text content that has been truncated. |
| truncate | string = null | A custom truncation string or template containing "%(truncated_text)s"; defaults to a localized ellipsis format. |
Returns
| Type | Description |
|---|---|
string | The text with the truncation indicator applied, either via string interpolation or simple concatenation. |