2025-03-18 22:00:51 +02:00

2.1 KiB

druid.lang_text API

at /druid/extended/lang_text.lua

The component used for displaying localized text, can automatically update text when locale is changed

Functions

Fields

init


lang_text:init(node, [locale_id], [adjust_type])
  • Parameters:

    • node (string|node): The node_id or gui.get_node(node_id)
    • [locale_id] (string|nil): Default locale id or text from node as default
    • [adjust_type] (string|nil): Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
  • Returns:

    • `` (druid.lang_text):

on_language_change


lang_text:on_language_change()

set_to


lang_text:set_to(text)

Setup raw text to lang_text component

  • Parameters:

    • text (string): Text for text node
  • Returns:

    • self (druid.lang_text): Current instance

set_text


lang_text:set_text(text)

Setup raw text to lang_text component

  • Parameters:

    • text (string): Text for text node
  • Returns:

    • self (druid.lang_text): Current instance

translate


lang_text:translate(locale_id, ...)

Translate the text by locale_id

  • Parameters:

    • locale_id (string): Locale id
    • ... (...): vararg
  • Returns:

    • self (druid.lang_text): Current instance

format


lang_text:format(...)

Format string with new text params on localized text

  • Parameters:

    • ... (...): vararg
  • Returns:

    • self (druid.lang_text): Current instance

Fields

  • text (druid.text): The text component

  • node (node): The node of the text component

  • on_change (event): The event triggered when the text is changed

  • druid (druid.instance): The Druid Factory used to create components