-
Notifications
You must be signed in to change notification settings - Fork 5
fix: localize shop category titles #1301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jvsena42
wants to merge
8
commits into
master
Choose a base branch
from
fix/715-localize-shop-categories
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c9be3ec
fix: localize shop category titles
jvsena42 f2663e4
docs: add shop gift card category titles journey
jvsena42 f21b9d2
Merge remote-tracking branch 'origin/master' into HEAD
jvsena42 fe1f4fd
Merge remote-tracking branch 'origin/master' into HEAD
jvsena42 6646dde
docs: note shop journey does not prove localization
jvsena42 124c295
test: cover shop category string resource pairing
jvsena42 4887e2e
Merge remote-tracking branch 'origin/master' into HEAD
jvsena42 8cded33
Merge remote-tracking branch 'origin/master' into HEAD
jvsena42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
51 changes: 51 additions & 0 deletions
51
app/src/test/java/to/bitkit/models/BitrefillCategoryTest.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package to.bitkit.models | ||
|
|
||
| import android.content.Context | ||
| import androidx.test.core.app.ApplicationProvider | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
| import org.robolectric.RobolectricTestRunner | ||
| import org.robolectric.annotation.Config | ||
| import kotlin.test.assertEquals | ||
| import kotlin.test.assertTrue | ||
|
|
||
| @Config(sdk = [34], qualifiers = "en-rUS") | ||
| @RunWith(RobolectricTestRunner::class) | ||
| class BitrefillCategoryTest { | ||
|
|
||
| private val context = ApplicationProvider.getApplicationContext<Context>() | ||
|
|
||
| @Test | ||
| fun `every entry points at the string resource named after it`() { | ||
| BitrefillCategory.entries.forEach { category -> | ||
| val expected = "other__shop__categories__${category.name.lowercase()}" | ||
| val actual = context.resources.getResourceEntryName(category.titleRes) | ||
| assertEquals(expected, actual, "'${category.name}' resolves to the wrong string resource") | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun `every title resolves to a distinct non-blank label`() { | ||
| val titles = BitrefillCategory.entries.associateWith { context.getString(it.titleRes) } | ||
|
|
||
| titles.forEach { (category, title) -> | ||
| assertTrue(title.isNotBlank(), "'${category.name}' resolves to a blank label") | ||
| } | ||
| assertEquals( | ||
| BitrefillCategory.entries.size, | ||
| titles.values.toSet().size, | ||
| "categories share a label: ${titles.values.groupBy { it }.filterValues { it.size > 1 }.keys}", | ||
| ) | ||
| } | ||
|
|
||
| @Test | ||
| fun `every route is a distinct buy path`() { | ||
| val routes = BitrefillCategory.entries.map { it.route } | ||
|
|
||
| routes.forEach { route -> | ||
| assertTrue(route.startsWith("buy/"), "route '$route' is not a buy path") | ||
| assertTrue(route.removePrefix("buy/").isNotBlank(), "route '$route' has no slug") | ||
| } | ||
| assertEquals(BitrefillCategory.entries.size, routes.toSet().size, "categories share a route") | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Shop gift card category names can now be translated. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <journey name="gift card category titles"> | ||
| <description> | ||
| Proves the Shop Discover gift card category rows render all 22 titles in order, survive an app | ||
| locale change, and pass the title shown on the row to the gift card web view. Precondition: | ||
| onboarded debug build, dev mode on (the screen deeplink is debug-only and gated on it), device | ||
| and app locale English, network access to Bitrefill. | ||
|
|
||
| This journey does not yet distinguish resource-backed titles from the hardcoded enum they | ||
| replace, and a pass is not proof of localization. The English values added in | ||
| `values/strings.xml:572-593` are the same text the enum carried, and no `values-*` file carries | ||
| an `other__shop__categories__*` key yet, so every row reads English in every shipped locale | ||
| either way. A pseudolocale cannot close the gap: `androidResources.localeFilters` | ||
| (`app/build.gradle.kts:276`) keeps only the 16 shipped locales, so `en-XA` resources are | ||
| stripped. Once the Transifex pull lands the German strings, replace the German step below with | ||
| assertions on concrete translated titles ("Food Delivery" and "Health & Beauty" rows plus | ||
| the web view top bar) and drop the English fallback allowance; that is what makes this journey | ||
| discriminate. "VoIP" is not translatable and stays "VoIP" in every locale. | ||
|
|
||
| The screen deeplink skips the Shop intro without marking it seen; iOS has no screen router, so a | ||
| port reaches Shop Discover through the drawer's Shop entry instead. | ||
| </description> | ||
| <actions> | ||
| <action>Run `adb shell am start -W -a android.intent.action.VIEW -d "bitkit://screen/shop-discover" to.bitkit.dev`</action> | ||
| <action>Verify that the Shop Discover screen is visible with the "Tab-shop" and "Tab-map" tabs and a "GIFT CARD CATEGORIES" header</action> | ||
| <action>Scroll the category list to the end and verify these 22 rows appear in order: "Apparel", "Automobiles", "Cruises", "Ecommerce", "Electronics", "Entertainment", "Experiences", "Flights", "Food", "Food Delivery", "Games", "Gifts", "Groceries", "Health & Beauty", "Home", "Multi-Brand", "Pets", "Restaurants", "Retail", "Streaming", "Travel", "VoIP"</action> | ||
| <action>Tap "Food Delivery"</action> | ||
| <action>Verify that the top bar title reads "Shop Food Delivery"</action> | ||
| <action>Wait for the web view to load, then take a screenshot and verify the Bitrefill Food Delivery listing is visible</action> | ||
| <action>Press the device back button</action> | ||
| <action>Run `adb shell cmd locale set-app-locales to.bitkit.dev --locales de`, then `adb shell am force-stop to.bitkit.dev` and relaunch the app</action> | ||
| <action>Run `adb shell am start -W -a android.intent.action.VIEW -d "bitkit://screen/shop-discover" to.bitkit.dev`</action> | ||
| <action>Verify that the app did not crash, the Map tab reads "Karte", and all 22 category rows are still listed in the same order; until the German strings land they all read their English titles, which is the expected state and not a failure</action> | ||
| <action>Run `adb shell cmd locale set-app-locales to.bitkit.dev --locales ''`, then `adb shell am force-stop to.bitkit.dev` and relaunch the app</action> | ||
| <action>Verify that the wallet overview is visible in English</action> | ||
| </actions> | ||
| </journey> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.