-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/dhiren/different languages #71
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
Conversation
This commit refactors the login and registration screen layouts to use string resources instead of hardcoded text values. This improves maintainability and prepares the app for localization.
### Key Changes:
- **`fragment_auth_login.xml` & `fragment_auth_register.xml`**:
- Replaced hardcoded text for titles, hints, and button labels with references to `strings.xml`. This includes "Cape Towns", "COFFEES", "Full Name", "Email", "Confirm Password", "Sign Up", "or continue with", and "Continue with Google".
- **`values/strings.xml`**:
- Added new string resources to support the layout changes:
- `cape_towns`
- `coffees`
- `confirm_password`
- `continue_with_google`
- Organized the file by grouping related strings under a "Login + Register Screen" comment.
…/different-languages
This commit refactors the login and registration screen layouts to use string resources instead of hardcoded text values. This improves maintainability and prepares the app for localization.
### Key Changes:
- **`fragment_auth_login.xml` & `fragment_auth_register.xml`**:
- Replaced hardcoded text for titles, hints, and button labels with references to `strings.xml`. This includes "Cape Towns", "COFFEES", "Full Name", "Email", "Confirm Password", "Sign Up", "or continue with", and "Continue with Google".
- **`values/strings.xml`**:
- Added new string resources to support the layout changes:
- `cape_towns`
- `coffees`
- `confirm_password`
- `continue_with_google`
- Organized the file by grouping related strings under a "Login + Register Screen" comment.
This commit refactors the login and registration screen layouts to use string resources instead of hardcoded text values. This improves maintainability and prepares the app for localization.
### Key Changes:
- **`fragment_auth_login.xml` & `fragment_auth_register.xml`**:
- Replaced hardcoded text for titles, hints, and button labels with references to `strings.xml`. This includes "Cape Towns", "COFFEES", "Full Name", "Email", "Confirm Password", "Sign Up", "or continue with", and "Continue with Google".
- **`values/strings.xml`**:
- Added new string resources to support the layout changes:
- `cape_towns`
- `coffees`
- `confirm_password`
- `continue_with_google`
- Organized the file by grouping related strings under a "Login + Register Screen" comment.
This commit replaces hardcoded `tools:text` and `android:text` attributes in various layout files with string resources from `strings.xml`.
This change improves localization support, maintainability, and consistency by centralizing UI text. The new string resources are specifically for providing sample data in the Android Studio layout editor, making the UI components easier to understand during development.
### Key Changes:
- **`strings.xml`**:
- Added new string resources for sample data in several UI components, including items for "Coffee Near Me," "Coffee Review," "Favourites," "List Place," "Offline Banner," and "Search Suggestion."
- **Layout Files Updated**:
- `item_coffee_near_me.xml`
- `item_coffee_review.xml`
- `item_favourite.xml`
- `item_list_place.xml`
- `item_offline_banner.xml`
- `item_review.xml`
- `item_search_suggestion.xml`
All hardcoded text in these layouts now references the corresponding string resources.
…/different-languages # Conflicts: # app/src/main/res/layout/fragment_profile_new.xml # app/src/main/res/layout/fragment_review_complete.xml # app/src/main/res/layout/fragment_review_step1.xml # app/src/main/res/layout/fragment_review_step2.xml # app/src/main/res/layout/fragment_review_step3.xml
This commit introduces a comprehensive set of string resources to support the multi-step coffee review process and the completion screen. It also updates an unrelated string in the profile screen.
### Key Changes:
- **`strings.xml`**:
- Added new strings for titles, descriptions, and button labels for each step of the review process (`review_step1_title`, `review_step2_message`, `review_submit_button`, etc.).
- Added strings for the "Review Complete" confirmation screen (`thanks_for_your_review`, `thank_you_message`).
- Updated the "Coffee Explorer" string (`coffee_explorer`) for the profile screen.
- **Layout Files**:
- All hardcoded text in the review-related layout files has been replaced with the new string resources. This includes:
- `fragment_review_step1.xml`
- `fragment_review_step2.xml`
- `fragment_review_step3.xml`
- `fragment_review_complete.xml`
- In `fragment_profile_new.xml`, the gamification title was updated to use `@string/coffee_explorer`.
Removed detailed learning outcomes and technical skills sections from the README.
Remove learning outcomes and technical skills sections
This commit updates the placeholder text in the "Edit Profile" screen's password field. The `android:text` attribute of the `TextInputEditText` for the password has been changed from a generic `_dots` string to `password_hash`, providing a more descriptive and conventional representation for a masked password field.
This commit introduces a new language selection feature in the Settings screen and removes the old, complex profile screen UI, which will be replaced by a new design.
### Key Changes:
- **Language Selection Feature (`SettingsFragment.kt`, `fragment_settings.xml`)**:
- A "Display Language" option has been added to the Settings screen.
- Tapping it opens a dialog allowing users to switch the app's language between English, Afrikaans, and Xhosa.
- The selected language is dynamically updated in the UI.
- The change is persisted using `AppCompatDelegate.setApplicationLocales`.
- **New String Resources (`strings.xml`, `values-af/strings.xml`, `values-xh/strings.xml`)**:
- Added the `settings_display_language` string for the new feature.
- Added complete translation files (`strings.xml`) for Afrikaans (`af`) and Xhosa (`xh`) to support the new localization options.
- **UI Cleanup**:
- Deleted `fragment_profile.xml`, removing the old profile screen layout. This layout was complex, using `CoordinatorLayout` with a `CollapsingToolbarLayout`, and is now obsolete.
- Removed commented-out, unused styles from `style.xml`.
…/different-languages
This commit refactors the `Category` data model and its usage to support internationalization by replacing hardcoded string names with string resource IDs. This enables category labels on the home screen to be translated based on the user's device language. ### Key Changes: - **`Category.kt`**: The `name` (String) and `id` (Int) fields have been replaced with a single `nameResId` (`@StringRes`) field. - **`HomeViewModel.kt`**: The default categories list now uses `R.string` references (e.g., `R.string.category_all`) instead of hardcoded strings like `"All"`. The filtering logic now checks against these resource IDs. - **`CategoryAdapter.kt`**: Updated to use `context.getString(category.nameResId)` to set the button text, allowing for localization. - **`strings.xml`**: Added new string resources for each category (`category_all`, `category_popular`, etc.) in English, Afrikaans, and Xhosa to provide the translations. - **`HomeFragment.kt`**: Minor null-safety improvement when updating the category adapter. ### Other Changes: - **i18n:** This commit also includes a significant number of improvements and corrections to the existing Xhosa translations (`values-xh/strings.xml`) for better clarity and consistency across the app. - **IDE Config**: A run configuration for the `app` module has been added to `.idea/deploymentTargetSelector.xml`.
…/different-languages
This commit refactors the user profile screen to improve the gamification feature's display and internationalization support. It replaces hardcoded text with dynamic string resources, ensuring that levels, progress, and badge titles are properly localized and update correctly based on user data.
### Key Changes:
- **Dynamic String Resources:**
- New string resources have been added for gamification levels, progress summaries, and badge titles (e.g., `level_dynamic`, `gamification_summary`, `cafe_connoisseur`).
- These strings are now used in `ProfileFragment.kt` to dynamically format and display the user's current level and progress towards the next badge.
- Translations for these new strings have been added for Afrikaans (`values-af`) and Xhosa (`values-xh`).
- **Bottom Navigation Bar:**
- The text labels in `bottom_nav_menu.xml` have been updated to use string resources (`@string/nav_explore`, `@string/nav_saved`, `@string/nav_profile`) for better localization.
- **Layout Updates (`fragment_profile_new.xml`):**
- Hardcoded placeholder text for gamification elements has been replaced with references to the new string resources to provide more accurate design-time previews.
- **Code Refinements:**
- In `ProfileFragment.kt`, the logic for displaying the user's level-based title (e.g., "Latte Lover", "Coffee Explorer") now uses `getString()` to fetch localized versions.
…/different-languages
This commit refactors the "Popular" chip in the `item_coffee_near_me.xml` layout to improve clarity and programmatic control.
### Key Changes:
- **`item_coffee_near_me.xml`**:
- The `LinearLayout` container for the chip has been renamed from `pillPopular` to `pillPopularContainer` for better semantic distinction.
- The `TextView` inside the chip, which displays the text, has been renamed to `pillPopular`.
- **`CoffeePlacesAdapter.kt`**:
- The adapter logic has been updated to reference the new IDs.
- It now correctly sets the visibility of the `pillPopularContainer` and programmatically sets the text of the `pillPopular` `TextView` from a string resource (`R.string.popular_tag`).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements internationalization (i18n) improvements by extracting hardcoded strings to string resources and adding translations for Xhosa (xh) and Afrikaans (af) languages. The changes support dynamic gamification levels and improve the app's multilingual capabilities.
- Replaces hardcoded strings with string resource references in UI components
- Adds new string resources for gamification features (levels, badges, summaries)
- Updates navigation bar labels to use string resources for proper localization
- Refactors layout IDs for better consistency (pillPopular restructuring)
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/res/values/strings.xml | Adds new gamification and navigation string resources, including dynamic level formatting and badge progress strings |
| app/src/main/res/values-xh/strings.xml | Adds Xhosa translations for gamification features, navigation, and review-related strings |
| app/src/main/res/values-af/strings.xml | Adds Afrikaans translations for gamification features, navigation, and review-related strings |
| app/src/main/res/menu/bottom_nav_menu.xml | Replaces hardcoded navigation titles with string resource references |
| app/src/main/res/layout/item_coffee_near_me.xml | Refactors popular pill component by renaming container ID and moving text to proper TextView |
| app/src/main/res/layout/fragment_profile_new.xml | Updates references to use new gamification string resources; contains syntax error in margin attribute |
| app/src/main/java/com/synaptix/capetowncoffees/ui/profile/ProfileFragment.kt | Replaces hardcoded level labels and gamification text with getString() calls for proper localization |
| app/src/main/java/com/synaptix/capetowncoffees/ui/home/adapter/CoffeePlacesAdapter.kt | Updates popular pill visibility logic and sets text from string resources |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| is Resource.Error -> { | ||
| Timber.e("Error loading user: ${res.message}") | ||
| Timber.e("Error loading user: ${'$'}{res.message}") |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary string interpolation syntax. The escaped string interpolation ${'$'}{res.message} on line 112 is unnecessary in Kotlin and makes the code harder to read. Since this is inside a string template, you can simply use ${res.message} directly without escaping.
| Timber.e("Error loading user: ${'$'}{res.message}") | |
| Timber.e("Error loading user: ${res.message}") |
|
|
||
| <!-- Popular Tag --> | ||
| <string name="popular_tag">Popular</string> | ||
|
|
||
| <!-- Nav Bar --> | ||
| <string name="nav_explore">Popular</string> | ||
| <string name="nav_saved">Saved</string> | ||
| <string name="nav_profile">Profile</string> | ||
| </resources> |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing string resources in base strings.xml. The Afrikaans translation file (values-af) includes three string resources that are not present in the base strings.xml file:
in_app_reviews_titlegoogle_reviews_titleshow_more
These strings should be added to the base strings.xml file to maintain consistency across all language variants.
| <string name="gamification_summary">%d/%d izimvo • %d ukuya kwibheji elandelayo</string> | ||
| <string name="gamification_summary_max_level">%d izimvo • Ifikile inqanaba eliphezulu</string> | ||
| <string name="level">Inqanaba 1</string> | ||
| <string name="comments_to_next_badge">1/5 izimvo, 4 ukuya kwibheji elandelayo</string> <string name="points">Amanqaku</string> |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing tag on line 239. The string definition on line 239 is missing its closing tag </string>, which will cause an XML parsing error. This line should end with </string> before the <string name="points"> tag.
| <string name="comments_to_next_badge">1/5 izimvo, 4 ukuya kwibheji elandelayo</string> <string name="points">Amanqaku</string> | |
| <string name="comments_to_next_badge">1/5 izimvo, 4 ukuya kwibheji elandelayo</string> | |
| <string name="points">Amanqaku</string> |
| <string name="points">Punte</string> | ||
| <string name="gamification_summary_max_level">%d kommentaar • Maksimum vlak bereik</string> | ||
| <string name="level">Vlak 1</string> | ||
| <string name="comments_to_next_badge">1/5 kommentaar, 4 tot volgende kenteken</string> <string name="points">Punte</string> |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing tag on line 223. The string definition on line 223 is missing its closing tag </string>, which will cause an XML parsing error. This line should end with </string> before the <string name="points"> tag.
| <string name="comments_to_next_badge">1/5 kommentaar, 4 tot volgende kenteken</string> <string name="points">Punte</string> | |
| <string name="comments_to_next_badge">1/5 kommentaar, 4 tot volgende kenteken</string> | |
| <string name="points">Punte</string> |
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginStart="16dp" | ||
| android.layout_marginStart="16dp" |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax error: colon is missing. Line 359 has android.layout_marginStart but should be android:layout_marginStart (note the colon instead of dot). This syntax error will prevent the layout from being compiled.
| android.layout_marginStart="16dp" | |
| android:layout_marginStart="16dp" |
| android:id="@+id/pillPopular" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Popular" |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded text in layout file. The android:text attribute on line 71 contains hardcoded text "Popular" instead of using the string resource @string/popular_tag that was added in this PR. This should be changed to use the string resource for proper internationalization support.
| android:text="Popular" | |
| android:text="@string/popular_tag" |
Pull Request Title
Language Updates
What’s this PR about? 🤔
Describe briefly what this Pull Request is doing. Explain the problem it solves or the feature it adds to the project.
Why are we doing this? 💡
Explain why these changes are necessary.
Type of Change 🛠️
What kind of change does this Pull Request introduce? Check the box that applies.
How did you test it? 🧪
Explain how you tested your changes.
Screenshots (if helpful) 📸
If your changes include something visual, like UI changes, add screenshots here!
Checklist ✅
Make sure you’ve done these things before submitting.
Anything else? 💬
Any extra notes, questions, or concerns for your partner or reviewers?