abp icon indicating copy to clipboard operation
abp copied to clipboard

When removing English from the languages it still gets defaulted to in blazor-server.

Open Hyppothalamus opened this issue 2 years ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

I was setting up a tiered Blazor-server project where I also was implementing the AuthServer in HttpApiHost. While I was removing the languages in the DomainModule and only enabling Dutch. I restarted the application (Blazor and Host) to check my changes to my suprise English was still selected by default.

When changing to the only other language (Dutch) the select dropdown goes away and the correct language gets selected.

I was searching on the internet but could not find any solutions. Like setting the default language in the OnApplicationInitialization doesn't work.

Any help would be really recommended and thanks in advance!

Reproduction Steps

New blazor server tiered project with basic theme. Remove all the languages except dutch and start the application.

Default english will be selected with the option to change to dutch. After changing you cannot go back to english because it shouldn't be enabled.

Expected behavior

Their is no language select dropdown and dutch will be selected and defaulted to.

Actual behavior

Their is a language dropdown with 1 option dutch and english is selected by default.

Regression?

No response

Known Workarounds

None

Version

8.3.3

User Interface

Blazor Server

Database Provider

EF Core (Default)

Tiered or separate authentication server

Tiered

Operation System

Linux

Other information

No response

Hyppothalamus avatar Nov 08 '24 09:11 Hyppothalamus

language is also stored as a cookie. may it be that you did not clear it?

nebula2 avatar Nov 09 '24 08:11 nebula2

hi @Hyppothalamus

Can you share a test project to reproduce?

maliming avatar Nov 11 '24 09:11 maliming

localization_test.zip

This is a test project I created. All the languages are disabled except for nl-BE in the DomainModule and in the SharedDomainModule default culture name is changed to nl-BE. This is a blazor-server tiered project with the latest abp framework.

I also cleared my cookies after changing the languages.

Thanks in advance!

Hyppothalamus avatar Nov 12 '24 08:11 Hyppothalamus

hi

image

image image image

maliming avatar Nov 18 '24 03:11 maliming

Thank you for the fix. This sounds like a default feature is there a reason why this isn't in the docs?

Hyppothalamus avatar Nov 18 '24 11:11 Hyppothalamus

@maliming Thanks.I found this works for me. 1.change the code in ConfigureService 2.add code to the Blazor project's appsettings.json

"Settings": {
    "Abp.Localization.DefaultLanguage": "zh-hans"
  }

lidalve avatar Dec 18 '24 07:12 lidalve