Skip to content

Extract String concatenation into String resource#263

Merged
tuancoltech merged 1 commit intomainfrom
fix_lint_warnings_language_list_dialog
Apr 22, 2025
Merged

Extract String concatenation into String resource#263
tuancoltech merged 1 commit intomainfrom
fix_lint_warnings_language_list_dialog

Conversation

@tuancoltech
Copy link
Copy Markdown
Member

@tuancoltech tuancoltech commented Apr 22, 2025

Extract String concatenation into String resource

Summary by CodeRabbit

  • Style
    • Improved language display formatting by using localized string resources for language names.
  • New Features
    • Added a new string resource to support better localization of language names.

@tuancoltech tuancoltech requested a review from a team as a code owner April 22, 2025 01:42
@tuancoltech tuancoltech requested a review from jo-elimu April 22, 2025 01:42
@tuancoltech tuancoltech self-assigned this Apr 22, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 22, 2025

Walkthrough

This update modifies how language names are displayed in the language selection dialog of the elimu.ai content provider app. Instead of concatenating English and native language names directly in the code, the display text now uses a localized string resource with placeholders. A new string resource, language_value, is introduced to support this formatted display. No changes were made to the logic or control flow, and only the presentation layer is affected.

Changes

File(s) Change Summary
app/src/main/java/ai/elimu/content_provider/language/LanguageListDialogFragment.kt Updated the language name display logic to use a string resource with placeholders for formatting.
app/src/main/res/values/strings.xml Added language_value string resource to format language names with placeholders.

Possibly related PRs

Suggested reviewers

  • jo-elimu

elimu.ai's mission is to build innovative learning software that empowers out-of-school children to teach themselves basic reading📖, writing✍🏽 and math🔢 within 6 months.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 232c079 and 0daa421.

📒 Files selected for processing (2)
  • app/src/main/java/ai/elimu/content_provider/language/LanguageListDialogFragment.kt (1 hunks)
  • app/src/main/res/values/strings.xml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: build (ubuntu-latest, 21)
  • GitHub Check: build (windows-latest, 17)
  • GitHub Check: build (macos-latest, 21)
  • GitHub Check: build (ubuntu-latest, 17)
  • GitHub Check: build (macos-latest, 17)
  • GitHub Check: build (windows-latest, 21)
  • GitHub Check: test (29)
  • GitHub Check: test (28)
🔇 Additional comments (2)
app/src/main/res/values/strings.xml (1)

29-29: Add localized string resource for language formatting
In line with elimu.ai's mission to build innovative learning software that empowers out-of-school children to teach themselves basic reading📖, writing✍🏽 and math🔢 within 6 months, centralizing the format %1$s (%2$s) into the language_value resource greatly improves maintainability and prepares us for full localization.

app/src/main/java/ai/elimu/content_provider/language/LanguageListDialogFragment.kt (1)

94-95:

Details

✅ Verification successful

Use formatted string resource instead of manual concatenation
Excellent update—switching to getString(R.string.language_value, ...) streamlines localization and aligns with elimu.ai's mission.

Please verify that language_value is defined in all locale‐specific strings.xml files to ensure consistent formatting across languages:


🏁 Script executed:

#!/bin/bash
# Check for missing language_value in locale resource directories
for dir in app/src/main/res/values-*; do
  file="$dir/strings.xml"
  if [ -f "$file" ] && ! grep -q '<string name="language_value">' "$file"; then
    echo "Missing language_value in $file"
  fi
done

Length of output: 138


To ensure every locale (including the default) defines language_value—and to uphold elimu.ai’s mission to build innovative learning software that empowers out-of-school children to teach themselves basic reading📖, writing✍🏽 and math🔢 within 6 months—let’s run a comprehensive check:


🏁 Script executed:

#!/bin/bash
# Verify language_value exists in all strings.xml files under res/
find app/src/main/res -type f -name "strings.xml" | while read file; do
  if ! grep -q '<string name="language_value"' "$file"; then
    echo "Missing language_value in $file"
  fi
done

Length of output: 151


All locales include language_value
I’ve verified every strings.xml under app/src/main/res defines the language_value resource. This confirms your switch to getString(R.string.language_value, …) is fully supported across all languages—an excellent move for robust localization and in line with elimu.ai’s mission to build innovative learning software that empowers out-of-school children to teach themselves basic reading📖, writing✍🏽 and math🔢 within 6 months.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tuancoltech tuancoltech merged commit 31b0b6b into main Apr 22, 2025
8 checks passed
@tuancoltech tuancoltech deleted the fix_lint_warnings_language_list_dialog branch April 22, 2025 02:38
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