Skip to content

Commit

Permalink
fix(ui5-application-inquirer): Fix non-loaded i18n texts (#2666)
Browse files Browse the repository at this point in the history
* Fixes non-loaded i18n texts

#2590

* Adds cset. Dont mock untested functions.
  • Loading branch information
IainSAP authored Dec 5, 2024
1 parent 0ecd821 commit b67b17d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-rabbits-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sap-ux/ui5-application-inquirer': patch
---

Fixes non-loading texts from nested dependency
8 changes: 5 additions & 3 deletions packages/ui5-application-inquirer/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { TOptions } from 'i18next';
import i18next from 'i18next';
import translations from './translations/ui5-application-inquirer.i18n.json';
import { addi18nResourceBundle as addInquirerCommoni18nResourceBundle } from '@sap-ux/inquirer-common';
import { addi18nResourceBundle as addi18nResourceBundleInquirerCommon } from '@sap-ux/inquirer-common';
import { addi18nResourceBundle as addi18nResourceBundleProjectInputValidator } from '@sap-ux/project-input-validator';

const ui5AppInquirerNamespace = 'ui5-application-inquirer';
export const defaultProjectNumber = 1;
Expand All @@ -19,8 +20,9 @@ export async function initI18nUi5AppInquirer(): Promise<void> {
}
});
i18next.addResourceBundle('en', ui5AppInquirerNamespace, translations);
// add the inquirer common i18n resource bundle to ensure all translations are available
addInquirerCommoni18nResourceBundle();
// Add bundles on which this module depends (this is a temp workaround as the init from the imported modules is not called)
addi18nResourceBundleProjectInputValidator();
addi18nResourceBundleInquirerCommon();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as projectValidators from '@sap-ux/project-input-validator';
import * as validators from '../../../src/prompts/validators';

jest.mock('@sap-ux/project-input-validator', () => ({
...jest.requireActual('@sap-ux/project-input-validator'),
validateProjectFolder: jest.fn()
}));

Expand Down

0 comments on commit b67b17d

Please sign in to comment.