i18n: Add bundle for New J2K services
This commit is contained in:
committed by
Dmitry Gridin
parent
59b5505379
commit
eabcff5c2a
+10
@@ -0,0 +1,10 @@
|
||||
processing.step.inferring.types=Inferring types
|
||||
processing.step.cleaning.up.code=Cleaning up code
|
||||
processing.step.optimizing.imports.and.formatting.code=Optimizing imports and formatting code
|
||||
|
||||
converter.kotlin.not.configured.title=Kotlin is not configured in the project
|
||||
converter.kotlin.not.configured.message=You will have to configure Kotlin in project before performing a conversion.
|
||||
converter.kotlin.not.configured.no.configurators.available=There are no configurators available
|
||||
converter.kotlin.not.configured.configure=OK, configure Kotlin in the project
|
||||
converter.kotlin.not.configured.cancel.conversion=No, cancel conversion
|
||||
converter.kotlin.not.configured.choose.configurator=Choose Configurator
|
||||
@@ -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 KotlinNJ2KServicesBundle : KotlinBundleBase() {
|
||||
@NonNls
|
||||
private const val BUNDLE = "org.jetbrains.kotlin.nj2k.KotlinNJ2KServicesBundle"
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -42,24 +42,27 @@ class NewJ2kConverterExtension : J2kConverterExtension() {
|
||||
hasAnyKotlinRuntimeInScope(module) || isModuleConfigured(module.toModuleGroup())
|
||||
if (kotlinIsConfigured) return true
|
||||
|
||||
val title = "Kotlin is not configured in the project"
|
||||
val title = KotlinNJ2KServicesBundle.message("converter.kotlin.not.configured.title")
|
||||
if (Messages.showOkCancelDialog(
|
||||
project,
|
||||
"You will have to configure Kotlin in project before performing a conversion.",
|
||||
KotlinNJ2KServicesBundle.message("converter.kotlin.not.configured.message"),
|
||||
title,
|
||||
"OK, configure Kotlin in the project",
|
||||
"No, cancel conversion",
|
||||
KotlinNJ2KServicesBundle.message("converter.kotlin.not.configured.configure"),
|
||||
KotlinNJ2KServicesBundle.message("converter.kotlin.not.configured.cancel.conversion"),
|
||||
Messages.getWarningIcon()
|
||||
) == Messages.OK
|
||||
) {
|
||||
val configurators = getAbleToRunConfigurators(module).filter { it.targetPlatform.isJvm() }
|
||||
when {
|
||||
configurators.isEmpty() -> Messages.showErrorDialog("There aren't configurators available", title)
|
||||
configurators.isEmpty() -> {
|
||||
val message = KotlinNJ2KServicesBundle.message("converter.kotlin.not.configured.no.configurators.available")
|
||||
Messages.showErrorDialog(message, title)
|
||||
}
|
||||
configurators.size == 1 -> configurators.single().configure(project, emptyList())
|
||||
else -> {
|
||||
val resultIndex = Messages.showChooseDialog(//TODO a better dialog?
|
||||
project,
|
||||
"Choose Configurator",
|
||||
KotlinNJ2KServicesBundle.message("converter.kotlin.not.configured.choose.configurator"),
|
||||
title,
|
||||
null,
|
||||
configurators.map { it.presentableText }.toTypedArray(),
|
||||
|
||||
@@ -27,11 +27,11 @@ import org.jetbrains.kotlin.j2k.PostProcessor
|
||||
import org.jetbrains.kotlin.j2k.files
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.nj2k.KotlinNJ2KServicesBundle
|
||||
import org.jetbrains.kotlin.nj2k.NewJ2kConverterContext
|
||||
import org.jetbrains.kotlin.nj2k.postProcessing.processings.*
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parents
|
||||
import sun.java2d.loops.FillRect
|
||||
|
||||
class NewJ2kPostProcessor : PostProcessor {
|
||||
@Suppress("PrivatePropertyName")
|
||||
@@ -260,7 +260,7 @@ private val cleaningUpDiagnosticBasedPostProcessingGroup =
|
||||
|
||||
private val processings: List<NamedPostProcessingGroup> = listOf(
|
||||
NamedPostProcessingGroup(
|
||||
"Inferring types",
|
||||
KotlinNJ2KServicesBundle.message("processing.step.inferring.types"),
|
||||
listOf(
|
||||
InspectionLikeProcessingGroup(
|
||||
processings = listOf(
|
||||
@@ -275,7 +275,7 @@ private val processings: List<NamedPostProcessingGroup> = listOf(
|
||||
)
|
||||
),
|
||||
NamedPostProcessingGroup(
|
||||
"Cleaning up code",
|
||||
KotlinNJ2KServicesBundle.message("processing.step.cleaning.up.code"),
|
||||
listOf(
|
||||
InspectionLikeProcessingGroup(VarToValProcessing()),
|
||||
ConvertGettersAndSettersToPropertyProcessing(),
|
||||
@@ -294,7 +294,7 @@ private val processings: List<NamedPostProcessingGroup> = listOf(
|
||||
)
|
||||
),
|
||||
NamedPostProcessingGroup(
|
||||
"Optimizing imports and formatting code",
|
||||
KotlinNJ2KServicesBundle.message("processing.step.optimizing.imports.and.formatting.code"),
|
||||
listOf(
|
||||
ShortenReferenceProcessing(),
|
||||
OptimizeImportsProcessing(),
|
||||
|
||||
Reference in New Issue
Block a user