isc bundle

GitOrigin-RevId: e3e46e90b2756b699dfe1e6ffd5ee7d3f0168149
This commit is contained in:
Sergey Ignatov
2019-12-29 19:41:57 +03:00
committed by intellij-monorepo-bot
parent b2715439f9
commit d72f96f8f7

View File

@@ -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)
}