Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to use Localization in Static class #6405


User avatar
0
ajayak created

I have a static class called Generic Helper. How can I use L in the static class?


3 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    From the documentation on Localization:

    If we can not inject ILocalizationManager (maybe it's in a static context that can not be reached by the dependency injection), we can simply use the LocalizationHelper static class.

  • User Avatar
    0
    ajayak created

    Hi @aaron. How can I pass parameters as in L('name', parameters) using LocalizationHelper? Can't find any way.

  • User Avatar
    0
    aaron created
    Support Team
    // using Abp.Localization;
    // using Abp.Localization.Sources;
    
    var localizedString = LocalizationHelper.GetSource(sourceName).GetString(name, args);