fix(i18n): Escape apostrophe in string resource#126
Conversation
Correctly escaped the apostrophe in the `system_font_description` string for proper XML parsing and display.
WalkthroughRemoved a shared "percent" string from multiple locale resource files, deleted the entire Korean strings file, corrected an escaped apostrophe in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
Comment |
Removes the unused `percent` string resource and its translations from the default, French, Japanese, and Spanish resource files. The percentage display is now hardcoded directly in the `SmartInstallButton` and `AppsRoot` composables. Additionally, this change deletes the Korean translation file (`values-kr/strings.xml`).
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/apps/presentation/AppsRoot.kt (1)
71-71: Remove unused import.The
Res.string.percentresource is no longer used in this file after the change to inline percentage formatting.🔎 Proposed fix
-import githubstore.composeapp.generated.resources.percentcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/details/presentation/components/SmartInstallButton.kt (1)
42-42: Remove unused import.The
Res.string.percentresource is no longer used in this file after the change to inline percentage formatting.🔎 Proposed fix
-import githubstore.composeapp.generated.resources.percent
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
composeApp/src/commonMain/composeResources/values-es/strings-es.xmlcomposeApp/src/commonMain/composeResources/values-fr/strings-fr.xmlcomposeApp/src/commonMain/composeResources/values-ja/values-ja.xmlcomposeApp/src/commonMain/composeResources/values-kr/strings.xmlcomposeApp/src/commonMain/composeResources/values/strings.xmlcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/apps/presentation/AppsRoot.ktcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/details/presentation/components/SmartInstallButton.kt
💤 Files with no reviewable changes (4)
- composeApp/src/commonMain/composeResources/values-ja/values-ja.xml
- composeApp/src/commonMain/composeResources/values-fr/strings-fr.xml
- composeApp/src/commonMain/composeResources/values-kr/strings.xml
- composeApp/src/commonMain/composeResources/values-es/strings-es.xml
🚧 Files skipped from review as they are similar to previous changes (1)
- composeApp/src/commonMain/composeResources/values/strings.xml
| if (appItem.downloadProgress != null) { | ||
| Text( | ||
| text = stringResource( | ||
| Res.string.percent, | ||
| appItem.downloadProgress | ||
| ), | ||
| text = "${appItem.downloadProgress ?: 0}%", | ||
| style = MaterialTheme.typography.bodySmall | ||
| ) | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for percent-related string resources
echo "=== Searching for percent resources in composeResources ==="
find composeApp/src/commonMain/composeResources -name "*.xml" -o -name "*.properties" 2>/dev/null | head -20
echo -e "\n=== Searching for 'percent' string resource ==="
rg -i 'percent|%' composeApp/src/commonMain/composeResources/ 2>/dev/null || echo "No match found"
echo -e "\n=== Checking strings.xml or similar resource files ==="
find composeApp/src/commonMain/composeResources -type f \( -name "strings.xml" -o -name "*.strings" \) 2>/dev/null
echo -e "\n=== Searching for percent usage in the Kotlin file ==="
rg 'downloadProgress' composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/apps/presentation/AppsRoot.kt -B 3 -A 3Repository: rainxchzed/Github-Store
Length of output: 19704
Use locale-specific percent formatting instead of hardcoding "%".
The code hardcodes % but locale-specific percent resources already exist in Russian (%1$d%%) and Chinese Simplified (%1$d%%). This ignores those translations and breaks localization for those languages. Additionally, other supported locales (English, French, Spanish, Japanese) lack a percent resource, leading to inconsistent formatting.
Add a percent string resource to all locale files, accounting for spacing and conventions (e.g., French uses %1$d %% with a space), then use stringResource() to retrieve it in the code instead of hardcoding.
🤖 Prompt for AI Agents
In
composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/apps/presentation/AppsRoot.kt
around lines 428 to 433, the percent sign is hardcoded which bypasses localized
percent string resources; add a "percent" string entry to every locale resource
file (provide locale-appropriate formats like "%1$d%%" for Russian/Chinese,
"%1$d %%"/with space for French, and sensible formats for English, Spanish,
Japanese, etc.), then replace the hardcoded "${appItem.downloadProgress ?: 0}%"
with a call to stringResource(R.string.percent, appItem.downloadProgress ?: 0)
so the UI uses locale-specific percent formatting and spacing conventions.
|
|
||
| Text( | ||
| text = stringResource(Res.string.percent, progress ?: 0), | ||
| text = "${progress ?: 0}%", |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Do different locales format percentages differently spacing symbols conventions
💡 Result:
Short answer: Yes — percent formatting (space vs no space, placement, and which percent glyph to use) varies by locale and script.
Key points and examples
- Position: most Latin-script locales put the percent sign after the number (50%), but RTL/Arabic contexts can render the percent sign on the left of the digits or use a different Arabic-percent glyph. (w3.org)
- Spacing: some languages use a (non‑breaking) space between number and percent (French, Finnish, Croatian, Czech/Slovak in some grammatical uses); English style guides typically omit the space, while SI/ISO recommend a space. CLDR number patterns also allow the percent symbol to move or be spaced per locale. (en.wikipedia.org)
- Implementation: libraries follow CLDR/ICU locale rules (NumberFormat/ICU will format % according to the locale). RTL rendering and bidi interactions can still produce surprising placements in some toolchains. (unicode-org.github.io)
If you want, tell me which locales or which programming environment you care about and I’ll give exact formatted examples and the CLDR/ICU pattern used.
Citations:
- 1: https://www.w3.org/International/alreq/?utm_source=openai
- 2: https://en.wikipedia.org/wiki/Percent_sign?utm_source=openai
- 3: https://unicode-org.github.io/icu/userguide/format_parse/?utm_source=openai
🏁 Script executed:
# First, let's locate and examine the SmartInstallButton.kt file
find . -name "SmartInstallButton.kt" -type fRepository: rainxchzed/Github-Store
Length of output: 187
🏁 Script executed:
# Also look for AppsRoot.kt
find . -name "AppsRoot.kt" -type fRepository: rainxchzed/Github-Store
Length of output: 163
🏁 Script executed:
# Check SmartInstallButton.kt around line 166
sed -n '160,172p' ./composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/details/presentation/components/SmartInstallButton.ktRepository: rainxchzed/Github-Store
Length of output: 732
🏁 Script executed:
# Check AppsRoot.kt around line 430
sed -n '425,435p' ./composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/apps/presentation/AppsRoot.ktRepository: rainxchzed/Github-Store
Length of output: 659
🏁 Script executed:
# Check if the project has any i18n or formatting utilities
fd -e kt | xargs rg -l "NumberFormat|DecimalFormat|i18n|locali" | head -20Repository: rainxchzed/Github-Store
Length of output: 373
🏁 Script executed:
# Look for any existing percentage formatting patterns in the codebase
rg "%" --type kt -A 2 -B 2 | grep -E "(progress|percent)" | head -30Repository: rainxchzed/Github-Store
Length of output: 93
🏁 Script executed:
# Check for string resources and i18n configuration
find . -path "*res/string*" -type f | head -10Repository: rainxchzed/Github-Store
Length of output: 49
🏁 Script executed:
# Check ReadmeLocalizationHelper.kt to understand localization approach
cat -n ./composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/details/data/utils/ReadmeLocalizationHelper.ktRepository: rainxchzed/Github-Store
Length of output: 7417
🏁 Script executed:
# Look for compose resources or Res.string patterns
rg "Res.string" --type kt -l | head -5Repository: rainxchzed/Github-Store
Length of output: 93
🏁 Script executed:
# Check if there's any NumberFormat or similar in the entire codebase
rg "NumberFormat|DecimalFormat|formatDecimal|percentage" --type ktRepository: rainxchzed/Github-Store
Length of output: 93
🏁 Script executed:
# Find LocalizationManager
find . -name "LocalizationManager*" -type fRepository: rainxchzed/Github-Store
Length of output: 167
🏁 Script executed:
# Search for percentage/number formatting without file type restriction
rg "LocalizationManager|NumberFormat|formatDecimal" -A 3Repository: rainxchzed/Github-Store
Length of output: 8687
🏁 Script executed:
# Check if the app uses Compose resources for strings
find . -path "*strings*" -type f -o -path "*resources*" -type d | grep -v node_modulesRepository: rainxchzed/Github-Store
Length of output: 470
🏁 Script executed:
# Look for any existing utility or extension functions for formatting
rg "fun.*format|extension.*Number|extension.*Int" | head -20Repository: rainxchzed/Github-Store
Length of output: 219
🏁 Script executed:
# Read LocalizationManager.kt
cat -n ./composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/core/data/services/LocalizationManager.ktRepository: rainxchzed/Github-Store
Length of output: 613
🏁 Script executed:
# Read UpdatedAtFormatter.kt to see how locale-aware formatting is done
cat -n ./composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/core/presentation/utils/UpdatedAtFormmater.ktRepository: rainxchzed/Github-Store
Length of output: 1802
🏁 Script executed:
# Check if there are any number/percentage formatting extensions or utilities
rg "fun.*percent|fun.*number|fun.*format.*Int|fun.*format.*Double" -A 5Repository: rainxchzed/Github-Store
Length of output: 49
🏁 Script executed:
# Look at both SmartInstallButton.kt and AppsRoot.kt more broadly for context
wc -l ./composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/details/presentation/components/SmartInstallButton.ktRepository: rainxchzed/Github-Store
Length of output: 191
Use locale-aware number formatting for percentages in both SmartInstallButton.kt and AppsRoot.kt.
Hardcoding "%" bypasses locale-specific formatting. Different locales format percentages differently (e.g., French/Finnish use non-breaking spaces; RTL scripts position symbols differently). Your app explicitly supports multiple locales with LocalizationManager and uses stringResource() for other formatted content. Apply the same pattern here for consistency.
There was a problem hiding this comment.
@rainxchzed No worries! I understand. Feel free to reach out if you'd like to revisit this later or if you have any other questions.
Correctly escaped the apostrophe in the
system_font_descriptionstring for proper XML parsing and display.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.