Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class QboOnboardingConnectorComponent implements OnInit, OnDestroy {
const errorMessage = 'message' in error.error ? error.error.message : this.translocoService.translate('qboOnboardingConnector.failedToConnectQBO');
if (errorMessage === 'Please choose the correct QuickBooks Online account') {
this.warningHeaderText = this.translocoService.translate('qboOnboardingConnector.incorrectAccountWarningHeader');
this.warningContextText = this.translocoService.translate('qboOnboardingConnector.incorrectAccountWarningContent');
this.warningContextText = this.translocoService.translate('qboOnboardingConnector.incorrectAccountWarningContent', { accountName: this.qboCompanyName || 'a different' });
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Hardcoded English fallback breaks i18n consistency.

The fallback value 'a different' is hardcoded in English, which will appear in English regardless of the user's locale setting. This breaks internationalization consistency.

Consider checking if the error response contains the company name (similar to line 223 where error.error.company_name is used), or use a translatable fallback string.

Verify if the error object at line 198 contains a company_name field that could be used instead of the hardcoded fallback:


🏁 Script executed:

#!/bin/bash
# Search for error response structure in QBO connector service and related files
rg -n -A5 -B5 "Please choose the correct QuickBooks Online account" --type=ts

Length of output: 3497



---

🏁 Script executed:

```shell
#!/bin/bash
# Find qboCompanyName initialization and assignments
rg -n "qboCompanyName\s*=" --type=ts src/app/integrations/qbo/qbo-onboarding/qbo-onboarding-connector/qbo-onboarding-connector.component.ts

Length of output: 179


🏁 Script executed:

#!/bin/bash
# Find all references to company_name in error responses
rg -n "company_name" --type=ts -C3 src/app/integrations/qbo/

Length of output: 3582


🏁 Script executed:

#!/bin/bash
# Check for translation keys related to 'a different' or fallback
rg -n "a different" --type=json src/assets/i18n/

Length of output: 1500


🏁 Script executed:

#!/bin/bash
# Get the full error handler context around line 198-201
sed -n '190,210p' src/app/integrations/qbo/qbo-onboarding/qbo-onboarding-connector/qbo-onboarding-connector.component.ts

Length of output: 1301


🏁 Script executed:

#!/bin/bash
# Check line 223 referenced in scratchpad to see company_name usage
sed -n '215,230p' src/app/integrations/qbo/qbo-onboarding/qbo-onboarding-connector/qbo-onboarding-connector.component.ts

Length of output: 469


🏁 Script executed:

#!/bin/bash
# Search for translation keys containing 'ifferent'
rg -n "ifferent" --type=json src/assets/i18n/

Length of output: 2119


Hardcoded English fallback breaks i18n consistency.

At line 201, the fallback value 'a different' is hardcoded in English and does not exist in any translation files. This will always display in English regardless of the user's locale setting.

The error response object contains company_name (as shown in line 223's error handler pattern), so consider extracting it from error.error.company_name instead of the hardcoded fallback:

accountName: error.error?.company_name || this.translocoService.translate('qboOnboardingConnector.fallbackAccountName')

Create a translation key for the fallback scenario to maintain i18n consistency across all locales.

🤖 Prompt for AI Agents
In
src/app/integrations/qbo/qbo-onboarding/qbo-onboarding-connector/qbo-onboarding-connector.component.ts
around line 201, the fallback account name is hardcoded as the English string 'a
different', breaking i18n; replace that hardcoded fallback by pulling the
company name from the error object when available (e.g.,
error.error?.company_name) and otherwise use a translated fallback key via
this.translocoService.translate('qboOnboardingConnector.fallbackAccountName');
add the new translation key 'qboOnboardingConnector.fallbackAccountName' to all
locale files and update the error handler to pass accountName:
error.error?.company_name ||
this.translocoService.translate('qboOnboardingConnector.fallbackAccountName') so
all locales show a proper translated fallback.

this.primaryButtonText = this.translocoService.translate('qboOnboardingConnector.reconnectButtonText');
this.warningEvent = ConfigurationWarningEvent.INCORRECT_QBO_ACCOUNT_CONNECTED;
this.isWarningDialogVisible = true;
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
"continueButtonText": "Continue",
"failedToConnectQBO": "Failed to connect to QuickBooks Online. Please try again",
"incorrectAccountWarningHeader": "Incorrect account selected",
"incorrectAccountWarningContent": "You had previously set up the integration with a different QuickBooks Online account. Please choose the same to restore the settings",
"incorrectAccountWarningContent": "You had previously set up the integration with {{accountName}} QuickBooks Online account. Please choose the same to restore the settings",
"reconnectButtonText": "Re connect",
"somethingWentWrong": "Something went wrong, please try again."
},
Expand Down
Loading