Skip to content

Localization doesn't work properly for extended properties in Angular #25749

Description

@chandralk

Is there an existing issue for this?

  • I have searched the existing issues

Description

While extending an existing entity from pre-built modules, (e.g. Role in IdentityManager), even when a proper DisplayName parameter is added with a valid LocalizationResource, the localization of the new property always defaults to the default LocalizationResource instead of the one specified in the DisplayName parameter.

Reproduction Steps

  1. Create a new module named MyModule
  2. Add a new property to an existing entity from pre-built modules in and add a DisplayName value as specified in the example:

In MyModule.Domain.Shared/MyModuleExtensionConfigurator.cs:

public static void ConfigureExtraProperties()
{
    OneTimeRunner.Run(() =>
    {
        ObjectExtensionManager.Instance.Modules()
            .ConfigureIdentity(identity =>
            {
                identity.ConfigureUser(user =>
                {
                    user.AddOrUpdateProperty<string>( //property type: string
                        "SocialSecurityNumber", //property name
                        property =>
                        {
                            //localization
                            property.DisplayName =
                                LocalizableString.Create<MyProjectNameResource>(
                                    "UserSocialSecurityNumberDisplayName"
                                );
                        }
                    );
                });
            });
    });
}
  1. Add a localization string in MyProject.Demo.Shared/Localization/MyProjectNameResource/en.json:
"UserSocialSecurityNumberDisplayName": "Social Security Number"
  1. Add this MyModule to an application and run the application and launch Angular application.
  2. Navigate to identity/roles path and try adding a new role or edit an existing role

Expected behavior

The label in the form should show "Social Security Number"

Actual behavior

The label shows "UserSocialSecurityNumberDisplayName"

Regression?

No

Known Workarounds

None

Version

8.3.4

User Interface

Angular

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

Issue also present in latest version.

I have identified the root cause of the issue and am raising a PR for the fix.

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions