I18nService

interface I18nService(source)

此接口提供安全的 i18n 读取服务,使用 I18nDef 来读取国际化的文本,而不必手动输入 i18n 条目的 key。

通过 io.github.autotweaker.api.I18nable 接口,可以在任何地方获取 I18nService 来取值。

Functions

Link copied to clipboard
abstract fun getLanguage(): Locale

获取程序使用的语言,请不要使用 Locale.getDefault,通过此 api 获取到的语言可能经过用户配置。

Link copied to clipboard
abstract operator fun invoke(def: I18nDef, vararg args: Any?): String

用法:override val description get() = i18n(Description())