Class AiChatI18n

java.lang.Object
io.jmix.aichat.component.chat.AiChatI18n
All Implemented Interfaces:
Serializable

public class AiChatI18n extends Object implements Serializable
Internationalization holder for AiChat: the screen-reader announcements the chat itself makes as a generation starts, completes, fails or is stopped, plus the localization of the two components it composes.

Those two are the inner components' own holders, nested here rather than restated: AiMessageInputI18n for the composer and AiMessageListI18n (which in turn nests the code block's) for the transcript. The chat's localization therefore mirrors the component tree it builds, and a label added to an inner component reaches the chat without a change here.

See Also:
  • Constructor Details

    • AiChatI18n

      public AiChatI18n()
  • Method Details

    • fromMessages

      public static AiChatI18n fromMessages(Messages messages)
      Creates an instance with the chat's own announcements resolved from the message bundle (aiChat.i18n.*) and both nested holders from their own keys — the whole tree localized, which is what AiChat applies when it is created.
      Parameters:
      messages - the messages bean
      Returns:
      a new localized instance
    • getGenerating

      public @Nullable String getGenerating()
      Returns:
      the screen-reader announcement for the generating state, or null
    • setGenerating

      public AiChatI18n setGenerating(@Nullable String generating)
      Sets the screen-reader (aria-live) announcement made when generation starts. Default when null: "AI is processing the prompt".
      Parameters:
      generating - the announcement, or null for the default
      Returns:
      this instance for chaining
    • getFailed

      public @Nullable String getFailed()
      Returns:
      the screen-reader announcement for the failed state, or null
    • setFailed

      public AiChatI18n setFailed(@Nullable String failed)
      Sets the screen-reader (aria-live) announcement made when generation fails. Default when null: "Generation failed".
      Parameters:
      failed - the announcement, or null for the default
      Returns:
      this instance for chaining
    • getDone

      public @Nullable String getDone()
      Returns:
      the screen-reader announcement for the completed (idle) state, or null
    • setDone

      public AiChatI18n setDone(@Nullable String done)
      Sets the screen-reader (aria-live) announcement made when a response completes. Default when null: "New message available".
      Parameters:
      done - the announcement, or null for the default
      Returns:
      this instance for chaining
    • getStopped

      public @Nullable String getStopped()
      Returns:
      the screen-reader announcement for a cancelled generation, or null
    • setStopped

      public AiChatI18n setStopped(@Nullable String stopped)
      Sets the screen-reader (aria-live) announcement made when the user stops a generation. Default when null: "Generation stopped".
      Parameters:
      stopped - the announcement, or null for the default
      Returns:
      this instance for chaining
    • getMessageInput

      public @Nullable AiMessageInputI18n getMessageInput()
      Returns:
      the localization of the composer, or null
    • setMessageInput

      public AiChatI18n setMessageInput(@Nullable AiMessageInputI18n messageInput)
      Sets the localization of the composer. AiChat.setI18n(AiChatI18n) hands it to the inner AiMessageInput as is, so a null field there falls back to the client's hardcoded English rather than to the message bundle.
      Parameters:
      messageInput - the composer's localization, or null to leave the composer alone
      Returns:
      this instance for chaining
    • getMessageList

      public @Nullable AiMessageListI18n getMessageList()
      Returns:
      the localization of the transcript, or null
    • setMessageList

      public AiChatI18n setMessageList(@Nullable AiMessageListI18n messageList)
      Sets the localization of the transcript, including — through AiMessageListI18n.setCodeBlock(io.jmix.aichat.component.codeblock.AiCodeBlockI18n) — that of the code blocks rendered inside messages. AiChat.setI18n(AiChatI18n) hands it to the inner AiMessageList as is.
      Parameters:
      messageList - the transcript's localization, or null to leave the list alone
      Returns:
      this instance for chaining