Skip to content

feat(core): use environment defaultResourceName as fallback for localization - Issue 24402#24589

Merged
oykuermann merged 2 commits intodevfrom
issue-24402
Jan 15, 2026
Merged

feat(core): use environment defaultResourceName as fallback for localization - Issue 24402#24589
oykuermann merged 2 commits intodevfrom
issue-24402

Conversation

@fahrigedik
Copy link
Member

Description

Resolves #24402 (write the related issue number if available)

Changes

  • ConfigStateService: Added EnvironmentService dependency and implemented fallback logic for defaultResourceName
    • In getLocalizationAndCombineWithAppState: Uses environment value when API response doesn't provide defaultResourceName
    • In refreshLocalization: Same fallback logic applied for consistency

Behavior

Source Priority
Backend API response Primary
environment.ts Fallback

Example

// environment.ts
export const environment = {
localization: {
defaultResourceName: 'MyProjectName',
},
} as Environment;

Checklist

  • I documented it (or no need to document or I will create a separate documentation issue)

How to test it?

  1. Remove the [LocalizationResourceName("MyProjectName")] attribute from: abp\templates\app\aspnet-core\src\MyCompanyName.MyProjectName.Domain.Shared\Localization\MyProjectNameResource.cs

  2. Run the DbMigrator:
    cd abp\templates\app\aspnet-core\src\MyCompanyName.MyProjectName.DbMigrator dotnet run

  3. Ensure environment.ts has defaultResourceName configured:
    localization: { defaultResourceName: 'MyProjectName', },

  4. Start the Angular dev-app:
    cd abp\npm\ng-packs yarn start

Verify that {{ '::Welcome' | abpLocalization }} correctly resolves using the environment fallback.
Expected: Localization keys with :: prefix should resolve to the resource name defined in environment.ts when the backend doesn't provide defaultResourceName.

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.
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.
Copy link
Contributor

@oykuermann oykuermann left a comment

Choose a reason for hiding this comment

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

image

@oykuermann oykuermann merged commit 527895f into dev Jan 15, 2026
2 of 3 checks passed
@oykuermann oykuermann deleted the issue-24402 branch January 15, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Angular - Checking the defaultResourceName parameter for localization

3 participants