Skip to content

feat(i18n): Add support for new languages#8

Merged
rafaelfelipeac merged 2 commits intomainfrom
feature/add-new-languages
Aug 2, 2025
Merged

feat(i18n): Add support for new languages#8
rafaelfelipeac merged 2 commits intomainfrom
feature/add-new-languages

Conversation

@rafaelfelipeac
Copy link
Owner

@rafaelfelipeac rafaelfelipeac commented Aug 2, 2025

This commit adds support for the following languages:

  • Latvian
  • Italian
  • Arabic
  • Hindi
  • Japanese

It also includes the following changes:

  • Updated AppLanguage.kt to include the new languages.
  • Created new StringsXX.kt files for each new language.
  • Updated StringsProvider.kt to include the new language string objects.
  • Updated the settings screen to include the new languages as options.

Summary by CodeRabbit

  • New Features
    • Added support for five new languages: Latvian, Italian, Arabic, Hindi, and Japanese.
    • Users can now select these languages from the app's language settings.
    • The app interface is fully localized in these new languages, including all menus, dialogs, notifications, and feedback templates.

This commit adds support for the following languages:
- Latvian
- Italian
- Arabic
- Hindi
- Japanese

It also includes the following changes:
- Updated `AppLanguage.kt` to include the new languages.
- Created new `StringsXX.kt` files for each new language.
- Updated `StringsProvider.kt` to include the new language string objects.
- Updated the settings screen to include the new languages as options.
@coderabbitai
Copy link

coderabbitai bot commented Aug 2, 2025

Walkthrough

The changes introduce support for five new languages—Latvian, Italian, Arabic, Hindi, and Japanese—across the application. This includes adding new enum constants, providing localized string resources for each language, updating the strings provider to handle the new languages, and extending the settings screen to offer these languages as selectable options.

Changes

Cohort / File(s) Change Summary
AppLanguage Enum Extension
composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/language/AppLanguage.kt
Added five new language constants: LATVIAN, ITALIAN, ARABIC, HINDI, and JAPANESE to the AppLanguage enum.
New Language String Resources
composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsLv.kt, .../StringsIt.kt, .../StringsAr.kt, .../StringsHi.kt, .../StringsJa.kt
Introduced new objects (StringsLv, StringsIt, StringsAr, StringsHi, StringsJa) implementing the Strings interface, each providing full localization for Latvian, Italian, Arabic, Hindi, and Japanese.
Strings Provider Update
composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsProvider.kt
Updated the provider to support and return the new language string objects when their corresponding enums are requested.
Settings Screen Language Options
composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/features/settings/presentation/SettingsScreen.kt
Extended the language selection UI to include the five new languages, updated imports, and switched to hardcoded language names for all options except the system default.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsScreen
    participant AppLanguage
    participant StringsProvider
    participant StringsXX (new language objects)

    User->>SettingsScreen: Opens language selection
    SettingsScreen->>AppLanguage: Lists all enum values (including new languages)
    SettingsScreen->>User: Displays language options
    User->>SettingsScreen: Selects a new language (e.g., Japanese)
    SettingsScreen->>StringsProvider: Request strings for selected language
    StringsProvider->>StringsJa: Returns Japanese strings
    StringsProvider->>SettingsScreen: Provides localized strings
    SettingsScreen->>User: UI updates to new language
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Adds support for Spanish, French and German languages. #6: Adds support for additional languages (German, French, Spanish) by extending AppLanguage, adding localized string objects, and updating StringsProvider and settings UI, paralleling the approach used here for different languages.

Poem

Five new tongues join the bunny’s song,
Latvian, Italian, Hindi along!
Arabic flows, and Japanese too—
The app now speaks to more of you.
With every string and label set,
The world grows smaller—hoppier yet!
🐇🌍✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 ad03586 and ac989e2.

📒 Files selected for processing (2)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsProvider.kt (3 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/features/settings/presentation/SettingsScreen.kt (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsProvider.kt
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/features/settings/presentation/SettingsScreen.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build, Tests and Lint
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-new-languages

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

Copy link

@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: 0

🧹 Nitpick comments (1)
composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsLv.kt (1)

121-124: Minor: prefer raw string for multi-line description

The explicit \n\n sequence inside a normal string literal is harder to read and easy to break in future edits.

-    override val notificationPermissionDialogDescription = "Lai atgādinātu jums atbildēt uz ziņojumiem, mums ir nepieciešama atļauja sūtīt paziņojumus. \n\nTo varat iespējot lietotnes iestatījumos."
+    override val notificationPermissionDialogDescription = """
+        Lai atgādinātu jums atbildēt uz ziņojumiem, mums ir nepieciešama atļauja sūtīt paziņojumus.
+
+        To varat iespējot lietotnes iestatījumos.
+    """.trimIndent()

Purely cosmetic, feel free to ignore if you want to keep all strings on one line.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f2295bb and ad03586.

📒 Files selected for processing (8)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/language/AppLanguage.kt (1 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsAr.kt (1 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsHi.kt (1 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsIt.kt (1 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsJa.kt (1 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsLv.kt (1 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsProvider.kt (3 hunks)
  • composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/features/settings/presentation/SettingsScreen.kt (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: rafaelfelipeac
PR: rafaelfelipeac/replyradar#5
File: composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/features/reply/presentation/replylist/ReplyListViewModel.kt:0-0
Timestamp: 2025-07-24T22:13:32.263Z
Learning: The user rafaelfelipeac consistently implements robust solutions that go beyond the immediate problem, adding defensive programming measures like the isPendingReplyHandled flag in the ReplyListViewModel to prevent duplicate processing, showing strong attention to edge cases and race conditions.
Learnt from: rafaelfelipeac
PR: rafaelfelipeac/replyradar#5
File: config/detekt/detekt.yml:15-17
Timestamp: 2025-07-24T20:32:51.160Z
Learning: The user rafaelfelipeac prefers to create tech debt tasks to track future cleanup and refactoring work when temporarily relaxing code quality thresholds, showing a proactive approach to technical debt management.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build, Tests and Lint
🔇 Additional comments (12)
composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/language/AppLanguage.kt (1)

9-13: LGTM! Clean enum extension.

The five new language constants are properly added before the SYSTEM enum value, maintaining the existing order and conventions. The fromString method will handle these new values correctly.

composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsProvider.kt (3)

5-5: Imports are properly organized.

The new language enum imports are correctly added and maintain alphabetical ordering.

Also applies to: 8-11


22-26: Private properties follow established conventions.

The new language string object references are properly declared as private properties, maintaining consistency with the existing pattern.


41-45: When expression properly updated.

All new language cases are correctly mapped to their respective string objects, ensuring proper language resolution.

composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/features/settings/presentation/SettingsScreen.kt (3)

44-44: Imports properly organized.

The new language enum imports are correctly added and maintain the existing organization pattern.

Also applies to: 47-50


293-297: Language options correctly integrated.

The new language options are properly added to the LanguageOptions composable, following the established pattern.


337-341: Native language labels are accurate.

The hardcoded native language names are correct and provide better user experience by displaying languages in their native scripts. This approach is appropriate for language selection UI.

composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsHi.kt (1)

1-130: Comprehensive Hindi localization implementation.

The StringsHi object provides complete Hindi translations for all app strings. The implementation follows established patterns with:

  • Proper file-level suppression for long lines
  • All Strings interface properties implemented
  • Contextually appropriate Hindi translations using Devanagari script
  • Proper handling of formatted strings with placeholders
  • Dynamic app version inclusion in feedback email body

The translations maintain the app's tone and provide a complete localized experience for Hindi users.

composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsAr.kt (1)

1-130: Comprehensive Arabic localization implementation.

The StringsAr object provides complete Arabic translations for all app strings. The implementation follows established patterns with:

  • Proper file-level suppression for long lines
  • All Strings interface properties implemented
  • Contextually appropriate Arabic translations using Arabic script
  • Proper handling of formatted strings with placeholders
  • Dynamic app version inclusion in feedback email body

The translations maintain the app's tone and provide a complete localized experience for Arabic users. The text structure appears appropriate for RTL reading direction.

composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsLv.kt (1)

68-76: Missing display names for the newly-added languages

settingsLanguageGerman, settingsLanguageFrench, and settingsLanguageSpanish are present, but there are no keys for the five languages introduced in this PR (Latvian, Italian, Arabic, Hindi, Japanese).
If SettingsScreen now shows those languages, the Strings interface should expose corresponding keys (settingsLanguageLatvian, settingsLanguageItalian, …) and every localisation object must implement them. Otherwise the screen will either:

  1. Fall back to hard-coded strings (inconsistent UX / impossible to localise), or
  2. Fail to compile if the interface was already extended.

Please double-check the interface signature and add the missing properties here (and in every other StringsXX object) if required.

composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsJa.kt (1)

66-75: Add localisation keys for new language names

Same gap as in the Latvian file: the list stops at Spanish.
If the app settings are expected to show Japanese, Italian, Arabic, Hindi or Latvian in the language picker, corresponding settingsLanguageXxx constants are missing here.

Make sure the Strings interface and every implementation stay in sync to avoid runtime fallback or compilation errors.

composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsIt.kt (1)

66-75: Incomplete set of settingsLanguage… constants

The same issue applies to the Italian localisation: keys for the newly-supported languages (Italian, Latvian, Arabic, Hindi, Japanese) are absent.
Confirm whether the interface was updated and extend this object accordingly to keep parity across languages.

@rafaelfelipeac rafaelfelipeac merged commit 616458f into main Aug 2, 2025
2 checks passed
@rafaelfelipeac rafaelfelipeac deleted the feature/add-new-languages branch August 2, 2025 21:31
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