Skip to content

Use string resources for connection status and tab labels - #252

Open
danielviana wants to merge 1 commit into
netbirdio:mainfrom
danielviana:fix/localizable-status-and-tab-labels
Open

Use string resources for connection status and tab labels#252
danielviana wants to merge 1 commit into
netbirdio:mainfrom
danielviana:fix/localizable-status-and-tab-labels

Conversation

@danielviana

@danielviana danielviana commented Aug 29, 2026

Copy link
Copy Markdown

Problem

The connection status label starts out localizable and stops being so as soon as the app changes state.

fragment_home.xml:95 sets the initial value from a resource:

android:text="@string/main_status_disconnected"

but ButtonAnimation overwrites that label with hardcoded literals on every state transition, so main_status_disconnected is the only one of the four that a translator can reach — and only until the first connect.

The tab labels in BottomDialogFragment have the same issue: tab.setText("Peers") and tab.setText("Networks").

Fix

Move the four status labels and the two tab labels to string resources. main_status_disconnected already existed; the other five are added with the exact strings that were previously hardcoded.

The enum now carries a @StringRes int instead of a String, and updateText takes the resource id — TextView.setText(int) resolves it against the view's context.

Notes

No behaviour change: the English output is identical, character for character.

This does not add any translations — it only makes these strings reachable by one.

Two related spots were left alone to keep the diff small: the default branch's tab.setText("Tab " + position) (unreachable with the current two-page adapter) and AboutFragment's setText("unknown") version fallback.

Testing

./gradlew assembleDebug passes. Verified with aapt2 dump resources that the six strings compile, and confirmed the labels still render in English on a device.

Summary by CodeRabbit

  • Improvements
    • Added localized string resources for connection statuses and navigation tabs.
    • Updated the interface to display “Connecting,” “Connected,” “Disconnecting,” “Peers,” and “Networks” through translatable text resources.

The connection status label starts out localizable and stops being so as
soon as the app changes state: fragment_home.xml sets the initial value
from @string/main_status_disconnected, but ButtonAnimation overwrites it
with hardcoded literals on every transition.

The tab labels in BottomDialogFragment have the same issue.

Move all six to string resources. main_status_disconnected already
existed; the other five are added with the exact strings that were
previously hardcoded, so the English output is unchanged.
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b81c41e-de86-4e14-90c6-9e2dbf0fd316

📥 Commits

Reviewing files that changed from the base of the PR and between c9ab37e and 7d9c85b.

📒 Files selected for processing (3)
  • app/src/main/java/io/netbird/client/ui/home/BottomDialogFragment.java
  • app/src/main/java/io/netbird/client/ui/home/ButtonAnimation.java
  • app/src/main/res/values/strings.xml

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The home UI now reads connection-status and tab labels from Android string resources. ButtonAnimation stores annotated resource IDs and resolves them through TextView.setText(int). BottomDialogFragment uses resource IDs for peer and network tab labels.

Changes

Home UI localization

Layer / File(s) Summary
Resource-backed home labels
app/src/main/java/io/netbird/client/ui/home/ButtonAnimation.java, app/src/main/java/io/netbird/client/ui/home/BottomDialogFragment.java, app/src/main/res/values/strings.xml
Added connection-status and tab-label resources. Updated ButtonAnimation to store @StringRes IDs and updated BottomDialogFragment to use resource IDs for tab labels.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7d9c8

The connection-status and tab labels now use Android string resources without changing their English behavior or connection flow. No actionable merge-blocking risk remains after normal checks and review.

Poem

A rabbit hops through strings so bright
Status words now bloom just right
Peers and Networks take their place
Resource IDs guide the interface
The home screen twinkles with grace

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: replacing hardcoded connection status and tab labels with Android string resources.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant