Base solution for your next web application
Open Closed

Server Side Localization #10931


User avatar
0
moonch created
  • Product version: Asp Net Core, JQuery, .NET 6

I am trying to perform localization on the server side in one Applization Service method, I have added the string into xml files

<text name="StageChangedTo">Stage Changed To:</text>

However when I call Get string from the injected _localizationManager

            var changeStageString = _localizationManager.GetString("StageChangedTo", "Archirox");

Error, localization source canot be fund... Note that the seconed parameter "Archirox" is the default xml name and soluation name.

Please Advice how to do localization on the server side. ?


2 Answer(s)
  • User Avatar
    0
    moonch created

    The following Would get localization on the server side

    _localizationManager.GetString(AbpZeroConsts.LocalizationSourceName, "StageChangedTo");

  • User Avatar
    0
    moonch created

    Dear Customer support, Tried to perform localization inside the application service method is not working, I tried injecting ILocalizationManager _localizationManager; and use it to localize some text before saving it to the database,

    if using @L("someText") in controller it works , also same inside the .cshtml and javascript app.localize("sometext")

    However in some case i need to perform localization inside the application service by using the localization manager,

    var localizedText = _localizationManager.GetString(AbpZeroConsts.LocalizationSourceName, "sometext");

    this does not localize . Please advice on how to perform localization inside App.Service or Application Project