-
-
Notifications
You must be signed in to change notification settings - Fork 92
fix(resources): change placeholder syntax for better Weblate highligh… #901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR SummaryUpdated the placeholder syntax in string resources from named placeholders (e.g., Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- 4852475: fix(resources): change placeholder syntax for better Weblate highlighting
Files Processed (20)
- core/main/src/main/java/com/rk/tabs/EditorTab.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/components/FileActionDialog.kt (2 hunks)
- core/main/src/main/java/com/rk/xededitor/ui/components/FindingsDialog.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/settings/SettingsScreen.kt (1 hunk)
- core/resources/src/main/java/com/rk/resources/Res.kt (1 hunk)
- core/resources/src/main/res/values-ar/strings.xml (3 hunks)
- core/resources/src/main/res/values-cs/strings.xml (5 hunks)
- core/resources/src/main/res/values-de/strings.xml (7 hunks)
- core/resources/src/main/res/values-fr/strings.xml (6 hunks)
- core/resources/src/main/res/values-in/strings.xml (5 hunks)
- core/resources/src/main/res/values-it/strings.xml (4 hunks)
- core/resources/src/main/res/values-ja/strings.xml (5 hunks)
- core/resources/src/main/res/values-pl/strings.xml (7 hunks)
- core/resources/src/main/res/values-pt-rBR/strings.xml (2 hunks)
- core/resources/src/main/res/values-pt/strings.xml (1 hunk)
- core/resources/src/main/res/values-ru/strings.xml (6 hunks)
- core/resources/src/main/res/values-tr/strings.xml (7 hunks)
- core/resources/src/main/res/values-zh-rTW/strings.xml (7 hunks)
- core/resources/src/main/res/values-zh/strings.xml (7 hunks)
- core/resources/src/main/res/values/strings.xml (6 hunks)
Actionable Comments (1)
-
core/resources/src/main/java/com/rk/resources/Res.kt [31-32]
possible bug: "Potential runtime errors with String.format arguments."
Skipped Comments (1)
-
core/resources/src/main/java/com/rk/resources/Res.kt [31-32]
best practice: "Consider explicit locale for String.format."
| fun String.fillPlaceholders(vararg args: Any?): String { | ||
| return String.format(this, *args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new fillPlaceholders function uses String.format(this, *args). This method is powerful but can throw an IllegalFormatException at runtime if the provided arguments do not strictly match the format specifiers in the string resource (e.g., passing a string to a %d specifier). The previous map-based approach was more resilient to such type mismatches. Ensure all call sites pass arguments that conform to the expected format specifiers to prevent runtime crashes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM!
Review Summary
Commits Considered (1)
- c3f47ed: Merge branch 'main' into fix/placeholders
Files Processed (2)
- core/resources/src/main/res/values-ru/strings.xml (6 hunks)
- core/resources/src/main/res/values-zh/strings.xml (7 hunks)
This PR changes the placeholder syntax one more time, because before, Weblate didn't recognize the placeholders correctly. They have to be in this format: e.g.
%sor%1$s.Additionally, this PR applies this change to all existing translations.