feat: Add string extraction and generation tools for i18n#306
Open
codenameakshay wants to merge 1 commit into
Open
feat: Add string extraction and generation tools for i18n#306codenameakshay wants to merge 1 commit into
codenameakshay wants to merge 1 commit into
Conversation
Adds a strings.xml-based localization pipeline: - tool/extract_strings.dart: scans lib/ for UI strings (Text widgets, label/title/hintText/etc params) and merges into strings.xml - tool/generate_strings.dart: reads strings.xml and generates lib/core/l10n/app_strings.g.dart (Dart static constants) and ios/Runner/Base.lproj/Localizable.strings (iOS format) - Initial generated files seeded from existing strings.xml entries - Makefile targets: strings-extract, strings-gen, strings, strings-check - strings-check added to the ci target as a diff guard https://claude.ai/code/session_011ytNUzWd4ENWrRHkPeWKFc
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
Android App Size ReportStatus: PASS
Thresholds: max delta Top artifact bucket deltas (uncompressed bytes):
|
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.
Summary
Introduces automated tooling for managing UI strings across Android and iOS platforms. This enables a centralized strings management workflow where strings are extracted from Dart code, stored in Android's
strings.xml, and then generated into platform-specific formats.Key Changes
tool/extract_strings.dart: New tool that scans Dart source files for hardcoded UI strings (Text widgets, labels, hints, tooltips, etc.) using regex patterns. Extracts unique strings and merges them intoandroid/app/src/main/res/values/strings.xmlwhile avoiding duplicates and filtering out non-translatable content (URLs, file paths, regex patterns, analytics keys, etc.).tool/generate_strings.dart: New tool that reads the centralizedstrings.xmland generates:lib/core/l10n/app_strings.g.dart: Dart class with static string constants (snake_case keys converted to camelCase)ios/Runner/Base.lproj/Localizable.strings: iOS-format strings file for localizationlib/core/l10n/app_strings.g.dart: Generated Dart constants file containing 8 UI strings (marked as generated code, not to be manually edited)ios/Runner/Base.lproj/Localizable.strings: Generated iOS localization file with the same strings in iOS formatMakefile: Added new targets:strings-extract: Run extraction toolstrings-gen: Run generation tool and format outputstrings: Run both extraction and generationstrings-check: Verify generated files are up-to-date (for CI)citarget to includestrings-checkImplementation Details
LinkedHashMapto preserve insertion order in XML fileshttps://claude.ai/code/session_011ytNUzWd4ENWrRHkPeWKFc