Language Module in ADAFSA

configuration the module

Language management module is pre-installed in the startup templates. So, it need to manually install it by install every packages to matching project on your solution.

After adding the package reference, open the module class of the project (eg: ADAFSACommonWebModule) and add the below code to the DependsOn attribute.

[DependsOn(
  //...
  typeof(LanguageManagementWebModule)
)]

Creating the Loclization key

The initial key should be added to the defualt JSON file (en.json)

{
  "Culture": "en",
  "Texts": {
    // ...
    "Test": "This is a test"
  }
}

And use it in the view:

...
<div class="text-center">
    <h1>@L["Test"]</h1>
</div>
...

Renderd like this:

Screenshot 2023-05-06 122316

Manage the language texts

From the admin portal Administration>Language Management>Language Texts

select the Target Culture Name to العربية

Screenshot 2023-05-06 121823

Edit the desired key to the new value and save!

Screenshot 2023-05-06 121902

Screenshot 2023-05-06 121912

By selecting the العربية as the site language it will render like this:

Screenshot 2023-05-06 122302

Notes:

  • The default language can be modified from the language texts and the new value will be sotred in the database.
  • The (Restore to the defaule) button in the edit modal it restores the value to the value in the default JSON file.

Conventions

follow this convention as a standard convention in the localization keys:

{Portal}{TierConventionName}:{FileName}:{MessageTitle}

Example:

  "Culture": "en",
    "Texts": {
      // ...
      "StudentService:Courses:NotAuthorized": "You are not authorized to watch the lesson you requested!"
    }
Tier Name Tier Convention Name
Application Service
Domain Service
HttpApi Api
Web Web
In this document