Search code examples
c#asp.netlocalizationglobalizationlocalizable.strings

Programmatically localize a String?


Asp.net 4 and C#.

I have a string in my Code Behind. I would like assign a value depending on the User's Browser region.

I'm trying with this code, no error, but does not work (no value to a String has been assigned).

Any idea how to solve it? Thanks

   string textPrevious = "<%$ Resources:Global, CategoryListSubCategories %>";

Solution

  • I found out the solution myself: Just use Resources.Global.

    string textPrevious = Resources.Global.CategoryListSubCategories;
    

    Useful article: http://shan-tech.blogspot.com/2007/02/aspnet-20-localization-of-string.html