abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.92k stars 3.44k forks source link

Lang attribute on HTML is always set to en on the first load #20805

Closed maskalek closed 1 month ago

maskalek commented 1 month ago

Is there an existing issue for this?

Description

When opening a page for the first time in a web application, the lang attribute on the tag is always set to en (English), regardless of the selected language. This issue only occurs on the first load of the page. After selecting new language, attribute is set correctly.

Reproduction Steps

  1. Set up a new app with Angular UI
  2. Open the application for the first time in a browser.
  3. Inspect the lang attribute on the tag in the developer tools.
  4. Change language
  5. tag is changed
  6. Reload page

Expected behavior

The lang attribute on the tag should be set based on the user's preferred language

Actual behavior

On the first load of the page, the lang attribute is always set to en, even if the default language is set to something else.

Regression?

No response

Known Workarounds

No response

Version

8.3.0

User Interface

Angular

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

This issue seems to be in setInitialLanguage in SessionStateService. if is always false as far as I see in the block below

if (appLanguage !== lang) {
          this.setLanguage(lang);
        }
masum-ulu commented 1 month ago

Welcome PR :)