feat(i18n): Add support for new languages#8
Conversation
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.
WalkthroughThe 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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 descriptionThe explicit
\n\nsequence 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
📒 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
fromStringmethod 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
StringsHiobject provides complete Hindi translations for all app strings. The implementation follows established patterns with:
- Proper file-level suppression for long lines
- All
Stringsinterface 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
StringsArobject provides complete Arabic translations for all app strings. The implementation follows established patterns with:
- Proper file-level suppression for long lines
- All
Stringsinterface 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, andsettingsLanguageSpanishare present, but there are no keys for the five languages introduced in this PR (Latvian, Italian, Arabic, Hindi, Japanese).
IfSettingsScreennow shows those languages, theStringsinterface should expose corresponding keys (settingsLanguageLatvian,settingsLanguageItalian, …) and every localisation object must implement them. Otherwise the screen will either:
- Fall back to hard-coded strings (inconsistent UX / impossible to localise), or
- 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
StringsXXobject) if required.composeApp/src/commonMain/kotlin/com/rafaelfelipeac/replyradar/core/strings/StringsJa.kt (1)
66-75: Add localisation keys for new language namesSame 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, correspondingsettingsLanguageXxxconstants are missing here.Make sure the
Stringsinterface 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 ofsettingsLanguage…constantsThe 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.
This commit adds support for the following languages:
It also includes the following changes:
AppLanguage.ktto include the new languages.StringsXX.ktfiles for each new language.StringsProvider.ktto include the new language string objects.Summary by CodeRabbit