[PR #6827] [MERGED] [PM-35700] fix(about): localize Version label with parameterized string resource (#6824) #43989

Closed
opened 2026-04-23 22:39:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6827
Author: @mvanhorn
Created: 4/23/2026
Status: Merged
Merged: 4/23/2026
Merged by: @david-livefront

Base: mainHead: osc/6824-version-localize


📝 Commits (1)

  • 0a76e93 fix(about): localize Version label with parameterized string resource (#6824)

📊 Changes

2 files changed (+3 additions, -1 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutViewModel.kt (+2 -1)
📝 ui/src/main/res/values/strings.xml (+1 -0)

📄 Description

Closes #6824 (PM-35678).

Problem

On the About screen, the "Version: ..." line was built as an interpolated string:

version = "Version: ${buildInfoManager.versionData}".asText()

"Version:" was not a string resource, so Crowdin could not translate it and the label appeared in English regardless of the app's locale.

Change

  • Add version_x to the :ui module's values/strings.xml, following the existing created ("Created: %1$s") and default_text ("Default (%1$s)") patterns for "Label: ${value}" layouts.
  • Use BitwardenString.version_x.asText(buildInfoManager.versionData) in AboutViewModel.
  • Include a comment attribute explaining %1$s for translators.

Displayed text is unchanged in English ("Version: 2026.4.0 (21434)"). Other locales can now translate the label (including word order or punctuation changes they prefer).

Why a parameterized string instead of concatenation

The repo consistently uses parameterized strings (Created: %1$s, Default (%1$s), Search %1$s) rather than concatenation with a hardcoded separator. This keeps locale-specific punctuation and word order in the translator's hands — some languages may want a non-breaking space before the colon, or the value before the label.

Testing

I did not run ./gradlew app:testStandardDebugUnitTest locally — no Android SDK in this environment. The change is self-contained: one Kotlin import, one call-site swap, one string-resource addition.

  • AboutViewModelTest.DEFAULT_ABOUT_STATE is a static AboutState fixture passed through SavedStateHandle, so it doesn't exercise the initial-state computation path this change touches.
  • AboutScreen.kt preview (line 332) and AboutScreenTest.kt (line 278) build the version string themselves for display-only verification and don't reference BitwardenString.version_x, so they don't need updating.

Happy to update tests or adjust if there's a convention I missed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/6827 **Author:** [@mvanhorn](https://github.com/mvanhorn) **Created:** 4/23/2026 **Status:** ✅ Merged **Merged:** 4/23/2026 **Merged by:** [@david-livefront](https://github.com/david-livefront) **Base:** `main` ← **Head:** `osc/6824-version-localize` --- ### 📝 Commits (1) - [`0a76e93`](https://github.com/bitwarden/android/commit/0a76e93599a5000a11f07af2495c51163732d0b3) fix(about): localize Version label with parameterized string resource (#6824) ### 📊 Changes **2 files changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutViewModel.kt` (+2 -1) 📝 `ui/src/main/res/values/strings.xml` (+1 -0) </details> ### 📄 Description Closes #6824 (PM-35678). ## Problem On the About screen, the "Version: ..." line was built as an interpolated string: ```kotlin version = "Version: ${buildInfoManager.versionData}".asText() ``` "Version:" was not a string resource, so Crowdin could not translate it and the label appeared in English regardless of the app's locale. ## Change - Add `version_x` to the `:ui` module's `values/strings.xml`, following the existing `created` (`"Created: %1$s"`) and `default_text` (`"Default (%1$s)"`) patterns for "Label: ${value}" layouts. - Use `BitwardenString.version_x.asText(buildInfoManager.versionData)` in `AboutViewModel`. - Include a `comment` attribute explaining `%1$s` for translators. Displayed text is unchanged in English ("Version: 2026.4.0 (21434)"). Other locales can now translate the label (including word order or punctuation changes they prefer). ## Why a parameterized string instead of concatenation The repo consistently uses parameterized strings (`Created: %1$s`, `Default (%1$s)`, `Search %1$s`) rather than concatenation with a hardcoded separator. This keeps locale-specific punctuation and word order in the translator's hands — some languages may want a non-breaking space before the colon, or the value before the label. ## Testing I did not run `./gradlew app:testStandardDebugUnitTest` locally — no Android SDK in this environment. The change is self-contained: one Kotlin import, one call-site swap, one string-resource addition. - `AboutViewModelTest.DEFAULT_ABOUT_STATE` is a static `AboutState` fixture passed through `SavedStateHandle`, so it doesn't exercise the initial-state computation path this change touches. - `AboutScreen.kt` preview (line 332) and `AboutScreenTest.kt` (line 278) build the version string themselves for display-only verification and don't reference `BitwardenString.version_x`, so they don't need updating. Happy to update tests or adjust if there's a convention I missed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 22:39:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#43989