Skip to content

WEB-926: Fix missing i18n translations in Tax Components view#3536

Open
sakshar2303 wants to merge 1 commit intoopenMF:devfrom
sakshar2303:WEB-926-fix-i18n-tax-components
Open

WEB-926: Fix missing i18n translations in Tax Components view#3536
sakshar2303 wants to merge 1 commit intoopenMF:devfrom
sakshar2303:WEB-926-fix-i18n-tax-components

Conversation

@sakshar2303
Copy link
Copy Markdown

@sakshar2303 sakshar2303 commented Apr 27, 2026

This PR fixes missing i18n translations in the Tax Components view and list view.
Key changes:

  • Replaced manual string concatenation for account type translation with the standard translateKey pipe.
    • Added translate pipe to account GL codes and names to handle translation keys returned by the API.
    • Verified with unit tests (38/38 passed).
    • Applied prettier formatting and added license headers.

Summary by CodeRabbit

  • Bug Fixes
    • Improved translation handling for debit and credit account type labels in tax component management to ensure consistent and accurate display.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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

Walkthrough

The debit and credit account type label translations in the view-tax-component template have been refactored to use a code-based approach with a standardized translation key prefix (inputs.accounting) instead of dynamically constructing keys by splitting, uppercasing, and transforming the account type value.

Changes

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

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2a6f1e3 and e062815.

📒 Files selected for processing (3)
  • src/app/products/manage-tax-components/manage-tax-components.component.html
  • src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html
  • src/environments/.env.ts

Comment on lines +44 to +45
({{ taxComponent.creditAccount?.glCode || '' | translate }})
{{ taxComponent.creditAccount?.name || '' | translate }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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' || true

Repository: 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.

Comment on lines +54 to +55
({{ taxComponentData.debitAccount.glCode | translate }})
{{ taxComponentData.debitAccount.name | translate }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Comment thread src/environments/.env.ts Outdated
Comment on lines +13 to +14
'version': '260428',
'hash': '2a6f1e31'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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 }})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this translation

({{ taxComponentData.debitAccount.glCode }})
{{ taxComponentData.debitAccount.name }}
({{ taxComponentData.debitAccount.glCode | translate }})
{{ taxComponentData.debitAccount.name | translate }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also remove this other translation too

Comment thread src/environments/.env.ts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file from the commit

@sakshar2303 sakshar2303 force-pushed the WEB-926-fix-i18n-tax-components branch from e062815 to ffa5182 Compare April 28, 2026 02:14
Copy link
Copy Markdown

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

📥 Commits

Reviewing files that changed from the base of the PR and between e062815 and ffa5182.

📒 Files selected for processing (1)
  • src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html

@sakshar2303
Copy link
Copy Markdown
Author

sakshar2303 commented Apr 28, 2026

@IOhacker Thanks for the review! I've just pushed an update that addresses your feedback:

  • Removed src/environments/.env.ts from the commit.
  • Removed the unnecessary | translate pipes from the account GL code and name bindings.

The PR is updated and ready for another look. Let me know if anything else is needed!

Copy link
Copy Markdown
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Collaborator

@gkbishnoi07 gkbishnoi07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sakshar2303 sakshar2303 requested a review from IOhacker April 29, 2026 14:09
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.

4 participants