Skip to content

[ACS-11213] Reverted ngx translate upgrade#11702

Merged
AleksanderSklorz merged 1 commit intodevelopfrom
ACS-11213-Upgrade-ngx-translate-to-v17-revert
Feb 27, 2026
Merged

[ACS-11213] Reverted ngx translate upgrade#11702
AleksanderSklorz merged 1 commit intodevelopfrom
ACS-11213-Upgrade-ngx-translate-to-v17-revert

Conversation

@AleksanderSklorz
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe:

What is the current behaviour? (You can also link to an open issue here)
https://hyland.atlassian.net/browse/ACS-11213

What is the new behaviour?
Reverted https://hyland.atlassian.net/browse/ACS-11213

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

Copilot AI review requested due to automatic review settings February 27, 2026 22:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reverts a previous upgrade of @ngx-translate/core from v17 back to v16, addressing issues introduced by that upgrade. The revert includes restoring v16-compatible API usage throughout the codebase.

Changes:

  • Downgrade @ngx-translate/core dependency from ^17.0.0 to ^16.0.4 in root and library package.json files.
  • Replace v17-specific APIs (provideTranslateLoader, setFallbackLang, getFallbackLang) with v16-compatible equivalents (TranslateLoader provider objects, setDefaultLang, defaultLang).
  • Update test files to use v16-compatible module setup patterns.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Reverts root @ngx-translate/core to ^16.0.4
lib/core/package.json Reverts core lib peer dependency to >=16.0.0
lib/content-services/package.json Reverts content-services peer dependency to >=16.0.0
lib/insights/package.json Reverts insights peer dependency to >=14.0.0
lib/process-services/package.json Reverts process-services peer dependency to >=14.0.0
lib/process-services-cloud/package.json Reverts process-services-cloud peer dependency to >=14.0.0
lib/core/src/lib/core.module.ts Replaces provideTranslateLoader with inline TranslateLoader provider object
lib/core/src/lib/translation/provide-i18n.ts Replaces provideTranslateLoader/fallbackLang with inline provider/defaultLanguage
lib/core/src/lib/translation/translation.service.ts Reverts to setDefaultLang, getTranslation, and manual onTranslationChange emit
lib/core/src/lib/translation/translate-loader.spec.ts Updates test setup to v16-compatible API
lib/core/src/lib/translation/translation.service.spec.ts Reverts to TranslateModule.forRoot setup
lib/core/src/lib/translation/provide-i18n.spec.ts Updates assertions from getFallbackLang() to defaultLang property
lib/core/src/lib/testing/noop-translate.module.ts Removes TranslateLoader implementation from NoopTranslationService

Comment on lines +137 to +140
this.translate.onTranslationChange.next({
lang,
translations: this.customLoader.getFullTranslationJSON?.(lang) ?? {}
});
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Directly calling .next() on onTranslationChange (which is a public EventEmitter/Subject from TranslateService) bypasses the internal state management of TranslateService. The previous implementation used this.translate.setTranslation(lang, translations, true), which properly merges translations into the internal store and then fires the event. With this change, the event fires but the translations are not actually stored in TranslateService's internal map, so calls like translateService.instant(key) will not reflect the merged translations from the custom loader.

The v16-compatible approach should call this.translate.setTranslation(lang, translations, true) as before, which both stores the translations and emits the change event internally.

Suggested change
this.translate.onTranslationChange.next({
lang,
translations: this.customLoader.getFullTranslationJSON?.(lang) ?? {}
});
const translations = this.customLoader.getFullTranslationJSON?.(lang) ?? {};
this.translate.setTranslation(lang, translations, true);

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +60
useExisting: TranslateLoaderService,
deps: [HttpClient]
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The deps field is not applicable when using useExisting, since useExisting creates an alias to an already-existing provider rather than instantiating a new one. The deps array is only meaningful for useClass or useFactory. Including it here is misleading and may cause unexpected behavior depending on the DI framework version. The deps entry should be removed when using useExisting.

Suggested change
useExisting: TranslateLoaderService,
deps: [HttpClient]
useExisting: TranslateLoaderService

Copilot uses AI. Check for mistakes.
Comment on lines 57 to +61
provideTranslateService({
loader: provideTranslateLoader(NoopTranslationService)
loader: {
provide: TranslateLoader,
useClass: NoopTranslationService
}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

NoopTranslationService no longer implements TranslateLoader (the getTranslation method was removed) but is still registered as the TranslateLoader provider. TranslateService will call currentLoader.getTranslation() internally and will fail at runtime because the method no longer exists on NoopTranslationService. Either keep the getTranslation(): Observable<TranslationObject> method on NoopTranslationService, or use a separate minimal class that implements TranslateLoader for this provider.

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

@AleksanderSklorz AleksanderSklorz merged commit 0b7b89e into develop Feb 27, 2026
29 of 32 checks passed
@AleksanderSklorz AleksanderSklorz deleted the ACS-11213-Upgrade-ngx-translate-to-v17-revert branch February 27, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants