LocalizedContent

annotation class LocalizedContent(val templateKey: String)(source)

Annotates a method as a message supplier.

Requirements

  • Return a String

  • Be non-suspending

  • Have no optional parameters

  • Be in an interface extending IMessageSource

Optional annotations

  • @PreferLocale: Allows changing the default locale with another preferred locale

Parameters

  • The first parameter can be a DiscordLocale or a Locale, they can be nullable, if it is null, then the default locale is used

  • Each following parameter is a template argument

    • Their name is converted from camelCase to snake_case

    • Their value is converted to a string using toString

See also

Properties

Link copied to clipboard
@get:JvmName(name = "value")
val templateKey: String

The key to the localizable template, in the bundle specified by @MessageSourceFactory.