Skip to content

fix(i18n): Escape apostrophe in string resource#126

Merged
rainxchzed merged 2 commits intomainfrom
wrong_escape_char_issue
Jan 2, 2026
Merged

fix(i18n): Escape apostrophe in string resource#126
rainxchzed merged 2 commits intomainfrom
wrong_escape_char_issue

Conversation

@rainxchzed
Copy link
Copy Markdown
Member

@rainxchzed rainxchzed commented Jan 2, 2026

Correctly escaped the apostrophe in the system_font_description string for proper XML parsing and display.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed system font description text to display a normal apostrophe.
  • UI/Behavior
    • Progress now shows as an inline numeric value with a trailing "%" during downloads.
  • Localization
    • Removed the separate percent-format string from several locales and deleted the Korean strings bundle; some localized percent placeholders are no longer provided.

✏️ Tip: You can customize this high-level summary in your review settings.

Correctly escaped the apostrophe in the `system_font_description` string for proper XML parsing and display.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 2, 2026

Walkthrough

Removed a shared "percent" string from multiple locale resource files, deleted the entire Korean strings file, corrected an escaped apostrophe in system_font_description, and updated two Compose UI files to inline percent text instead of using the removed resource.

Changes

Cohort / File(s) Summary
Core resource edit
composeApp/src/commonMain/composeResources/values/strings.xml
Fixed escaping in system_font_description (changed Match your device\'s font...Match your device's font...).
Removed percent resource (locales)
composeApp/src/commonMain/composeResources/values/strings.xml, composeApp/src/commonMain/composeResources/values-es/strings-es.xml, composeApp/src/commonMain/composeResources/values-fr/strings-fr.xml, composeApp/src/commonMain/composeResources/values-ja/values-ja.xml
Deleted the string name="percent" entry from multiple locale files (removed percent-format translation).
Deleted locale file
composeApp/src/commonMain/composeResources/values-kr/strings.xml
Entire Korean strings resource file removed.
UI code: inlined percent rendering
composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/apps/presentation/AppsRoot.kt, composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/details/presentation/components/SmartInstallButton.kt
Replaced stringResource(percent, progress) usage with inline percent text (e.g., ${progress ?: 0}%) in downloading/update progress displays.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I thumped a key, removed a string,
A percent sign lost its wing,
An apostrophe stands proud and neat,
Inline numbers tap their feet,
A hopping fix — small, sweet, and spring! 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims to fix an apostrophe escape issue in string resources, but the main changes involve removing unused 'percent' string resources across multiple localization files and hardcoding percentage displays in code, which contradicts the stated intent. Revise the title to accurately reflect the primary change: something like 'fix(i18n): Remove unused percent string resource and hardcode percentage display' or split into multiple PRs addressing apostrophe escaping separately.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

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

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`).
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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.percent resource is no longer used in this file after the change to inline percentage formatting.

🔎 Proposed fix
-import githubstore.composeapp.generated.resources.percent
composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/details/presentation/components/SmartInstallButton.kt (1)

42-42: Remove unused import.

The Res.string.percent resource 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

📥 Commits

Reviewing files that changed from the base of the PR and between f508ae8 and 1d55c04.

📒 Files selected for processing (7)
  • composeApp/src/commonMain/composeResources/values-es/strings-es.xml
  • composeApp/src/commonMain/composeResources/values-fr/strings-fr.xml
  • composeApp/src/commonMain/composeResources/values-ja/values-ja.xml
  • composeApp/src/commonMain/composeResources/values-kr/strings.xml
  • composeApp/src/commonMain/composeResources/values/strings.xml
  • composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/feature/apps/presentation/AppsRoot.kt
  • composeApp/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

Comment on lines 428 to 433
if (appItem.downloadProgress != null) {
Text(
text = stringResource(
Res.string.percent,
appItem.downloadProgress
),
text = "${appItem.downloadProgress ?: 0}%",
style = MaterialTheme.typography.bodySmall
)
}
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.

⚠️ Potential issue | 🟠 Major

🧩 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 3

Repository: 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}%",
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Jan 2, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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:


🏁 Script executed:

# First, let's locate and examine the SmartInstallButton.kt file
find . -name "SmartInstallButton.kt" -type f

Repository: rainxchzed/Github-Store

Length of output: 187


🏁 Script executed:

# Also look for AppsRoot.kt
find . -name "AppsRoot.kt" -type f

Repository: 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.kt

Repository: 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.kt

Repository: 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 -20

Repository: 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 -30

Repository: rainxchzed/Github-Store

Length of output: 93


🏁 Script executed:

# Check for string resources and i18n configuration
find . -path "*res/string*" -type f | head -10

Repository: 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.kt

Repository: rainxchzed/Github-Store

Length of output: 7417


🏁 Script executed:

# Look for compose resources or Res.string patterns
rg "Res.string" --type kt -l | head -5

Repository: 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 kt

Repository: rainxchzed/Github-Store

Length of output: 93


🏁 Script executed:

# Find LocalizationManager
find . -name "LocalizationManager*" -type f

Repository: rainxchzed/Github-Store

Length of output: 167


🏁 Script executed:

# Search for percentage/number formatting without file type restriction
rg "LocalizationManager|NumberFormat|formatDecimal" -A 3

Repository: 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_modules

Repository: 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 -20

Repository: 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.kt

Repository: 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.kt

Repository: 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 5

Repository: 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.kt

Repository: 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry :(

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.

@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.

@rainxchzed rainxchzed merged commit 594592d into main Jan 2, 2026
2 checks passed
@rainxchzed rainxchzed deleted the wrong_escape_char_issue branch March 7, 2026 07:18
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