Text Utilities

Localization Utils

class BBLocalizationUtils

Bases: object

Utilities for manipulating Localized Strings.

classmethod combine_strings(text_list, separator_text=BBStringId.BBL_STRING_COMMA_STRING)

Combine multiple strings by a separation string.

Parameters:
  • text_list (Iterable[int or str or LocalizedString]) – The text to combine.

  • separator_text (int) – The text that will act as the separator.

Returns:

A combined string.

Return type:

LocalizedString

classmethod to_localized_string(text, tokens=(), normalize_tokens=True)

Convert an Integer or String into a Localized String.

Parameters:
  • text (int or str) – The text or string ID to convert.

  • tokens (Tuple[Any], optional) – Tokens to format into the text. Default is no tokens.

  • normalize_tokens (bool, optional) – If True, the tokens will be normalized into their own localized strings. Default is True.

Returns:

A localized string.

Return type:

LocalizedString

classmethod to_localized_tooltip(text, tokens=(), normalize_tokens=True)

Convert an Integer or String into a Localized Tooltip.

Parameters:
  • text (int or str) – The text or string ID to convert.

  • tokens (Tuple[Any], optional) – Tokens to format into the text. Default is no tokens.

  • normalize_tokens (bool, optional) – If True, the tokens will be normalized into their own localized strings. Default is True.

Returns:

A localized tooltip.

Return type:

BBLocalizedTooltip

Localized Tooltip