i18n: update bundles

#KT-37483
This commit is contained in:
Dmitry Gridin
2020-04-06 23:15:37 +07:00
parent 0e45c03211
commit d4491af96f
10 changed files with 53 additions and 40 deletions
@@ -2187,3 +2187,11 @@ intention.trailing.comma.custom.text={0,choice,0#Enable|1#Disable} a trailing co
intention.trailing.comma.text=Enable/disable a trailing comma in the formatter intention.trailing.comma.text=Enable/disable a trailing comma in the formatter
fix.remove.argument.text=Remove argument fix.remove.argument.text=Remove argument
fix.remove.redundant.star.text=Remove redundant * fix.remove.redundant.star.text=Remove redundant *
refactoring.extract.to.separate.file.text=Extract to separate file
action.usage.update.text=Usage update
progress.title.analyze.extraction.data=Analyze extraction data...
fix.move.file.to.package.dir.name.text=source root
move.refactoring.error.text.cannot.perform.refactoring.since.the.following.files.already.exist=Cannot perform refactoring since the following files already exist:\n\n
kotlin.script.definitions.model.name.is.enabled=Is Enabled
kotlin.script.definitions.model.name.pattern.extension=Pattern/Extension
kotlin.script.definitions.model.name.name=Name
@@ -116,9 +116,8 @@ class NewKotlinFileAction : CreateFileFromTemplateAction(
builder.setValidator(NameValidator) builder.setValidator(NameValidator)
} }
override fun getActionName(directory: PsiDirectory, newName: String, templateName: String): String { override fun getActionName(directory: PsiDirectory, newName: String, templateName: String): String =
return KotlinBundle.message("action.new.file.text") KotlinBundle.message("action.new.file.text")
}
override fun isAvailable(dataContext: DataContext): Boolean { override fun isAvailable(dataContext: DataContext): Boolean {
if (super.isAvailable(dataContext)) { if (super.isAvailable(dataContext)) {
@@ -127,16 +126,13 @@ class NewKotlinFileAction : CreateFileFromTemplateAction(
val projectFileIndex = ProjectRootManager.getInstance(project).fileIndex val projectFileIndex = ProjectRootManager.getInstance(project).fileIndex
return ideView.directories.any { projectFileIndex.isInSourceContent(it.virtualFile) } return ideView.directories.any { projectFileIndex.isInSourceContent(it.virtualFile) }
} }
return false return false
} }
override fun hashCode(): Int { override fun hashCode(): Int = 0
return 0
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean = other is NewKotlinFileAction
return other is NewKotlinFileAction
}
override fun startInWriteAction() = false override fun startInWriteAction() = false
@@ -158,13 +154,9 @@ class NewKotlinFileAction : CreateFileFromTemplateAction(
return null return null
} }
override fun checkInput(inputString: String): Boolean { override fun checkInput(inputString: String): Boolean = true
return true
}
override fun canClose(inputString: String): Boolean { override fun canClose(inputString: String): Boolean = getErrorText(inputString) == null
return getErrorText(inputString) == null
}
} }
@get:TestOnly @get:TestOnly
@@ -52,14 +52,14 @@ fun notifyOutdatedBundledCompilerIfNecessary(project: Project) {
NotificationType.WARNING, NotificationType.WARNING,
NotificationListener { notification, event -> NotificationListener { notification, event ->
if (event.eventType == HyperlinkEvent.EventType.ACTIVATED) { if (event.eventType == HyperlinkEvent.EventType.ACTIVATED) {
when { when (event.description) {
"update" == event.description -> { "update" -> {
val action = ActionManager.getInstance().getAction(ConfigurePluginUpdatesAction.ACTION_ID) val action = ActionManager.getInstance().getAction(ConfigurePluginUpdatesAction.ACTION_ID)
val dataContext = DataManager.getInstance().dataContextFromFocus.result val dataContext = DataManager.getInstance().dataContextFromFocus.result
val actionEvent = AnActionEvent.createFromAnAction(action, null, ActionPlaces.ACTION_SEARCH, dataContext) val actionEvent = AnActionEvent.createFromAnAction(action, null, ActionPlaces.ACTION_SEARCH, dataContext)
action.actionPerformed(actionEvent) action.actionPerformed(actionEvent)
} }
"ignore" == event.description -> { "ignore" -> {
if (!project.isDisposed) { if (!project.isDisposed) {
PropertiesComponent.getInstance(project).setValue(SUPPRESSED_OUTDATED_COMPILER_PROPERTY_NAME, pluginVersion) PropertiesComponent.getInstance(project).setValue(SUPPRESSED_OUTDATED_COMPILER_PROPERTY_NAME, pluginVersion)
} }
@@ -13,6 +13,7 @@ import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiManager import com.intellij.psi.PsiManager
import com.intellij.refactoring.RefactoringBundle import com.intellij.refactoring.RefactoringBundle
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
import org.jetbrains.kotlin.idea.codeInsight.shorten.runRefactoringAndKeepDelayedRequests import org.jetbrains.kotlin.idea.codeInsight.shorten.runRefactoringAndKeepDelayedRequests
import org.jetbrains.kotlin.idea.core.util.range import org.jetbrains.kotlin.idea.core.util.range
@@ -87,7 +88,7 @@ class MoveDeclarationsProcessor(
fun performRefactoring() { fun performRefactoring() {
psiDocumentManager.commitAllDocuments() psiDocumentManager.commitAllDocuments()
val commandName = "Usage update" val commandName = KotlinBundle.message("action.usage.update.text")
val commandGroupId = Any() // we need to group both commands for undo val commandGroupId = Any() // we need to group both commands for undo
// temporary revert imports to the state before they have been changed // temporary revert imports to the state before they have been changed
@@ -60,7 +60,9 @@ class ExtractionEngine(
val project = extractionData.project val project = extractionData.project
val adjustExtractionData = helper.adjustExtractionData(extractionData) val adjustExtractionData = helper.adjustExtractionData(extractionData)
val analysisResult = ProgressIndicatorUtils.underModalProgress(project, "Analyze extraction data...") { val analysisResult = ProgressIndicatorUtils.underModalProgress(project,
KotlinBundle.message("progress.title.analyze.extraction.data")
) {
adjustExtractionData.performAnalysis() adjustExtractionData.performAnalysis()
} }
@@ -375,10 +375,10 @@ fun <T> chooseContainerElement(
private fun PsiElement.renderDeclaration(): String? { private fun PsiElement.renderDeclaration(): String? {
if (this is KtFunctionLiteral || isFunctionalExpression()) return renderText() if (this is KtFunctionLiteral || isFunctionalExpression()) return renderText()
val descriptor = when { val descriptor = when (this) {
this is KtFile -> name is KtFile -> name
this is KtElement -> analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this] is KtElement -> analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this]
this is PsiMember -> getJavaMemberDescriptor() is PsiMember -> getJavaMemberDescriptor()
else -> null else -> null
} ?: return null } ?: return null
val name = renderName() val name = renderName()
@@ -391,7 +391,7 @@ fun <T> chooseContainerElement(
} }
private fun PsiElement.renderText(): String = when (this) { private fun PsiElement.renderText(): String = when (this) {
is SeparateFileWrapper -> "Extract to separate file" is SeparateFileWrapper -> KotlinBundle.message("refactoring.extract.to.separate.file.text")
is PsiPackageBase -> qualifiedName is PsiPackageBase -> qualifiedName
else -> { else -> {
val text = text ?: "<invalid text>" val text = text ?: "<invalid text>"
@@ -376,10 +376,10 @@ fun <T> chooseContainerElement(
private fun PsiElement.renderDeclaration(): String? { private fun PsiElement.renderDeclaration(): String? {
if (this is KtFunctionLiteral || isFunctionalExpression()) return renderText() if (this is KtFunctionLiteral || isFunctionalExpression()) return renderText()
val descriptor = when { val descriptor = when (this) {
this is KtFile -> name is KtFile -> name
this is KtElement -> analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this] is KtElement -> analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this]
this is PsiMember -> getJavaMemberDescriptor() is PsiMember -> getJavaMemberDescriptor()
else -> null else -> null
} ?: return null } ?: return null
val name = renderName() val name = renderName()
@@ -392,7 +392,7 @@ fun <T> chooseContainerElement(
} }
private fun PsiElement.renderText(): String = when (this) { private fun PsiElement.renderText(): String = when (this) {
is SeparateFileWrapper -> "Extract to separate file" is SeparateFileWrapper -> KotlinBundle.message("refactoring.extract.to.separate.file.text")
is PsiPackageBase -> qualifiedName is PsiPackageBase -> qualifiedName
else -> { else -> {
val text = text ?: "<invalid text>" val text = text ?: "<invalid text>"
@@ -40,12 +40,16 @@ class PackageDirectoryMismatchInspection : AbstractKotlinInspection() {
val fixes = mutableListOf<LocalQuickFix>() val fixes = mutableListOf<LocalQuickFix>()
val qualifiedName = directive.qualifiedName val qualifiedName = directive.qualifiedName
val dirName = if (qualifiedName.isEmpty()) "source root" else "'${qualifiedName.replace('.', '/')}'" val dirName = if (qualifiedName.isEmpty())
KotlinBundle.message("fix.move.file.to.package.dir.name.text")
else
"'${qualifiedName.replace('.', '/')}'"
fixes += MoveFileToPackageFix(dirName) fixes += MoveFileToPackageFix(dirName)
val fqNameByDirectory = file.getFqNameByDirectory() val fqNameByDirectory = file.getFqNameByDirectory()
when { when {
fqNameByDirectory.isRoot -> fqNameByDirectory.isRoot ->
fixes += ChangePackageFix("source root", fqNameByDirectory) fixes += ChangePackageFix(KotlinBundle.message("fix.move.file.to.package.dir.name.text"), fqNameByDirectory)
fqNameByDirectory.hasIdentifiersOnly() -> fqNameByDirectory.hasIdentifiersOnly() ->
fixes += ChangePackageFix("'${fqNameByDirectory.asString()}'", fqNameByDirectory) fixes += ChangePackageFix("'${fqNameByDirectory.asString()}'", fqNameByDirectory)
} }
@@ -114,7 +114,7 @@ internal class MoveKotlinTopLevelDeclarationsModel(
} else { } else {
val filePathsToReport = filesExistingInTargetDir.joinToString( val filePathsToReport = filesExistingInTargetDir.joinToString(
separator = "\n", separator = "\n",
prefix = "Cannot perform refactoring since the following files already exist:\n\n" prefix = KotlinBundle.message("move.refactoring.error.text.cannot.perform.refactoring.since.the.following.files.already.exist")
) { it.virtualFile.path } ) { it.virtualFile.path }
throw ConfigurationException(filePathsToReport) throw ConfigurationException(filePathsToReport)
} }
@@ -9,6 +9,7 @@ import com.intellij.ui.BooleanTableCellEditor
import com.intellij.ui.BooleanTableCellRenderer import com.intellij.ui.BooleanTableCellRenderer
import com.intellij.util.ui.ColumnInfo import com.intellij.util.ui.ColumnInfo
import com.intellij.util.ui.ListTableModel import com.intellij.util.ui.ListTableModel
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.core.script.StandardIdeScriptDefinition import org.jetbrains.kotlin.idea.core.script.StandardIdeScriptDefinition
import org.jetbrains.kotlin.idea.core.script.settings.KotlinScriptingSettings import org.jetbrains.kotlin.idea.core.script.settings.KotlinScriptingSettings
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
@@ -32,11 +33,15 @@ class KotlinScriptDefinitionsModel private constructor(definitions: MutableList<
items = definitions.mapTo(arrayListOf()) { KotlinScriptDefinitionsModelDescriptor(it, settings.isScriptDefinitionEnabled(it)) } items = definitions.mapTo(arrayListOf()) { KotlinScriptDefinitionsModelDescriptor(it, settings.isScriptDefinitionEnabled(it)) }
} }
private class ScriptDefinitionName : ColumnInfo<KotlinScriptDefinitionsModelDescriptor, String>("Name") { private class ScriptDefinitionName : ColumnInfo<KotlinScriptDefinitionsModelDescriptor, String>(
KotlinBundle.message("kotlin.script.definitions.model.name.name")
) {
override fun valueOf(item: KotlinScriptDefinitionsModelDescriptor) = item.definition.name override fun valueOf(item: KotlinScriptDefinitionsModelDescriptor) = item.definition.name
} }
private class ScriptDefinitionPattern : ColumnInfo<KotlinScriptDefinitionsModelDescriptor, String>("Pattern/Extension") { private class ScriptDefinitionPattern : ColumnInfo<KotlinScriptDefinitionsModelDescriptor, String>(
KotlinBundle.message("kotlin.script.definitions.model.name.pattern.extension")
) {
override fun valueOf(item: KotlinScriptDefinitionsModelDescriptor): String { override fun valueOf(item: KotlinScriptDefinitionsModelDescriptor): String {
val definition = item.definition val definition = item.definition
return definition.asLegacyOrNull<KotlinScriptDefinitionFromAnnotatedTemplate>()?.scriptFilePattern?.pattern return definition.asLegacyOrNull<KotlinScriptDefinitionFromAnnotatedTemplate>()?.scriptFilePattern?.pattern
@@ -45,7 +50,9 @@ class KotlinScriptDefinitionsModel private constructor(definitions: MutableList<
} }
} }
private class ScriptDefinitionIsEnabled : ColumnInfo<KotlinScriptDefinitionsModelDescriptor, Boolean>("Is Enabled") { private class ScriptDefinitionIsEnabled : ColumnInfo<KotlinScriptDefinitionsModelDescriptor, Boolean>(
KotlinBundle.message("kotlin.script.definitions.model.name.is.enabled")
) {
override fun valueOf(item: KotlinScriptDefinitionsModelDescriptor): Boolean = item.isEnabled override fun valueOf(item: KotlinScriptDefinitionsModelDescriptor): Boolean = item.isEnabled
override fun setValue(item: KotlinScriptDefinitionsModelDescriptor, value: Boolean) { override fun setValue(item: KotlinScriptDefinitionsModelDescriptor, value: Boolean) {
item.isEnabled = value item.isEnabled = value
@@ -58,13 +65,12 @@ class KotlinScriptDefinitionsModel private constructor(definitions: MutableList<
} }
companion object { companion object {
fun createModel(definitions: List<ScriptDefinition>, settings: KotlinScriptingSettings): KotlinScriptDefinitionsModel { fun createModel(definitions: List<ScriptDefinition>, settings: KotlinScriptingSettings): KotlinScriptDefinitionsModel =
return KotlinScriptDefinitionsModel(definitions.mapTo(arrayListOf()) { KotlinScriptDefinitionsModel(definitions.mapTo(arrayListOf()) {
KotlinScriptDefinitionsModelDescriptor( KotlinScriptDefinitionsModelDescriptor(
it, it,
settings.isScriptDefinitionEnabled(it) settings.isScriptDefinitionEnabled(it)
) )
}) })
}
} }
} }