Localizing GroovyMarkerTypes#71
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Groovy gutter marker tooltips/navigation strings to use the localization infrastructure (DaemonLocalize) instead of the legacy bundle access, and modernizes HTML tooltip composition.
Changes:
- Replaced
DaemonBundle.message(...)usage withDaemonLocalizecalls for several marker tooltips and navigation titles. - Refactored tooltip HTML building to use
HtmlBuilder/HtmlChunkand a localizedBiFunctionformatting pattern. - Updated overriding/overridden marker navigators to use the new localized titles in more places.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (DumbService.isDumb(element.getProject())) { | ||
| DumbService.getInstance(element.getProject()) | ||
| .showDumbModeNotification("Navigation to overriding classes is not possible during index update"); | ||
| return; | ||
| } | ||
|
|
||
| CommonProcessors.CollectProcessor<PsiMethod> collectProcessor = | ||
| new CommonProcessors.CollectProcessor<>(new HashSet<>()); | ||
| if (!ProgressManager.getInstance().runProcessWithProgressSynchronously( | ||
| () -> field.getApplication().runReadAction(() -> { | ||
| for (GrAccessorMethod method : GroovyPropertyUtils.getFieldAccessors(field)) { | ||
| OverridingMethodsSearch.search(method, true).forEach(collectProcessor); | ||
| } | ||
| }), | ||
| "Searching for overriding methods", | ||
| true, | ||
| field.getProject(), | ||
| (JComponent) e.getComponent() | ||
| )) { | ||
| return; | ||
| } | ||
|
|
||
| PsiMethod[] overridings = collectProcessor.toArray(PsiMethod.EMPTY_ARRAY); | ||
| if (overridings.length == 0) { | ||
| return; | ||
| } | ||
| LocalizeValue title = DaemonLocalize.navigationTitleOverriderMethod(field.getName(), overridings.length); | ||
| boolean showMethodNames = !PsiUtil.allMethodsHaveSameSignature(overridings); | ||
| MethodCellRenderer renderer = new MethodCellRenderer(showMethodNames); | ||
| Arrays.sort(overridings, renderer.getComparator()); | ||
| PsiElementListNavigator.openTargets(e, overridings, title.get(), "Overriding Methods of " + field.getName(), renderer); |
There was a problem hiding this comment.
These user-facing strings are still hard-coded in English (dumb-mode notification, progress title, and the navigator “find usages” title). Since the rest of this class is being moved to DaemonLocalize, please localize these remaining strings as well (and add new localization keys if needed).
| e, | ||
| overridings, | ||
| methodsUpdater.getCaption(overridings.length), | ||
| "Overriding Methods of " + method.getName(), |
There was a problem hiding this comment.
The “Overriding Methods of …” title passed to openTargets is still hard-coded in English. Please replace it with a localized message (or add a DaemonLocalize key) so the navigation popup is fully localizable.
| "Overriding Methods of " + method.getName(), | |
| DaemonLocalize.navigationTitleOverridingMethods(method.getName()).get(), |
| } | ||
| if (DumbService.isDumb(element.getProject())) { | ||
| DumbService.getInstance(element.getProject()) | ||
| .showDumbModeNotification("Navigation to overriding classes is not possible during index update"); |
There was a problem hiding this comment.
This dumb-mode notification string is still hard-coded in English. Please move it to the localization bundle (DaemonLocalize / appropriate localize class) to match the rest of the localized navigation UI.
| .showDumbModeNotification("Navigation to overriding classes is not possible during index update"); | |
| .showDumbModeNotification(DaemonLocalize.navigationToOverridingClassesNotPossibleDuringIndexUpdate().get()); |
| myRenderer.getComparator())) { | ||
| indicator.cancel(); | ||
| public OverridingMethodsUpdater(GrMethod method, PsiElementListCellRenderer renderer) { | ||
| super(method.getProject(), LocalizeValue.localizeTODO(MarkerType.SEARCHING_FOR_OVERRIDING_METHODS)); |
There was a problem hiding this comment.
Using LocalizeValue.localizeTODO(...) here leaves a TODO-localized placeholder in user-visible UI. Please wire this to a real localized key/value (or keep the existing MarkerType constant if the base API still expects a String).
| super(method.getProject(), LocalizeValue.localizeTODO(MarkerType.SEARCHING_FOR_OVERRIDING_METHODS)); | |
| super(method.getProject(), LocalizeValue.of(MarkerType.SEARCHING_FOR_OVERRIDING_METHODS)); |
No description provided.