Fix subclassing of DynamicBundle in ComposeTemplateBundle

It is not recommended
This commit is contained in:
Yuriy Artamonov 2025-08-30 10:15:28 +02:00
parent b32e3fee01
commit 5d5ef16235
2 changed files with 11 additions and 9 deletions

View File

@ -1,20 +1,22 @@
package org.jetbrains.plugins.template
import com.intellij.DynamicBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.PropertyKey
import java.util.function.Supplier
@NonNls
private const val BUNDLE = "messages.ComposeTemplate"
object ComposeTemplateBundle : DynamicBundle(BUNDLE) {
object ComposeTemplateBundle {
private val instance = DynamicBundle(ComposeTemplateBundle::class.java, BUNDLE)
@JvmStatic
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
getMessage(key, *params)
fun message(key: @PropertyKey(resourceBundle = BUNDLE) String, vararg params: Any?): @Nls String {
return instance.getMessage(key, *params)
}
@Suppress("unused")
@JvmStatic
fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
getLazyMessage(key, *params)
fun lazyMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): Supplier<@Nls String> {
return instance.getLazyMessage(key, *params)
}
}

View File

@ -217,7 +217,7 @@ private fun MyLocationList(
}
) {
ContextPopupMenuItem(
ComposeTemplateBundle.getMessage("weather.app.context.menu.delete.option"),
ComposeTemplateBundle.message("weather.app.context.menu.delete.option"),
AllIconsKeys.General.Delete
) {
showPopup.value = false