i18n: add bundle for idea-completion

This commit is contained in:
Dmitry Gridin
2020-03-10 15:13:33 +07:00
parent 4a7160b51a
commit 22c94026c6
6 changed files with 38 additions and 10 deletions
@@ -0,0 +1,6 @@
exclude.0.from.completion=Exclude '{0}' from completion
insert.lambda.template=Insert lambda template
presentation.tail.for.0=\ for {0}
presentation.tail.for.0.in.1=\ for {0} in {1}
presentation.tail.from.0=\ (from {0})
presentation.tail.in.0=in {0}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -482,7 +482,12 @@ class BasicCompletionSession(
override fun renderElement(presentation: LookupElementPresentation?) {
super.renderElement(presentation)
presentation?.appendTailText(" for $name in $packageName", true)
presentation?.appendTailText(
KotlinIdeaCompletionBundle.message(
"presentation.tail.for.0.in.1",
name,
packageName
), true)
}
}
})
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -294,12 +294,12 @@ class BasicLookupElementFactory(
is SyntheticJavaPropertyDescriptor -> {
var from = descriptor.getMethod.name.asString() + "()"
descriptor.setMethod?.let { from += "/" + it.name.asString() + "()" }
appendTailText(" (from $from)")
appendTailText(KotlinIdeaCompletionBundle.message("presentation.tail.from.0", from))
return
}
else -> {
val receiverPresentation = SHORT_NAMES_RENDERER.renderType(extensionReceiver.type)
appendTailText(" for $receiverPresentation")
appendTailText(KotlinIdeaCompletionBundle.message("presentation.tail.for.0", receiverPresentation))
}
}
}
@@ -323,7 +323,7 @@ class BasicLookupElementFactory(
is PackageFragmentDescriptor -> container.fqName.toString()
else -> return null
}
return "in $containerPresentation"
return KotlinIdeaCompletionBundle.message("presentation.tail.in.0", containerPresentation)
}
else -> {
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.completion
@@ -34,7 +34,7 @@ class KotlinExcludeFromCompletionLookupActionProvider : LookupActionProvider {
private class ExcludeFromCompletionAction(
private val project: Project,
private val exclude: String
) : LookupElementAction(null, "Exclude '$exclude' from completion") {
) : LookupElementAction(null, KotlinIdeaCompletionBundle.message("exclude.0.from.completion", exclude)) {
override fun performLookupAction(): Result {
AddImportAction.excludeFromImport(project, exclude)
return Result.HIDE_LOOKUP
@@ -0,0 +1,17 @@
/*
* 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.completion
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.util.AbstractKotlinBundle
@NonNls
private const val BUNDLE = "messages.KotlinIdeaCompletionBundle"
object KotlinIdeaCompletionBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -43,7 +43,7 @@ object LambdaSignatureTemplates {
) {
// we start template later to not interfere with insertion of tail type
val commandProcessor = CommandProcessor.getInstance()
val commandName = commandProcessor.currentCommandName ?: "Insert lambda template"
val commandName = commandProcessor.currentCommandName ?: KotlinIdeaCompletionBundle.message("insert.lambda.template")
val commandGroupId = commandProcessor.currentCommandGroupId
val rangeMarker = context.document.createRangeMarker(placeholderRange)