i18n: replace KotlinBundleBase with AbstractKotlinBundle

This commit is contained in:
Dmitry Gridin
2020-03-04 17:33:40 +07:00
parent 0a3e577b6c
commit 7507d62ec3
13 changed files with 58 additions and 149 deletions
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.core.util
import java.lang.ref.Reference
import java.lang.ref.SoftReference
import java.util.*
abstract class KotlinBundleBase {
private var bundleCache: Reference<ResourceBundle>? = null
protected abstract fun createBundle(): ResourceBundle
val bundle: ResourceBundle
get() {
val cachedValue = bundleCache?.get()
if (cachedValue != null) {
return cachedValue
}
val newValue = createBundle()
bundleCache = SoftReference(newValue)
return newValue
}
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.idea.git
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinGitBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinGitBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinGitBundle"
object KotlinGitBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.ide.konan
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinGradleNativeBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinGradleNativeBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinGradleNativeBundle"
object KotlinGradleNativeBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.idea
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinJvmBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinJvmBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinJvmBundle"
object KotlinJvmBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.idea.maven
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinMavenBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinMavenBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinMavenBundle"
object KotlinMavenBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.ide.konan
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinNativeBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinNativeBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinNativeBundle"
object KotlinNativeBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.tools.projectWizard.wizard
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinNewProjectWizardBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinNewProjectWizardBundle"
object KotlinNewProjectWizardBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.idea.debugger
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinDebuggerCoreBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinDebuggerCoreBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinDebuggerCoreBundle"
object KotlinDebuggerCoreBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.idea.debugger.coroutine
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinDebuggerCoroutinesBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinDebuggerCoroutinesBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinDebuggerCoroutinesBundle"
object KotlinDebuggerCoroutinesBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,17 @@
package org.jetbrains.kotlin.idea.debugger.evaluate
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinDebuggerEvaluationBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinDebuggerEvaluationBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinDebuggerEvaluationBundle"
object KotlinDebuggerEvaluationBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(
@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String,
vararg params: Any
): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.nj2k
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinNJ2KServicesBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinNJ2KServicesBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinNJ2KServicesBundle"
object KotlinNJ2KServicesBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -5,20 +5,14 @@
package org.jetbrains.kotlin.nj2k
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
import org.jetbrains.kotlin.util.AbstractKotlinBundle
object KotlinNJ2KBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "messages.KotlinNJ2KBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@NonNls
private const val BUNDLE = "messages.KotlinNJ2KBundle"
object KotlinNJ2KBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}