Conversation
🤖 Pull request artifacts
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughAdds runtime locale selection: new LocaleHelper to persist/apply chosen language; App and MainActivity attachBaseContext delegate to LocaleHelper; SettingsFragment ListPreference to change language and restart MainActivity; SettingsHelper persists language; new arrays, strings (base, ru, zh, ar), and language drawable added. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant Prefs as SettingsFragment
participant Locale as LocaleHelper
participant SP as SettingsHelper/SharedPreferences
participant Main as MainActivity
participant App as Application
User->>Prefs: select language in ListPreference
Prefs->>Locale: setLocale(context, language)
Locale->>SP: write `app.language`
Locale->>Locale: compute Locale, Locale.setDefault(...)
Prefs->>Main: start MainActivity (CLEAR_TOP | NEW_TASK)
Prefs->>Prefs: finish()
Main->>Locale: attachBaseContext(newBase) -> onAttach
Locale->>SP: read `app.language`
Locale->>Main: return configured Context
App->>Locale: attachBaseContext at app startup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
app/src/main/java/me/capcom/smsgateway/App.kt (1)
37-37: Remove the redundantLocaleHelper.onAttach(this)call inonCreate.Line 37 repeats locale attachment after
attachBaseContextalready handled it, and the returnedContextis ignored.Proposed cleanup
override fun onCreate() { super.onCreate() - LocaleHelper.onAttach(this) startKoin {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/me/capcom/smsgateway/App.kt` at line 37, Remove the redundant LocaleHelper.onAttach(this) call inside the App.onCreate method; attachBaseContext already calls LocaleHelper.onAttach and returns the adjusted Context, so delete the extra invocation in onCreate (the line calling LocaleHelper.onAttach(this)) to avoid a duplicate/no-op call while leaving attachBaseContext and its LocaleHelper usage intact.app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt (1)
37-37: Consider usingLocale.forLanguageTag(...)for forward-compatibility with region/script variants.Currently, language values are simple 2-letter codes (
"en","ar","ru","zh"), which work correctly withLocale(language). However, if the supported languages expand to include region or script tags (e.g.,"en-US","pt-BR"),Locale(language)will not parse them correctly—it will treat the entire string as the language field.Locale.forLanguageTag(...)handles BCP-47 tags properly and would be more robust for this use case.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt` at line 37, The locale construction using Locale(language) in LocaleHelper (the locale variable assignment) won’t parse BCP-47 tags like "en-US" correctly; replace it with Locale.forLanguageTag(language) when language is non-empty (and keep Locale.getDefault() fallback) so region/script variants are handled robustly by the code that constructs the locale.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt`:
- Around line 11-23: Change the fallback behavior so the app can preserve a
"system default" option: in onAttach(...) use an empty string "" as the fallback
when calling getPersistedData instead of Locale.getDefault().language; when you
need the actual device/system locale (not the app's current Locale), obtain it
via Resources.getSystem().configuration.locales[0]; construct locales from
stored language tags using Locale.forLanguageTag(...) rather than Locale(String)
so both empty (system) and concrete values are handled robustly; ensure
setLocale(...) / persist(...) only writes concrete language tags (non-empty) and
that updateResources(...) uses the system-locale from Resources.getSystem() when
the stored language is empty.
In `@app/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.kt`:
- Around line 38-44: The language change handler in SettingsFragment uses
findPreference and its OnPreferenceChangeListener to restart MainActivity before
the new language is persisted; update the listener to immediately persist/apply
the selected locale by calling LocaleHelper.setLocale(requireContext(), newValue
as String) (or equivalent) inside the listener before creating the Intent to
restart MainActivity, then restart via MainActivity Intent and finish the
activity so the restarted activity reads the updated locale.
---
Nitpick comments:
In `@app/src/main/java/me/capcom/smsgateway/App.kt`:
- Line 37: Remove the redundant LocaleHelper.onAttach(this) call inside the
App.onCreate method; attachBaseContext already calls LocaleHelper.onAttach and
returns the adjusted Context, so delete the extra invocation in onCreate (the
line calling LocaleHelper.onAttach(this)) to avoid a duplicate/no-op call while
leaving attachBaseContext and its LocaleHelper usage intact.
In `@app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt`:
- Line 37: The locale construction using Locale(language) in LocaleHelper (the
locale variable assignment) won’t parse BCP-47 tags like "en-US" correctly;
replace it with Locale.forLanguageTag(language) when language is non-empty (and
keep Locale.getDefault() fallback) so region/script variants are handled
robustly by the code that constructs the locale.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f6336479-1579-4aa6-8e72-1a4579725afa
📒 Files selected for processing (9)
app/src/main/java/me/capcom/smsgateway/App.ktapp/src/main/java/me/capcom/smsgateway/MainActivity.ktapp/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.ktapp/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.ktapp/src/main/res/values-ar/strings.xmlapp/src/main/res/values-ru/strings.xmlapp/src/main/res/values/arrays.xmlapp/src/main/res/values/strings.xmlapp/src/main/res/xml/root_preferences.xml
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.kt (1)
31-36: Consider normalizing empty string sentinel in language getter for better encapsulation.The
language_valuesarray contains an empty string ("") as a sentinel. WhileLocaleHelper.updateResources()already handles this case with an explicitisEmpty()check, normalizing the sentinel at theSettingsHelperlevel would be cleaner and reduce coupling between the components.Suggested refactor
var language: String - get() = settings.getString(APP_LANGUAGE, Locale.getDefault().language) - ?: Locale.getDefault().language + get() { + val stored = settings.getString(APP_LANGUAGE, null) + return when (stored) { + null, "", "system" -> Locale.getDefault().language + else -> stored + } + } set(value) = settings.edit(true) { putString(APP_LANGUAGE, value) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.kt` around lines 31 - 36, The language getter in SettingsHelper should normalize the empty-string sentinel stored under APP_LANGUAGE so callers don't need to handle it: update the language property's getter (var language: String) to retrieve settings.getString(APP_LANGUAGE, null) and if the result is null or isEmpty() return Locale.getDefault().language; keep the setter as-is. This centralizes handling of the "" sentinel used by language_values and avoids coupling with LocaleHelper.updateResources.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.kt`:
- Around line 31-36: The language getter in SettingsHelper should normalize the
empty-string sentinel stored under APP_LANGUAGE so callers don't need to handle
it: update the language property's getter (var language: String) to retrieve
settings.getString(APP_LANGUAGE, null) and if the result is null or isEmpty()
return Locale.getDefault().language; keep the setter as-is. This centralizes
handling of the "" sentinel used by language_values and avoids coupling with
LocaleHelper.updateResources.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 51bc6d1b-1971-42e9-b066-7cd72730977d
📒 Files selected for processing (5)
app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.ktapp/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.ktapp/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.ktapp/src/main/res/drawable/ic_language.xmlapp/src/main/res/xml/root_preferences.xml
✅ Files skipped from review due to trivial changes (1)
- app/src/main/res/drawable/ic_language.xml
🚧 Files skipped from review as they are similar to previous changes (2)
- app/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.kt
- app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.kt`:
- Around line 31-40: The getter for the language property currently maps stored
"" and "system" to Locale.getDefault().language, which causes
LocaleHelper.setLocale(...) to persist a fixed locale and lose dynamic system
behavior; change the logic in the language getter (property in SettingsHelper)
so only null falls back to Locale.getDefault().language while returning the raw
stored value for "" and "system" (i.e., if stored is null ->
Locale.getDefault().language, else return stored) so the "system" preference is
preserved and not rewritten.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8d0ca1ff-abbe-40c3-bb1d-faa29a5c675e
📒 Files selected for processing (2)
app/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.ktapp/src/main/res/values-zh/strings.xml
c2dda7a to
d96c124
Compare
d96c124 to
2b1dbc2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/res/values-ar/strings.xml`:
- Line 96: Update the Arabic translation for the string resource named
settings_start_on_boot: replace the current value "بدء التشغيل عند بناء النظام"
with a more accurate phrase for "start on boot", e.g. "بدء التشغيل عند إقلاع
النظام", so the string XML entry for settings_start_on_boot reflects the correct
Arabic wording.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3efc4d0e-7172-4360-9140-0241dc95c67f
📒 Files selected for processing (12)
app/src/main/java/me/capcom/smsgateway/App.ktapp/src/main/java/me/capcom/smsgateway/MainActivity.ktapp/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.ktapp/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.ktapp/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.ktapp/src/main/res/drawable/ic_language.xmlapp/src/main/res/values-ar/strings.xmlapp/src/main/res/values-ru/strings.xmlapp/src/main/res/values-zh/strings.xmlapp/src/main/res/values/arrays.xmlapp/src/main/res/values/strings.xmlapp/src/main/res/xml/root_preferences.xml
✅ Files skipped from review due to trivial changes (5)
- app/src/main/res/values/strings.xml
- app/src/main/res/drawable/ic_language.xml
- app/src/main/java/me/capcom/smsgateway/App.kt
- app/src/main/res/values-ru/strings.xml
- app/src/main/res/values/arrays.xml
🚧 Files skipped from review as they are similar to previous changes (3)
- app/src/main/res/xml/root_preferences.xml
- app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt
- app/src/main/res/values-zh/strings.xml
2b1dbc2 to
fbfa117
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/res/values-ar/strings.xml`:
- Around line 137-139: The Arabic resource strings incoming_sms_messages,
incoming_data_messages, and incoming_mms_messages are still in English; update
their values to proper Arabic translations while preserving the integer
placeholder (%1$d) and order (do not alter %1$d token), and ensure the
translations are natural and RTL-friendly (e.g., use appropriate Arabic words
for "SMS", "Data SMS", and "MMS"); edit the values of string
name="incoming_sms_messages", string name="incoming_data_messages", and string
name="incoming_mms_messages" in the Arabic strings.xml accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cabd6acf-2029-448a-9a05-cad74e5ee5b2
📒 Files selected for processing (12)
app/src/main/java/me/capcom/smsgateway/App.ktapp/src/main/java/me/capcom/smsgateway/MainActivity.ktapp/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.ktapp/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.ktapp/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.ktapp/src/main/res/drawable/ic_language.xmlapp/src/main/res/values-ar/strings.xmlapp/src/main/res/values-ru/strings.xmlapp/src/main/res/values-zh/strings.xmlapp/src/main/res/values/arrays.xmlapp/src/main/res/values/strings.xmlapp/src/main/res/xml/root_preferences.xml
✅ Files skipped from review due to trivial changes (5)
- app/src/main/res/values/strings.xml
- app/src/main/res/drawable/ic_language.xml
- app/src/main/java/me/capcom/smsgateway/App.kt
- app/src/main/res/xml/root_preferences.xml
- app/src/main/res/values/arrays.xml
🚧 Files skipped from review as they are similar to previous changes (3)
- app/src/main/res/values-ru/strings.xml
- app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt
- app/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.kt
| <string name="incoming_sms_messages">SMS: %1$d</string> | ||
| <string name="incoming_data_messages">Data SMS: %1$d</string> | ||
| <string name="incoming_mms_messages">MMS: %1$d</string> |
There was a problem hiding this comment.
Localize incoming message type labels for Arabic consistency.
Lines 137-139 are still partially/fully English, which creates mixed-language UI in the Arabic locale.
Suggested fix
- <string name="incoming_sms_messages">SMS: %1$d</string>
- <string name="incoming_data_messages">Data SMS: %1$d</string>
- <string name="incoming_mms_messages">MMS: %1$d</string>
+ <string name="incoming_sms_messages">رسائل SMS: %1$d</string>
+ <string name="incoming_data_messages">رسائل بيانات SMS: %1$d</string>
+ <string name="incoming_mms_messages">رسائل MMS: %1$d</string>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <string name="incoming_sms_messages">SMS: %1$d</string> | |
| <string name="incoming_data_messages">Data SMS: %1$d</string> | |
| <string name="incoming_mms_messages">MMS: %1$d</string> | |
| <string name="incoming_sms_messages">رسائل SMS: %1$d</string> | |
| <string name="incoming_data_messages">رسائل بيانات SMS: %1$d</string> | |
| <string name="incoming_mms_messages">رسائل MMS: %1$d</string> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/res/values-ar/strings.xml` around lines 137 - 139, The Arabic
resource strings incoming_sms_messages, incoming_data_messages, and
incoming_mms_messages are still in English; update their values to proper Arabic
translations while preserving the integer placeholder (%1$d) and order (do not
alter %1$d token), and ensure the translations are natural and RTL-friendly
(e.g., use appropriate Arabic words for "SMS", "Data SMS", and "MMS"); edit the
values of string name="incoming_sms_messages", string
name="incoming_data_messages", and string name="incoming_mms_messages" in the
Arabic strings.xml accordingly.
fbfa117 to
d0fc499
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
app/src/main/res/values-ar/strings.xml (1)
137-139:⚠️ Potential issue | 🟡 MinorLocalize incoming message type counters to avoid mixed-language Arabic UI.
Lines 137-139 are still English/partially English, which breaks Arabic locale consistency.
Suggested fix
- <string name="incoming_sms_messages">SMS: %1$d</string> - <string name="incoming_data_messages">Data SMS: %1$d</string> - <string name="incoming_mms_messages">MMS: %1$d</string> + <string name="incoming_sms_messages">رسائل SMS: %1$d</string> + <string name="incoming_data_messages">رسائل بيانات SMS: %1$d</string> + <string name="incoming_mms_messages">رسائل MMS: %1$d</string>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/res/values-ar/strings.xml` around lines 137 - 139, The three string resources incoming_sms_messages, incoming_data_messages, and incoming_mms_messages in values-ar/strings.xml are still in English; replace their text with proper Arabic translations while preserving the numeric format specifier (%1$d) and punctuation/spacing (e.g., "رسائل SMS: %1$d" or preferred Arabic phrasing) so the Arabic locale shows fully localized labels for SMS, Data SMS and MMS counters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@app/src/main/res/values-ar/strings.xml`:
- Around line 137-139: The three string resources incoming_sms_messages,
incoming_data_messages, and incoming_mms_messages in values-ar/strings.xml are
still in English; replace their text with proper Arabic translations while
preserving the numeric format specifier (%1$d) and punctuation/spacing (e.g.,
"رسائل SMS: %1$d" or preferred Arabic phrasing) so the Arabic locale shows fully
localized labels for SMS, Data SMS and MMS counters.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 11a612ec-30e8-47e2-99c9-d889712a82c7
📒 Files selected for processing (12)
app/src/main/java/me/capcom/smsgateway/App.ktapp/src/main/java/me/capcom/smsgateway/MainActivity.ktapp/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.ktapp/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.ktapp/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.ktapp/src/main/res/drawable/ic_language.xmlapp/src/main/res/values-ar/strings.xmlapp/src/main/res/values-ru/strings.xmlapp/src/main/res/values-zh/strings.xmlapp/src/main/res/values/arrays.xmlapp/src/main/res/values/strings.xmlapp/src/main/res/xml/root_preferences.xml
✅ Files skipped from review due to trivial changes (5)
- app/src/main/java/me/capcom/smsgateway/App.kt
- app/src/main/res/values/strings.xml
- app/src/main/res/drawable/ic_language.xml
- app/src/main/res/values-ru/strings.xml
- app/src/main/res/values/arrays.xml
🚧 Files skipped from review as they are similar to previous changes (4)
- app/src/main/res/xml/root_preferences.xml
- app/src/main/java/me/capcom/smsgateway/MainActivity.kt
- app/src/main/java/me/capcom/smsgateway/helpers/LocaleHelper.kt
- app/src/main/java/me/capcom/smsgateway/helpers/SettingsHelper.kt
d0fc499 to
2691710
Compare
2691710 to
29bbddf
Compare
Summary by CodeRabbit
New Features
Localization
UI
Assets