From 1f55dc4dd23484624b9fd163b2b2d8d47654a93d Mon Sep 17 00:00:00 2001 From: Fahri Gedik <53567152+fahrigedik@users.noreply.github.com> Date: Fri, 9 Jan 2026 10:41:25 +0300 Subject: [PATCH 1/2] Use environment defaultResourceName in localization Updates ConfigStateService to set the defaultResourceName for localization from the environment configuration if it is not already set in the app state. This ensures that the localization resource name is consistently initialized from environment settings when available. --- .../src/lib/services/config-state.service.ts | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts index 1243e8b2ba..a0d2c561e9 100644 --- a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts @@ -10,6 +10,7 @@ import { } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; import { INCUDE_LOCALIZATION_RESOURCES_TOKEN } from '../tokens/include-localization-resources.token'; import { InternalStore } from '../utils/internal-store-utils'; +import { EnvironmentService } from './environment.service'; @Injectable({ providedIn: 'root', @@ -17,6 +18,7 @@ import { InternalStore } from '../utils/internal-store-utils'; export class ConfigStateService { private abpConfigService = inject(AbpApplicationConfigurationService); private abpApplicationLocalizationService = inject(AbpApplicationLocalizationService); + private environmentService = inject(EnvironmentService); private readonly includeLocalizationResources = inject(INCUDE_LOCALIZATION_RESOURCES_TOKEN, { optional: true }); private updateSubject = new Subject(); @@ -59,7 +61,18 @@ export class ConfigStateService { this.uiCultureFromAuthCodeFlow ?? appState.localization.currentCulture.cultureName; return this.getlocalizationResource(cultureName).pipe( - map(result => ({ ...appState, localization: { ...appState.localization, ...result } })), + map(result => { + const envLocalization = this.environmentService.getEnvironment()?.localization; + return { + ...appState, + localization: { + ...appState.localization, + ...result, + defaultResourceName: + appState.localization?.defaultResourceName ?? envLocalization?.defaultResourceName, + }, + }; + }), tap(() => (this.uiCultureFromAuthCodeFlow = undefined)), ); } @@ -83,9 +96,18 @@ export class ConfigStateService { return this.getlocalizationResource(lang) .pipe( - tap(result => - this.store.patch({ localization: { ...this.store.state.localization, ...result } }), - ), + tap(result => { + const envLocalization = this.environmentService.getEnvironment()?.localization; + this.store.patch({ + localization: { + ...this.store.state.localization, + ...result, + defaultResourceName: + this.store.state.localization?.defaultResourceName ?? + envLocalization?.defaultResourceName, + }, + }); + }), ) .pipe(map(() => null)); } From ae35023b5dce9f99c9ff29a8b1d1d89ab675c1d0 Mon Sep 17 00:00:00 2001 From: Fahri Gedik <53567152+fahrigedik@users.noreply.github.com> Date: Fri, 9 Jan 2026 10:56:23 +0300 Subject: [PATCH 2/2] Clarify defaultResourceName resolution in localization docs Updated the explanation for how defaultResourceName is determined, specifying that it is first retrieved from the backend API response and falls back to the value in environment.ts if not provided. --- docs/en/framework/ui/angular/localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/framework/ui/angular/localization.md b/docs/en/framework/ui/angular/localization.md index 9f3122529c..d50484c83a 100644 --- a/docs/en/framework/ui/angular/localization.md +++ b/docs/en/framework/ui/angular/localization.md @@ -12,7 +12,7 @@ Before exploring _the localization pipe_ and _the localization service_, you sho The localization key format consists of two sections which are **Resource Name** and **Key**. `ResourceName::Key` -> If you do not specify the resource name, the `defaultResourceName` which is declared in `environment.ts` will be considered as default. +> If you do not specify the resource name, the `defaultResourceName` will be used. The value is first retrieved from the backend API response. If the backend does not provide a `defaultResourceName`, the value declared in `environment.ts` will be used as a fallback. ```ts const environment = {