private static @Nullable Locale getLocaleForComponent(@NotNull Component component) {
    final InputContext context = component.getInputContext();
    return context == null ? null : context.getLocale();
  }
private static @Nullable Locale getLocaleForComponent(@NotNull Component component)