feat(core/ui) : allow user to change transaction page into local language#3132
feat(core/ui) : allow user to change transaction page into local language#3132Aditya002500 wants to merge 14 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded optional Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Screen
participant ViewModel
participant Mapper
participant Formatter
User->>Screen: open transactions UI
Screen->>ViewModel: request grouped transactions
ViewModel->>Mapper: map domain -> UiTransaction (include typeCode, date list)
Mapper-->>ViewModel: UiTransaction list
ViewModel->>ViewModel: group by toIsoDateKey()
ViewModel-->>Screen: grouped UiTransaction sections
Screen->>Formatter: formatTransactionDateWithPrefix(parseIsoDate(sectionKey))
Screen->>Formatter: localizeTransactionType(Type(code,value))
Screen->>Formatter: localizeAmount(CurrencyFormatter.format(...))
Formatter-->>Screen: localized strings
Screen-->>User: render localized date, title, amount
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 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 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 |
revanthkumarJ
left a comment
There was a problem hiding this comment.
Change the pr name it should be the feature you implemented
|
For proper naming convention have a look at https://github.com/openMF/mifos-pay/wiki/Commit-style-guide |
| id = this.id ?: -1L, | ||
| transactionName = type?.value ?: "Loan Transaction", | ||
| typeCode = type?.code, | ||
| isCredit = isCreditResolved, |
There was a problem hiding this comment.
here also this pr scope should not other other things than adding translation strings .
There was a problem hiding this comment.
The strings were missing so I simply added those
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
core/ui/src/commonMain/composeResources/values-in/strings.xml (1)
1-174:⚠️ Potential issue | 🟠 MajorIndonesian locale folder should be
values-id, notvalues-inin KMP.In Kotlin Multiplatform projects, Indonesian locale resources must be placed under a
values-idfolder. Thevalues-innaming is a legacy Android-only convention and will not resolve correctly in KMP shared/multiplatform sources. Rename this folder fromvalues-intovalues-idto ensure proper locale resolution.Based on learnings: "In Kotlin Multiplatform (KMP) projects, Indonesian locale resources should be placed under a values-id folder. The legacy values-in naming is only used for native Android and should not be used in KMP shared/ multiplatform sources."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core/ui/src/commonMain/composeResources/values-in/strings.xml` around lines 1 - 174, The resource folder is incorrectly named "values-in" which is the Android-only legacy code; rename the locale resource folder to "values-id" and move the provided strings.xml (the file containing keys like "no_internet", "password_checker_min_length_feedback", "validation_email_empty", etc.) into that "values-id" folder so Kotlin Multiplatform can resolve the Indonesian locale correctly; ensure any build/Gradle/KMP resource references are updated if they explicitly reference "values-in" and run a resource sync to verify the locale loads.
🧹 Nitpick comments (1)
feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt (1)
926-931: ExtracttoIsoDateKey()into a shared helper.This exact extension now exists here and in
feature/recent-transaction/src/commonMain/kotlin/org/mifos/mobile/feature/recent/transaction/viewmodel/RecentTransactionViewModel.kt:490-495. Keeping the grouping key duplicated in two viewmodels makes the date bucket format easy to drift from the shared parsing/formatting utilities.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt` around lines 926 - 931, The duplicate extension UiTransaction.toIsoDateKey() in TransactionViewModel and RecentTransactionViewModel should be extracted into a shared helper to avoid format drift; create a single function (e.g., a top-level function or extension named toIsoDateKey on UiTransaction) in a common/shared utilities file and replace both local implementations by calling that shared helper from TransactionViewModel and RecentTransactionViewModel so both viewmodels use the same ISO date key logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmp-android/build.gradle.kts`:
- Around line 104-124: The attributesSchema + PreferJarRule is declared
module-wide and can unintentionally affect all dependency resolution; restrict
its scope by moving the attributesSchema and PreferJarRule usage out of the
global dependencies block and apply it only to the configuration that consumes
the KMP library (for example use configurations.named("androidRuntimeClasspath")
or the specific KMP-consumer configuration), or extract the rule into a
convention plugin in build-logic and apply that plugin only where needed; keep
the PreferJarRule and its execute(details: MultipleCandidatesDetails<String>)
implementation but attach the attributesSchema call to the specific
configuration or the targeted convention plugin instead of the top-level
dependencies block.
In `@cmp-android/prodRelease-badging.txt`:
- Line 1: The package metadata shows versionName was updated to '0.0.4-beta.0.1'
but versionCode remains '1'; update the numeric versionCode to a new,
incremented integer (e.g., >1) wherever the package metadata is set (the
versionCode attribute in the package line) so it matches the new release and
avoids install/publish conflicts with previous builds that used versionCode=1.
In `@core/ui/src/commonMain/composeResources/values-es/strings.xml`:
- Around line 161-176: Replace the ambiguous Spanish label so repayments differ
from refunds: change tx_type_repayment from "Reembolso" to a repayment-specific
term (e.g., "Pago de préstamo"), and update the related keys
tx_type_repayment_at_disbursement and tx_type_recover_repayment to use the same
term (for example "Pago de préstamo al desembolso" and "Recuperar pago de
préstamo"), leaving tx_type_refund as "Reembolso".
In `@core/ui/src/commonMain/composeResources/values/strings.xml`:
- Around line 159-187: Transaction types for approve/withdraw are being
collapsed to the generic tx_type_initiate_transfer in
TransactionDateFormatter.localizeTransactionType; update that function to map
approve-transfer and withdraw-transfer codes to their own resources
(Res.string.tx_type_approve_transfer and Res.string.tx_type_withdraw_transfer)
instead of falling back to tx_type_initiate_transfer, i.e., add branches for
code == "approvetransfer" / rawCode.contains("approvetransfer") and code ==
"withdrawtransfer" / rawCode.contains("withdrawtransfer") that return
stringResource(Res.string.tx_type_approve_transfer) and
stringResource(Res.string.tx_type_withdraw_transfer) respectively.
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 138-154: The localizedMonth function currently maps any non-1..11
input to December, hiding invalid month values; change localizedMonth to
validate monthNumber first (e.g., require(monthNumber in 1..12) or throw
IllegalArgumentException) and handle only the 12 valid cases in the when
expression (keep Res.string.tx_month_dec for 12), so invalid inputs fail fast
instead of silently returning December; refer to the localizedMonth function and
its when branches to implement the validation and adjust the else branch
accordingly.
- Around line 222-223: The mapping branch in TransactionDateFormatter.kt that
matches code == "approvetransfer" || rawCode.contains("approvetransfer")
currently returns stringResource(Res.string.tx_type_initiate_transfer); change
that to stringResource(Res.string.tx_type_approve_transfer) so "approvetransfer"
displays correctly, and add the missing import for the Res symbols used (import
the resource holder used for string keys) so the new reference resolves.
In
`@feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsScreen.kt`:
- Around line 183-189: The DetailItem currently calls
localizeTransactionType(Type(code = transaction.typeCode, value =
transaction.typeValue)) inline, which can return an empty string and render a
blank subtitle; compute val localizedType = localizeTransactionType(Type(code =
transaction.typeCode, value = transaction.typeValue)) once, then only call
DetailItem if localizedType.isNotBlank(), otherwise leave the existing header
label unchanged (do not render or pass an empty subtitle). Apply the same
pattern where localizeTransactionType is used (the other occurrence around lines
243–245) to guard rendering on localizedType.isNotBlank().
---
Outside diff comments:
In `@core/ui/src/commonMain/composeResources/values-in/strings.xml`:
- Around line 1-174: The resource folder is incorrectly named "values-in" which
is the Android-only legacy code; rename the locale resource folder to
"values-id" and move the provided strings.xml (the file containing keys like
"no_internet", "password_checker_min_length_feedback", "validation_email_empty",
etc.) into that "values-id" folder so Kotlin Multiplatform can resolve the
Indonesian locale correctly; ensure any build/Gradle/KMP resource references are
updated if they explicitly reference "values-in" and run a resource sync to
verify the locale loads.
---
Nitpick comments:
In
`@feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt`:
- Around line 926-931: The duplicate extension UiTransaction.toIsoDateKey() in
TransactionViewModel and RecentTransactionViewModel should be extracted into a
shared helper to avoid format drift; create a single function (e.g., a top-level
function or extension named toIsoDateKey on UiTransaction) in a common/shared
utilities file and replace both local implementations by calling that shared
helper from TransactionViewModel and RecentTransactionViewModel so both
viewmodels use the same ISO date key logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cc72ab4e-7ce2-49e4-bd03-dc235aa18bd0
📒 Files selected for processing (37)
cmp-android/build.gradle.ktscmp-android/prodRelease-badging.txtcmp-shared/cmp_shared.podspeccore/data/src/commonMain/kotlin/org/mifos/mobile/core/data/mapper/transactions/LoanTransactionMapper.ktcore/data/src/commonMain/kotlin/org/mifos/mobile/core/data/mapper/transactions/SavingsTransactionMapper.ktcore/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/TransactionDetails.ktcore/ui/src/commonMain/composeResources/values-ar/strings.xmlcore/ui/src/commonMain/composeResources/values-bn/strings.xmlcore/ui/src/commonMain/composeResources/values-de/strings.xmlcore/ui/src/commonMain/composeResources/values-es/strings.xmlcore/ui/src/commonMain/composeResources/values-fa/strings.xmlcore/ui/src/commonMain/composeResources/values-fr/strings.xmlcore/ui/src/commonMain/composeResources/values-gu/strings.xmlcore/ui/src/commonMain/composeResources/values-hi/strings.xmlcore/ui/src/commonMain/composeResources/values-hu/strings.xmlcore/ui/src/commonMain/composeResources/values-in/strings.xmlcore/ui/src/commonMain/composeResources/values-km/strings.xmlcore/ui/src/commonMain/composeResources/values-kn/strings.xmlcore/ui/src/commonMain/composeResources/values-ml/strings.xmlcore/ui/src/commonMain/composeResources/values-mr/strings.xmlcore/ui/src/commonMain/composeResources/values-ms/strings.xmlcore/ui/src/commonMain/composeResources/values-my/strings.xmlcore/ui/src/commonMain/composeResources/values-pl/strings.xmlcore/ui/src/commonMain/composeResources/values-pt/strings.xmlcore/ui/src/commonMain/composeResources/values-ru/strings.xmlcore/ui/src/commonMain/composeResources/values-si/strings.xmlcore/ui/src/commonMain/composeResources/values-sw/strings.xmlcore/ui/src/commonMain/composeResources/values-te/strings.xmlcore/ui/src/commonMain/composeResources/values-ur/strings.xmlcore/ui/src/commonMain/composeResources/values/strings.xmlcore/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.ktfeature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionScreen.ktfeature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.ktfeature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsScreen.ktfeature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsViewModel.ktfeature/recent-transaction/src/commonMain/kotlin/org/mifos/mobile/feature/recent/transaction/screen/RecentTransactionScreen.ktfeature/recent-transaction/src/commonMain/kotlin/org/mifos/mobile/feature/recent/transaction/viewmodel/RecentTransactionViewModel.kt
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt (1)
193-198: Operator precedence may cause unexpected matching behavior.Line 197 mixes
||and&&without parentheses. Due to&&having higher precedence than||, the condition is evaluated as:code in setOf(...) || (rawCode.contains("deposit") && !rawCode.contains("repayment"))This is likely the intended behavior, but explicit parentheses would improve readability. Also, there's a duplicate
"interestposting"entry in the set on line 193.♻️ Suggested cleanup
- code in setOf("savingsaccountinterestposting", "loaninterestposting", "interestposting", "interestposting") || + code in setOf("savingsaccountinterestposting", "loaninterestposting", "interestposting") || rawCode.contains("interestposting") -> stringResource(Res.string.tx_type_interest_posting) - code in setOf("deposit", "savingsdeposit") || rawCode.contains("deposit") && !rawCode.contains("repayment") -> + code in setOf("deposit", "savingsdeposit") || (rawCode.contains("deposit") && !rawCode.contains("repayment")) -> stringResource(Res.string.tx_type_deposit)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt` around lines 193 - 198, The conditional mixing || and && in the TransactionDateFormatter branch using variables code and rawCode is ambiguous; wrap the deposit check in explicit parentheses—e.g. (code in setOf("deposit","savingsdeposit")) || (rawCode.contains("deposit") && !rawCode.contains("repayment"))—to make precedence explicit, and remove the duplicate "interestposting" entry from the setOf(...) used for the interest-posting branch so the set contains unique values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmp-shared/cmp_shared.podspec`:
- Line 53: The spec.resources entry uses Windows backslashes which will break
resource loading on macOS/iOS; update the spec.resources value (the string
currently assigned to spec.resources) to use POSIX forward slashes (e.g.,
replace backslashes in 'build\compose\cocoapods\compose-resources' with '/') so
CocoaPods can locate the compose resources at runtime.
- Line 3: The podspec's spec.version = '0.0.4' is out of sync with the project's
actual version (referenced as project.version in build.gradle.kts and seen as
1.0 in cmp-ios/Podfile.lock); update spec.version in cmp_shared.podspec to match
the canonical project version (use the value from project.version in
build.gradle.kts or bump project.version to the intended release) so the
podspec, Podfile.lock, and project.version are all identical.
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Line 251: The branch in TransactionDateFormatter.kt that maps
setOf("disbursement") to stringResource(Res.string.tx_type_repayment) is
incorrect; either remove that branch so disbursement falls back to type.value
(server label) or change it to use a proper disbursement resource (e.g.,
stringResource(Res.string.tx_type_disbursement)) after adding that translation;
locate the when/branch handling transaction type (the setOf("disbursement")
case) and update it accordingly.
---
Nitpick comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 193-198: The conditional mixing || and && in the
TransactionDateFormatter branch using variables code and rawCode is ambiguous;
wrap the deposit check in explicit parentheses—e.g. (code in
setOf("deposit","savingsdeposit")) || (rawCode.contains("deposit") &&
!rawCode.contains("repayment"))—to make precedence explicit, and remove the
duplicate "interestposting" entry from the setOf(...) used for the
interest-posting branch so the set contains unique values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ae56b74a-237a-4580-96d7-3e459b6dfbbd
📒 Files selected for processing (6)
cmp-android/prodRelease-badging.txtcmp-shared/cmp_shared.podspeccore/ui/src/commonMain/composeResources/values-es/strings.xmlcore/ui/src/commonMain/composeResources/values/strings.xmlcore/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.ktfeature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsScreen.kt
✅ Files skipped from review due to trivial changes (3)
- cmp-android/prodRelease-badging.txt
- core/ui/src/commonMain/composeResources/values-es/strings.xml
- core/ui/src/commonMain/composeResources/values/strings.xml
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt (1)
206-207: Avoid runtimelowercase()on string literal.The expression
"repaymentAtDisbursement".lowercase()computes the same result every time. Use the lowercase string directly.- code in setOf("repaymentAtDisbursement".lowercase(), "repaymentatdisbursement") -> + code in setOf("repaymentatdisbursement") ->🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt` around lines 206 - 207, The when-branch in TransactionDateFormatter.kt is using a runtime call `"repaymentAtDisbursement".lowercase()` inside setOf; replace that call with the precomputed lowercase literal "repaymentatdisbursement" so the set becomes setOf("repaymentatdisbursement", "repaymentatdisbursement") (or better, remove the duplicate and keep a single lowercase literal) in the branch that returns stringResource(Res.string.tx_type_repayment_at_disbursement).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 193-194: The set used in the when branch inside
TransactionDateFormatter (the setOf(...) containing
"savingsaccountinterestposting", "loaninterestposting", "interestposting",
"interestposting") has a duplicated "interestposting" entry; remove the
duplicated "interestposting" so the set reads only once (e.g.,
setOf("savingsaccountinterestposting", "loaninterestposting",
"interestposting")) to clean up the copy-paste error while preserving behavior.
---
Nitpick comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 206-207: The when-branch in TransactionDateFormatter.kt is using a
runtime call `"repaymentAtDisbursement".lowercase()` inside setOf; replace that
call with the precomputed lowercase literal "repaymentatdisbursement" so the set
becomes setOf("repaymentatdisbursement", "repaymentatdisbursement") (or better,
remove the duplicate and keep a single lowercase literal) in the branch that
returns stringResource(Res.string.tx_type_repayment_at_disbursement).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 98b28e95-f09c-4da7-9864-ade0c2004c09
📒 Files selected for processing (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt
…ransactionDateFormatter.kt Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt (1)
206-207: Minor: Redundant set entry.
"repaymentAtDisbursement".lowercase()evaluates to"repaymentatdisbursement", making the two entries in the set identical.♻️ Simplify the set
- code in setOf("repaymentAtDisbursement".lowercase(), "repaymentatdisbursement") -> + code == "repaymentatdisbursement" -> stringResource(Res.string.tx_type_repayment_at_disbursement)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt` around lines 206 - 207, The set in TransactionDateFormatter (the branch matching code in the function that maps transaction type keys) contains both "repaymentAtDisbursement".lowercase() and the literal "repaymentatdisbursement", which are identical; remove the redundant entry so the set has only one of them (either keep the lowercase() expression or the literal) to simplify the match and avoid duplication in the branch that returns stringResource(Res.string.tx_type_repayment_at_disbursement).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 185-190: The prefix-stripping chain on the variable `code`
(derived from `rawCode`) currently calls `.removePrefix("loan")`, which
transforms values like `"loanchargeadded"` into `"chargeadded"` and makes the
later equality check that expects `"loanchargeadded"` unreachable; fix this by
either removing the `.removePrefix("loan")` call from the chain that builds
`code` so original transaction codes remain intact, or update the downstream
comparison that currently checks for `"loanchargeadded"` to instead check for
the transformed value `"chargeadded"` (apply the chosen change in the code that
constructs `code` and/or the equality branch that references `"loanchargeadded"`
in the TransactionDateFormatter logic).
---
Nitpick comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 206-207: The set in TransactionDateFormatter (the branch matching
code in the function that maps transaction type keys) contains both
"repaymentAtDisbursement".lowercase() and the literal "repaymentatdisbursement",
which are identical; remove the redundant entry so the set has only one of them
(either keep the lowercase() expression or the literal) to simplify the match
and avoid duplication in the branch that returns
stringResource(Res.string.tx_type_repayment_at_disbursement).
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0490e625-7567-415d-b763-a3c2e33b35a5
📒 Files selected for processing (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt
…ransactionDateFormatter.kt Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 183-187: The branch logic expects a normalized variable named
"code" but it was never defined after computing "rawCode" from "type.code";
restore it by introducing a val code computed from rawCode (inside
TransactionDateFormatter.kt) that strips the common Mifos prefixes and
whitespace (e.g., remove prefixes like "mifos", "mifosx", etc.) so both short
and full codes match, then use that "code" value in the subsequent when branches
(the existing branches reference code and should remain unchanged).
- Around line 110-118: The else branch in formatTransactionDate still hardcodes
"day month year"; replace it with a translatable pattern: fetch a new string
resource tx_date_format and pass localized components (localizeNumber(date.day),
localizedMonth(date.monthNumber), localizeNumber(date.year)) as positional
parameters so locales can reorder them; update the Compose resources
(composeResources/values*) to add tx_date_format with placeholders (%1$s, %2$s,
%3$s) and include localized variants (use values-id for Indonesian, not
values-in). Ensure the code uses stringResource(Res.string.tx_date_format, ...)
in formatTransactionDate and keep localizeNumber and localizedMonth calls as the
parameters.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: c844035b-986d-4b43-a257-a87ac23f77f5
📒 Files selected for processing (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt
| * Falls back to the API-provided [Type.value] string if no translation is found. | ||
| */ | ||
| @Suppress("CyclomaticComplexMethod") | ||
| @Composable |
There was a problem hiding this comment.
What is this..no need to localize server side data
There was a problem hiding this comment.
@niyajali Then the strings like withdrawal and deposit present in the screen is by default ENGLISH no matter what the local language is selected, kindly let me know if I should remove this and let it be in English.
niyajali
left a comment
There was a problem hiding this comment.
@Aditya002500 revert the non-translation related changes and let us know
Hey @niyajali I have reverted those changes kindly review it once again and let me know any changes I should further proceed with |
|
|
||
| val id: Long, | ||
| val transactionName: String, | ||
| val typeCode: String? = null, |
There was a problem hiding this comment.
Shouldn't this be removed as well? Please review.
| <string name="tx_date_yesterday">أمس</string> | ||
| <string name="tx_month_jan">يناير</string> | ||
| <string name="tx_month_feb">فبراير</string> | ||
| <string name="tx_month_mar">مارس</string> |
There was a problem hiding this comment.
Please follow proper naming of string resources.
| @@ -732,6 +733,7 @@ internal class AccountsTransactionViewModel( | |||
| date = date, | |||
| amount = amount, | |||
| typeValue = type.value, | |||
| typeCode = type.code, | |||
| isCredit = when (type.value?.lowercase()) { | |||
| "disbursement", "repayment" -> false | |||
| else -> true | |||
| @@ -757,6 +759,7 @@ data class UiTransaction( | |||
| val amount: Double?, | |||
| val type: TransactionType? = null, | |||
| val typeValue: String? = null, | |||
| val typeCode: String? = null, | |||
| val isCredit: Boolean?, | |||
| val y = date.getOrElse(0) { 0 } | ||
| val m = date.getOrElse(1) { 1 }.toString().padStart(2, '0') | ||
| val d = date.getOrElse(2) { 1 }.toString().padStart(2, '0') | ||
| return "$y-$m-$d" |
There was a problem hiding this comment.
Please use proper naming for values.
| private fun UiTransaction.toIsoDateKey(): String { | ||
| val y = date.getOrElse(0) { 0 } | ||
| val m = date.getOrElse(1) { 1 }.toString().padStart(2, '0') | ||
| val d = date.getOrElse(2) { 1 }.toString().padStart(2, '0') | ||
| return "$y-$m-$d" | ||
| } |
| @@ -403,6 +403,7 @@ internal data class UiTransaction( | |||
| val amount: Double?, | |||
| val type: TransactionType? = null, | |||
| val typeValue: String? = null, | |||
| val typeCode: String? = null, | |||
| val isCredit: Boolean, | |||
Fixes - Jira-#506
🎥 Demo Video
trasaction_history.mp4
Please make sure these boxes are checked before submitting your pull request - thanks!
./gradlew checkorci-prepush.shto make sure you didn't break anythingSummary by CodeRabbit
New Features
Chores