Skip to content

Fix localization#14692

Merged
Siedlerchr merged 4 commits intomainfrom
fix-typos
Dec 25, 2025
Merged

Fix localization#14692
Siedlerchr merged 4 commits intomainfrom
fix-typos

Conversation

@koppor
Copy link
Copy Markdown
Member

@koppor koppor commented Dec 22, 2025

User description

Fix some typos

Steps to test

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

PR Type

Bug fix


Description

  • Fix typo: "cancelled" to "canceled" in comment

  • Improve localization: use parameterized message for file not found error

  • Add new localization key for file not found with filename parameter

  • Refactor error dialog call for better code formatting


Diagram Walkthrough

flowchart LR
  A["ImportCommand.java"] -->|"Fix typo: cancelled→canceled"| B["Comment update"]
  A -->|"Use parameterized localization"| C["Error message improvement"]
  D["JabRef_en.properties"] -->|"Add new key"| C
  C -->|"Better i18n support"| E["Enhanced error handling"]
Loading

File Walkthrough

Relevant files
Bug fix
ImportCommand.java
Fix typo and improve localization in error handling           

jabgui/src/main/java/org/jabref/gui/importer/ImportCommand.java

  • Fixed typo in comment: changed "cancelled" to "canceled"
  • Refactored error dialog call to use parameterized localization message
  • Changed from string concatenation to Localization.lang("File %0 not
    found", file.getFileName().toString())
  • Improved code formatting by splitting method call across multiple
    lines
+4/-3     
Localization
JabRef_en.properties
Add parameterized localization key for file not found       

jablib/src/main/resources/l10n/JabRef_en.properties

  • Added new localization key File\ %0\ not\ found. for parameterized
    file not found message
  • Enables proper internationalization of error messages with dynamic
    filename parameter
+1/-0     

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented Dec 22, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
i18n key mismatch: The new localized error message uses Localization.lang("File %0 not found", ...)
but the added properties key is File %0 not found. (with a trailing period), likely
causing a missing-translation fallback and undermining meaningful error messaging.

Referred Code
dialogService.showErrorDialogAndWait(
        Localization.lang("Import"),
        Localization.lang("File %0 not found", file.getFileName().toString()));
return;

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

calixtus
calixtus previously approved these changes Dec 22, 2025
@calixtus calixtus enabled auto-merge December 22, 2025 23:03
@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented Dec 22, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Report all missing files at once
Suggestion Impact:The loop that checked files one-by-one and returned on the first missing file was replaced with a stream-based collection of all non-existent files, then an error dialog is shown once with the joined filenames before returning.

code diff:

+import java.util.stream.Collectors;
 
 import javafx.stage.FileChooser;
 
@@ -101,13 +102,17 @@
     }
 
     private void importMultipleFiles(List<Path> files, SortedSet<Importer> importers, FileChooser.ExtensionFilter selectedExtensionFilter) {
-        for (Path file : files) {
-            if (!Files.exists(file)) {
-                dialogService.showErrorDialogAndWait(
-                        Localization.lang("Import"),
-                        Localization.lang("File %0 not found", file.getFileName().toString()));
-                return;
-            }
+        List<Path> nonExistentFiles = files.stream()
+                                           .filter(file -> !Files.exists(file))
+                                           .toList();
+        if (!nonExistentFiles.isEmpty()) {
+            String fileNames = nonExistentFiles.stream()
+                                               .map(path -> path.getFileName().toString())
+                                               .collect(Collectors.joining(", "));
+            dialogService.showErrorDialogAndWait(
+                    Localization.lang("Import"),
+                    Localization.lang("File(s) %0 not found.", fileNames));
+            return;
         }

Refactor the file existence check to collect all non-existent files and report
them in a single error message, rather than returning after the first one is
found.

jabgui/src/main/java/org/jabref/gui/importer/ImportCommand.java [104-111]

-for (Path file : files) {
-    if (!Files.exists(file)) {
-        dialogService.showErrorDialogAndWait(
-                Localization.lang("Import"),
-                Localization.lang("File %0 not found", file.getFileName().toString()));
-        return;
-    }
+List<Path> nonExistentFiles = files.stream()
+                                   .filter(file -> !Files.exists(file))
+                                   .toList();
+if (!nonExistentFiles.isEmpty()) {
+    String fileNames = nonExistentFiles.stream()
+                                       .map(path -> path.getFileName().toString())
+                                       .collect(Collectors.joining(", "));
+    dialogService.showErrorDialogAndWait(
+            Localization.lang("Import"),
+            Localization.lang("File(s) not found: %0", fileNames));
+    return;
 }

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: This is a valid suggestion that improves user experience by reporting all missing files at once, rather than stopping at the first one.

Medium
  • Update

@calixtus
Copy link
Copy Markdown
Member

Localization

@koppor koppor added the automerge PR is tagged with that label will be merged if workflows are green label Dec 23, 2025
jabref-machine
jabref-machine previously approved these changes Dec 23, 2025
@koppor koppor removed the automerge PR is tagged with that label will be merged if workflows are green label Dec 23, 2025
@koppor koppor disabled auto-merge December 23, 2025 00:12
Comment thread jabgui/src/main/java/org/jabref/gui/importer/ImportCommand.java Outdated
@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Dec 23, 2025
@calixtus
Copy link
Copy Markdown
Member

Still missing localization key. How ironic.

@koppor
Copy link
Copy Markdown
Member Author

koppor commented Dec 23, 2025

Still missing localization key. How ironic.

Somehow the commit of the review suggestion did not work. Now, I opened the IDE and grouped the file-related localizations together...

@Siedlerchr
Copy link
Copy Markdown
Member

I am not sure if crowdin sees that the existing translations moved, or think that they got removed/replaces

@Siedlerchr Siedlerchr enabled auto-merge December 23, 2025 13:43
@koppor
Copy link
Copy Markdown
Member Author

koppor commented Dec 23, 2025

I am not sure if crowdin sees that the existing translations moved, or think that they got removed/replaces

I am pretty sure it sees that as moved. Not the first time we did that. -- key/value is a nice thing.

@Siedlerchr Siedlerchr added this pull request to the merge queue Dec 25, 2025
Merged via the queue into main with commit b21dd15 Dec 25, 2025
78 of 79 checks passed
@Siedlerchr Siedlerchr deleted the fix-typos branch December 25, 2025 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 1/5 status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants