test: detect R.string duplicates of backend translations#20535
Open
david-allison wants to merge 1 commit intoankidroid:mainfrom
Open
test: detect R.string duplicates of backend translations#20535david-allison wants to merge 1 commit intoankidroid:mainfrom
david-allison wants to merge 1 commit intoankidroid:mainfrom
Conversation
A number of my recent code reviews were flagging that strings added to R.string already exist in `TR` (`GeneratedTranslations`). To fix this, iterate the English strings from both TR and R.string, and fail if there are duplicates not defined in one of two BASELINE_ variables and produce copy-pasteable BASELINE text when the backend is updated This test: * Automates my review comments * Produces copy-pasteable BASELINE text when the backend is updated * Allowing a fast fix of the test * Lists opportunities where we can remove duplicated strings * Reducing APK size * Including `.toSentenceCase()` fixes * Ensures the baseline list is updated when strings are fixed The format of BASELINE entries lists all the `R.string` and `TR` cases: In some cases, there can be a many:many mapping, and a developer needs to decide which to select: ``` * R.string.deck_conf_general | R.string.pref_cat_general * TR.preferencesGeneral() | TR.schedulingGeneral() ``` Assisted-by: Claude Opus 4.6 Code was written by Claude, with much re-prompting for comment formatting, abstractions and code changes Code/comments were manually refactored and made less verbose
8d49a4c to
11cfd78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Assisted-by: Claude Opus 4.6
Code was written by Claude, with much re-prompting for comment formatting, abstractions and code changes
Code/comments were manually refactored and made less verbose
A number of my recent code reviews were flagging that strings added to R.string already exist in
TR(GeneratedTranslations).Approach
BASELINE_variablesThis test:
.toSentenceCase()fixesThe format of BASELINE entries lists all the
R.stringandTRcases:In some cases, there can be a many:many mapping, and a developer needs
to decide which to select:
How Has This Been Tested?
Learning (optional, can help others)
BASELINE_DUPLICATES: 78BASELINE_CASE_INSENSITIVE_DUPLICATES: 41Checklist