i18n: Add bundle for New J2K
This commit is contained in:
committed by
Dmitry Gridin
parent
eabcff5c2a
commit
b0cd9911a4
@@ -0,0 +1,4 @@
|
|||||||
|
progress.text={0} – phase {1,number,#} of {2,number,#}
|
||||||
|
progress.searching.usages.to.update=Searching usages to update…
|
||||||
|
|
||||||
|
phase.converting.j2k=Converting Java code to Kotlin code
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.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.*
|
||||||
|
|
||||||
|
object KotlinNJ2KBundle : KotlinBundleBase() {
|
||||||
|
@NonNls
|
||||||
|
private const val BUNDLE = "org.jetbrains.kotlin.nj2k.KotlinNJ2KBundle"
|
||||||
|
|
||||||
|
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
|
||||||
|
return CommonBundle.message(bundle, key, *params)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -117,7 +117,7 @@ class NewJavaToKotlinConverter(
|
|||||||
|
|
||||||
|
|
||||||
override fun elementsToKotlin(inputElements: List<PsiElement>, processor: WithProgressProcessor): Result {
|
override fun elementsToKotlin(inputElements: List<PsiElement>, processor: WithProgressProcessor): Result {
|
||||||
val phaseDescription = "Converting Java code to Kotlin code"
|
val phaseDescription = KotlinNJ2KBundle.message("phase.converting.j2k")
|
||||||
val contextElement = inputElements.firstOrNull() ?: return Result(emptyList(), null, null)
|
val contextElement = inputElements.firstOrNull() ?: return Result(emptyList(), null, null)
|
||||||
val resolver = JKResolver(project, targetModule, contextElement)
|
val resolver = JKResolver(project, targetModule, contextElement)
|
||||||
val symbolProvider = JKSymbolProvider(resolver)
|
val symbolProvider = JKSymbolProvider(resolver)
|
||||||
@@ -208,7 +208,7 @@ class NewJ2kWithProgressProcessor(
|
|||||||
override fun updateState(fileIndex: Int?, phase: Int, description: String) {
|
override fun updateState(fileIndex: Int?, phase: Int, description: String) {
|
||||||
progress?.checkCanceled()
|
progress?.checkCanceled()
|
||||||
progress?.fraction = phase / phasesCount.toDouble()
|
progress?.fraction = phase / phasesCount.toDouble()
|
||||||
progress?.text = "$description - phase $phase of $phasesCount"
|
progress?.text = KotlinNJ2KBundle.message("progress.text", description, phase, phasesCount)
|
||||||
progress?.text2 = when {
|
progress?.text2 = when {
|
||||||
files != null && files.isNotEmpty() && fileIndex != null -> files[fileIndex].virtualFile.presentableUrl
|
files != null && files.isNotEmpty() && fileIndex != null -> files[fileIndex].virtualFile.presentableUrl
|
||||||
else -> ""
|
else -> ""
|
||||||
|
|||||||
+2
-1
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.j2k.ExternalCodeProcessing
|
|||||||
import org.jetbrains.kotlin.j2k.ProgressPortionReporter
|
import org.jetbrains.kotlin.j2k.ProgressPortionReporter
|
||||||
import org.jetbrains.kotlin.j2k.ReferenceSearcher
|
import org.jetbrains.kotlin.j2k.ReferenceSearcher
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
import org.jetbrains.kotlin.nj2k.KotlinNJ2KBundle
|
||||||
import org.jetbrains.kotlin.nj2k.fqNameWithoutCompanions
|
import org.jetbrains.kotlin.nj2k.fqNameWithoutCompanions
|
||||||
import org.jetbrains.kotlin.nj2k.psi
|
import org.jetbrains.kotlin.nj2k.psi
|
||||||
import org.jetbrains.kotlin.nj2k.tree.JKDeclaration
|
import org.jetbrains.kotlin.nj2k.tree.JKDeclaration
|
||||||
@@ -72,7 +73,7 @@ class NewExternalCodeProcessing(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun prepareWriteOperation(progress: ProgressIndicator?): (List<KtFile>) -> Unit {
|
override fun prepareWriteOperation(progress: ProgressIndicator?): (List<KtFile>) -> Unit {
|
||||||
progress?.text = "Searching usages to update..."
|
progress?.text = KotlinNJ2KBundle.message("progress.searching.usages.to.update")
|
||||||
|
|
||||||
val usages = mutableListOf<ExternalUsagesFixer.JKMemberInfoWithUsages>()
|
val usages = mutableListOf<ExternalUsagesFixer.JKMemberInfoWithUsages>()
|
||||||
for ((index, member) in members.values.withIndex()) {
|
for ((index, member) in members.values.withIndex()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user