WEB-926: Fix missing i18n translations in Tax Components view#3536
WEB-926: Fix missing i18n translations in Tax Components view#3536sakshar2303 wants to merge 1 commit intoopenMF:devfrom
Conversation
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Account Type Translation Key Refactoring src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html |
Updated debit and credit account type label translation key construction to use taxComponentData.*AccountType.code with translateKey: 'inputs.accounting' prefix, replacing previous dynamic value-based approach. |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related PRs
- WEB-239: Fix Tax Components view page translation and layout #3103 — Directly related PR that modified the same template file with similar account-type rendering changes using code-based translation keys.
Suggested reviewers
- IOhacker
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title directly and accurately describes the main change: fixing missing i18n translations in the Tax Components view, which matches the core objective of the PR. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/app/products/manage-tax-components/manage-tax-components.component.html`:
- Around line 44-45: Remove the unnecessary translate pipe usage on the account
fields in the template: replace occurrences of
taxComponent.creditAccount?.glCode | translate and
taxComponent.creditAccount?.name | translate with the raw bindings
taxComponent.creditAccount?.glCode and taxComponent.creditAccount?.name so
API-provided account names/GL codes are displayed directly (matching usage in
edit-tax-component.component.ts and accounting-rules.component.ts) and avoid
runtime translate lookups.
In
`@src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html`:
- Around line 54-55: The template is incorrectly piping backend display strings
through the translate pipe; update view-tax-component.component.html to render
the raw backend values instead of translating them: remove the "| translate"
usage for taxComponentData.debitAccount.glCode and
taxComponentData.debitAccount.name, and likewise remove "| translate" for
taxComponentData.creditAccount.glCode and taxComponentData.creditAccount.name
(these are the unique template bindings to change) so the UI shows the
backend-provided display values directly.
In `@src/environments/.env.ts`:
- Around line 13-14: This file containing the auto-generated keys 'version' and
'hash' and the warning "THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR
CHECKIN!" should not be committed; remove it from the PR by unstaging/removing
it from Git (e.g., git rm --cached <file>) and revert the commit that added it
(or drop the file from the branch), then regenerate locally as needed for
testing so the auto-generated .env module is not checked into the repo.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a694cbdc-88c8-48b7-9714-9fa887294e9f
📒 Files selected for processing (3)
src/app/products/manage-tax-components/manage-tax-components.component.htmlsrc/app/products/manage-tax-components/view-tax-component/view-tax-component.component.htmlsrc/environments/.env.ts
| ({{ taxComponent.creditAccount?.glCode || '' | translate }}) | ||
| {{ taxComponent.creditAccount?.name || '' | translate }} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# 1) Find any existing translation keys that look like GL codes or account names
fd -e json . src/assets/translations | xargs rg -n --no-heading 'glCode|gl_code' || true
# 2) Inspect what shape the API returns for tax component creditAccount in the codebase
rg -nP --type=ts -C3 '\bcreditAccount\b' -g '!**/node_modules/**'
# 3) Look at the resolver/service that loads tax components to confirm field types
fd -e ts tax-components | xargs rg -n --no-heading 'glCode|creditAccount|debitAccount' || trueRepository: openMF/web-app
Length of output: 8782
🏁 Script executed:
#!/bin/bash
# Check the manage-tax-components.component.html file around lines 44-45
echo "=== Checking manage-tax-components.component.html ==="
cat -n src/app/products/manage-tax-components/manage-tax-components.component.html | sed -n '35,55p'
# Also check if there's a component.ts that might explain the intent
echo -e "\n=== Checking manage-tax-components.component.ts ==="
head -50 src/app/products/manage-tax-components/manage-tax-components.component.ts 2>/dev/null || echo "File not found"
# Check if any translation files have keys that look like account names or GL codes
echo -e "\n=== Checking for account-related translation keys ==="
rg -n 'Tax Payable|2001|creditAccount|debitAccount' src/assets/translations/ || echo "No matches found"Repository: openMF/web-app
Length of output: 2811
Remove the translate pipe from glCode and name — these are dynamic account data from the API, not translation keys.
The API returns raw account names and GL codes (e.g., 'Tax Payable', '2001') as display values, not translation keys. Applying the translate pipe to these fields is unnecessary and adds runtime overhead on every change-detection cycle. The pipe silently returns the input when no matching key is found (since no glCode or account name entries exist in translation files), creating the false impression that translation is working while actually doing nothing. This also risks accidental collisions if a GL code or name ever overlaps with an existing translation key.
Other components in the codebase (e.g., edit-tax-component.component.ts, accounting-rules.component.ts) use these same fields without the translate pipe. Remove the pipe from lines 44–45.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/app/products/manage-tax-components/manage-tax-components.component.html`
around lines 44 - 45, Remove the unnecessary translate pipe usage on the account
fields in the template: replace occurrences of
taxComponent.creditAccount?.glCode | translate and
taxComponent.creditAccount?.name | translate with the raw bindings
taxComponent.creditAccount?.glCode and taxComponent.creditAccount?.name so
API-provided account names/GL codes are displayed directly (matching usage in
edit-tax-component.component.ts and accounting-rules.component.ts) and avoid
runtime translate lookups.
| ({{ taxComponentData.debitAccount.glCode | translate }}) | ||
| {{ taxComponentData.debitAccount.name | translate }} |
There was a problem hiding this comment.
Same concern as manage-tax-components.component.html lines 44–45: piping dynamic glCode/name through translate is likely incorrect.
Debit/credit account glCode and name are display values returned from the backend, not i18n keys (no matching entries exist under inputs.accounting or elsewhere in src/assets/translations/en-US.json). The pipe is a no-op for non-key strings today but introduces risk of accidental key collisions and unnecessary work. Please confirm the API actually emits translation keys; otherwise drop the | translate here and render the raw values.
Tracked together with the root-cause comment on
manage-tax-components.component.html(lines 44–45).
Also applies to: 79-80
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html`
around lines 54 - 55, The template is incorrectly piping backend display strings
through the translate pipe; update view-tax-component.component.html to render
the raw backend values instead of translating them: remove the "| translate"
usage for taxComponentData.debitAccount.glCode and
taxComponentData.debitAccount.name, and likewise remove "| translate" for
taxComponentData.creditAccount.glCode and taxComponentData.creditAccount.name
(these are the unique template bindings to change) so the UI shows the
backend-provided display values directly.
| 'version': '260428', | ||
| 'hash': '2a6f1e31' |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check if .env.ts is gitignored and verify generation process
# Check if .env.ts or similar patterns are in .gitignore
if [ -f .gitignore ]; then
echo "=== Checking .gitignore ==="
rg -n '\.env\.ts|/\.env\b' .gitignore || echo "No .env.ts patterns found in .gitignore"
fi
# Look for other auto-generated .env.ts references in the repo
echo -e "\n=== Other references to auto-generated .env.ts ==="
rg -n 'AUTO GENERATED' --type ts -g '*.env.ts' || echo "No other auto-generated env files found"
# Check git history for this file to see if it's typically committed
echo -e "\n=== Recent git history for this file ==="
git log --oneline -5 -- src/environments/.env.ts 2>/dev/null || echo "Unable to retrieve git history"Repository: openMF/web-app
Length of output: 382
Remove .env.ts from commit — file is gitignored and explicitly warns against check-in.
This auto-generated file is listed in .gitignore (line 65) and contains a warning on line 9: "THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!" It should not be committed to the repository. Remove src/environments/.env.ts from this PR and regenerate it locally if needed for testing.
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 13-13: [IncorrectDelimiter] The 'version': '260428', key has incorrect delimiter
(IncorrectDelimiter)
[warning] 13-13: [KeyWithoutValue] The 'version': '260428', key should be with a value or have an equal sign
(KeyWithoutValue)
[warning] 13-13: [LeadingCharacter] Invalid leading character detected
(LeadingCharacter)
[warning] 13-13: [LowercaseKey] The 'version': '260428', key should be in uppercase
(LowercaseKey)
[warning] 13-13: [UnorderedKey] The 'version': '260428', key should go before the /* tslint:disable */ key
(UnorderedKey)
[warning] 14-14: [IncorrectDelimiter] The 'hash': '2a6f1e31' key has incorrect delimiter
(IncorrectDelimiter)
[warning] 14-14: [KeyWithoutValue] The 'hash': '2a6f1e31' key should be with a value or have an equal sign
(KeyWithoutValue)
[warning] 14-14: [LeadingCharacter] Invalid leading character detected
(LeadingCharacter)
[warning] 14-14: [LowercaseKey] The 'hash': '2a6f1e31' key should be in uppercase
(LowercaseKey)
[warning] 14-14: [UnorderedKey] The 'hash': '2a6f1e31' key should go before the 'mifos_x': { key
(UnorderedKey)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/environments/.env.ts` around lines 13 - 14, This file containing the
auto-generated keys 'version' and 'hash' and the warning "THIS FILE IS AUTO
GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!" should not be committed; remove it
from the PR by unstaging/removing it from Git (e.g., git rm --cached <file>) and
revert the commit that added it (or drop the file from the branch), then
regenerate locally as needed for testing so the auto-generated .env module is
not checked into the repo.
| <div class="flex-50"> | ||
| ({{ taxComponentData.debitAccount.glCode }}) | ||
| {{ taxComponentData.debitAccount.name }} | ||
| ({{ taxComponentData.debitAccount.glCode | translate }}) |
| ({{ taxComponentData.debitAccount.glCode }}) | ||
| {{ taxComponentData.debitAccount.name }} | ||
| ({{ taxComponentData.debitAccount.glCode | translate }}) | ||
| {{ taxComponentData.debitAccount.name | translate }} |
There was a problem hiding this comment.
also remove this other translation too
There was a problem hiding this comment.
Remove this file from the commit
e062815 to
ffa5182
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
`@src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html`:
- Line 42: The translateKey pipe is being called with 'inputs.accounting' but
its default prefix 'labels' is being prepended, causing lookups like
'labels.inputs.accounting.<code>' instead of 'inputs.accounting.<code>'; update
the bindings that use taxComponentData.debitAccountType.code and
taxComponentData.creditAccountType.code to call translateKey with no prefix (or
an explicit empty prefix) so the resolved key is inputs.accounting.<code> (i.e.
override the pipe's prefix argument to ''/null or use the full key string
concatenation) and apply the same fix for both debit and credit account-type
bindings that use the translateKey pipe.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9fc9413e-73db-4e1e-8eaa-5a061ddd8eb9
📒 Files selected for processing (1)
src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html
|
@IOhacker Thanks for the review! I've just pushed an update that addresses your feedback:
The PR is updated and ready for another look. Let me know if anything else is needed! |
This PR fixes missing i18n translations in the Tax Components view and list view.
Key changes:
translateKeypipe.translatepipe to account GL codes and names to handle translation keys returned by the API.Summary by CodeRabbit