From 4c29b35acefb83e211861619315fae931a572dcf Mon Sep 17 00:00:00 2001 From: Ilia Smirnov Date: Fri, 19 Jan 2024 11:05:57 +0100 Subject: [PATCH] i18n: fix localization inspection triggering GitOrigin-RevId: f7282fb8b5ce7445ee7ff0a9cf17b3eae4944eab --- .../pestphp/pest/configuration/PestRunConfiguration.kt | 8 ++------ .../symbols/PestCustomExpectationSymbol.kt | 3 ++- .../snapshotTesting/SnapshotLineMarkerProvider.kt | 3 ++- .../pestphp/pest/notifications/OutdatedNotification.kt | 7 ++----- src/main/resources/pestBundle.properties | 2 ++ 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfiguration.kt b/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfiguration.kt index 3437be52..fa957ba6 100644 --- a/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfiguration.kt +++ b/src/main/kotlin/com/pestphp/pest/configuration/PestRunConfiguration.kt @@ -120,12 +120,8 @@ class PestRunConfiguration(project: Project, factory: ConfigurationFactory) : Ph PhpTestRunnerSettings.Scope.Directory -> PathUtil.getFileName(StringUtil.notNullize(runner.directoryPath)) PhpTestRunnerSettings.Scope.File -> PathUtil.getFileName(StringUtil.notNullize(runner.filePath)) PhpTestRunnerSettings.Scope.Method -> { - val builder = StringBuilder() val file = PathUtil.getFileName(StringUtil.notNullize(runner.filePath)) - builder.append(file) - builder.append("::") - builder.append(runner.methodName) - builder.toString() + "$file::${runner.methodName}" } PhpTestRunnerSettings.Scope.ConfigurationFile -> PathUtil.getFileName( StringUtil.notNullize(runner.configurationFilePath) @@ -140,7 +136,7 @@ class PestRunConfiguration(project: Project, factory: ConfigurationFactory) : Ph fun applyTestArguments(command: PhpCommandSettings, coverageArguments: List) { val config = PhpTestFrameworkSettingsManager.getInstance(project) .getOrCreateByInterpreter(PestFrameworkType.instance, interpreter, true) - ?: throw ExecutionException("Could not find php interpreter.") + ?: throw ExecutionException(PestBundle.message("DIALOG_MESSAGE_COULD_NOT_FIND_PHP_INTERPRETER")) val version = null diff --git a/src/main/kotlin/com/pestphp/pest/features/customExpectations/symbols/PestCustomExpectationSymbol.kt b/src/main/kotlin/com/pestphp/pest/features/customExpectations/symbols/PestCustomExpectationSymbol.kt index 32363bdc..e7c90660 100644 --- a/src/main/kotlin/com/pestphp/pest/features/customExpectations/symbols/PestCustomExpectationSymbol.kt +++ b/src/main/kotlin/com/pestphp/pest/features/customExpectations/symbols/PestCustomExpectationSymbol.kt @@ -6,6 +6,7 @@ import com.intellij.find.usages.api.SearchTarget import com.intellij.find.usages.api.UsageHandler import com.intellij.model.Pointer import com.intellij.model.Symbol +import com.intellij.openapi.util.NlsSafe import com.intellij.openapi.util.TextRange import com.intellij.platform.backend.navigation.NavigationRequest import com.intellij.platform.backend.navigation.NavigationTarget @@ -17,7 +18,7 @@ import com.intellij.refactoring.rename.api.RenameTarget import com.pestphp.pest.features.customExpectations.generators.Method class PestCustomExpectationSymbol( - val expectationName: String, + @NlsSafe val expectationName: String, val file: PsiFile, val rangeInFile: TextRange, val methodDescriptor: Method diff --git a/src/main/kotlin/com/pestphp/pest/features/snapshotTesting/SnapshotLineMarkerProvider.kt b/src/main/kotlin/com/pestphp/pest/features/snapshotTesting/SnapshotLineMarkerProvider.kt index 0dbf282c..8adc8888 100644 --- a/src/main/kotlin/com/pestphp/pest/features/snapshotTesting/SnapshotLineMarkerProvider.kt +++ b/src/main/kotlin/com/pestphp/pest/features/snapshotTesting/SnapshotLineMarkerProvider.kt @@ -9,6 +9,7 @@ import com.jetbrains.php.lang.lexer.PhpTokenTypes import com.jetbrains.php.lang.psi.PhpPsiUtil import com.jetbrains.php.lang.psi.elements.PhpUse import com.jetbrains.php.lang.psi.elements.impl.FunctionReferenceImpl +import com.pestphp.pest.PestBundle class SnapshotLineMarkerProvider : RelatedItemLineMarkerProvider() { override fun collectNavigationMarkers( @@ -33,7 +34,7 @@ class SnapshotLineMarkerProvider : RelatedItemLineMarkerProvider() { val builder = NavigationGutterIconBuilder.create(AllIcons.Nodes.DataSchema) .setTargets(snapshotFiles) - .setTooltipText("Navigate to snapshot files") + .setTooltipText(PestBundle.message("TOOLTIP_NAVIGATE_TO_SNAPSHOT_FILES")) result.add(builder.createLineMarkerInfo(element)) } } \ No newline at end of file diff --git a/src/main/kotlin/com/pestphp/pest/notifications/OutdatedNotification.kt b/src/main/kotlin/com/pestphp/pest/notifications/OutdatedNotification.kt index 20a5e2bf..b73051f7 100644 --- a/src/main/kotlin/com/pestphp/pest/notifications/OutdatedNotification.kt +++ b/src/main/kotlin/com/pestphp/pest/notifications/OutdatedNotification.kt @@ -4,16 +4,13 @@ import com.intellij.notification.Notification import com.intellij.notification.NotificationGroupManager import com.intellij.notification.NotificationType import com.intellij.openapi.project.Project +import org.jetbrains.annotations.Nls class OutdatedNotification { private val group = NotificationGroupManager.getInstance() .getNotificationGroup("Outdated Pest") - fun notify(content: String): Notification { - return notify(null, content) - } - - fun notify(project: Project?, content: String): Notification { + fun notify(project: Project?, @Nls content: String): Notification { val notification: Notification = group.createNotification(content, NotificationType.ERROR) notification.notify(project) return notification diff --git a/src/main/resources/pestBundle.properties b/src/main/resources/pestBundle.properties index 39866951..b1c5e36f 100644 --- a/src/main/resources/pestBundle.properties +++ b/src/main/resources/pestBundle.properties @@ -19,6 +19,8 @@ RUNTIME_CONFIGURATION_EXCEPTION_MESSAGE=''{0}'' for ''{1}'' run configuration CANNOT_RUN_PEST_WITH_TYPE_MESSAGE=Cannot run Pest with type COVERAGE_ENGINE_LABEL_TEXT=Preferred Coverage engine: NOTIFICATION_GROUP_OUTDATED_PEST=Outdated Pest +DIALOG_MESSAGE_COULD_NOT_FIND_PHP_INTERPRETER=Could not find php interpreter. +TOOLTIP_NAVIGATE_TO_SNAPSHOT_FILES=Navigate to snapshot files action.Pest.New.File.text=Pest Test action.Pest.New.Dataset.text=Pest Dataset