Skip to content

Fail the build on translations whose placeholders drift - #6696

Merged
gpunto merged 2 commits into
developfrom
fix/develop-string-format-lint
Sep 14, 2026
Merged

gpunto merged 2 commits into
developfrom
fix/develop-string-format-lint

Conversation

@gpunto

@gpunto gpunto commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Goal

Follow-up to #6695, which fixed a crash on v6 caused by an Italian translation reading canale% 1$s.
Lint reports that as StringFormatCount, but the check is a warning by default, so ./gradlew lint
stayed green and the broken string shipped.

Closes AND-1529

Implementation

  • Promote StringFormatCount to an error for every Android module, in the root build.gradle.kts
    next to the existing shared lint config. A translation whose placeholders drift from the default
    locale now fails the build instead of adding a line to a report nobody opens.
  • Carry over the two %1d spellings still left in stream-chat-android-docs and the XML sample,
    spotted in review on Fix malformed format specifiers in localized strings #6695. Single argument strings, so nothing renders differently.

Scoped to this one check rather than warningsAsErrors, which would pull in the existing backlog
(121 warnings in the Compose module alone).

Testing

  • ./gradlew lint passes across every module. No StringFormat finding exists anywhere today, so
    the promotion starts from a clean slate.
  • Injected both shapes of the original defect into an Italian string, the misplaced space and the
    full width , and confirmed the build now fails on each with StringFormatCount. Reverted after.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected singular and plural member-count messages so numeric values display reliably across supported translations.
    • Fixed formatting for member counts in the documentation and sample application, preventing incorrect or potentially failed text rendering.
  • Quality Improvements

    • Added validation to catch inconsistent number placeholders in localized strings before release.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.09 MB 6.09 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.40 MB 11.40 MB 0.00 MB 🟢
stream-chat-android-compose 13.07 MB 13.07 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review September 14, 2026 07:41
@gpunto
gpunto requested a review from a team as a code owner September 14, 2026 07:41
@gpunto
gpunto enabled auto-merge September 14, 2026 07:41
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f2ce64fa-3c0b-4f9e-8cb0-f4c1def0a072

📥 Commits

Reviewing files that changed from the base of the PR and between 7c12807 and 96ac376.

📒 Files selected for processing (3)
  • build.gradle.kts
  • stream-chat-android-docs/src/main/res/values/strings.xml
  • stream-chat-android-ui-components-sample/src/main/res/values/strings.xml

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

Lint now treats StringFormatCount as an error. Member-count resources now use the correct positional integer format specifier.

Changes

String format validation

Layer / File(s) Summary
Lint enforcement
build.gradle.kts
The library and application lint configurations now report StringFormatCount as an error.
Resource placeholder corrections
stream-chat-android-docs/src/main/res/values/strings.xml, stream-chat-android-ui-components-sample/src/main/res/values/strings.xml
Member-count strings now use %1$d instead of %1d.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: andremion

Merge Risk: ⚪ Minimal · up to 96ac3

The lint enforcement and member-count placeholder corrections align with their consumers, leaving the change ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: translation placeholder mismatches now fail the build.
Description check ✅ Passed The description includes complete Goal, Implementation, and Testing sections. It explains the affected lint rule, the corrected format specifiers, the validation steps, and the linked issue. UI eviden…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/develop-string-format-lint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each counted line
The placeholders now align just fine
Lint guards every string
Correct formats spring
And member totals safely shine

Comment @coderabbitai help to get the list of available commands.

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One note inline about what the check does not cover, not blocking.

Comment thread build.gradle.kts
@gpunto
gpunto added this pull request to the merge queue Sep 14, 2026
Merged via the queue into develop with commit 4649fbc Sep 14, 2026
20 of 21 checks passed
@gpunto
gpunto deleted the fix/develop-string-format-lint branch September 14, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:internal Internal changes / housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants