mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
isc bundle
GitOrigin-RevId: e3e46e90b2756b699dfe1e6ffd5ee7d3f0168149
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b2715439f9
commit
d72f96f8f7
@@ -15,28 +15,16 @@
|
||||
*/
|
||||
package org.jetbrains.settingsRepository
|
||||
|
||||
import com.intellij.CommonBundle
|
||||
import com.intellij.DynamicBundle
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
import java.lang.ref.Reference
|
||||
import java.lang.ref.SoftReference
|
||||
import java.util.*
|
||||
|
||||
private var ourBundle: Reference<ResourceBundle>? = null
|
||||
|
||||
private const val BUNDLE: String = "messages.IcsBundle"
|
||||
|
||||
fun icsMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
|
||||
return CommonBundle.message(getBundle(), key, *params)
|
||||
object IcsBundle : DynamicBundle(BUNDLE) {
|
||||
@JvmStatic
|
||||
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
|
||||
}
|
||||
|
||||
private fun getBundle(): ResourceBundle {
|
||||
var bundle: ResourceBundle? = null
|
||||
if (ourBundle != null) {
|
||||
bundle = ourBundle!!.get()
|
||||
}
|
||||
if (bundle == null) {
|
||||
bundle = ResourceBundle.getBundle(BUNDLE)
|
||||
ourBundle = SoftReference(bundle)
|
||||
}
|
||||
return bundle!!
|
||||
fun icsMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
|
||||
return IcsBundle.message(key, params)
|
||||
}
|
||||
Reference in New Issue
Block a user