Making App multi language - Best way? RRS feed

  • Question

  • User1035637761 posted

    I have an application that needs to be multi language and the way i'd have done it in asp was just to produce a few different files, lang_eng.asp,lang_ger.asp,lang_fr.asp etc containing every piece of text within the app as a variable and the use a select case on every page like:

    Select case session("app_lang")
    case "eng"
    <!--#include file="lang_eng.asp"-->
    case "ger"
    <!--#include file="lang_ger.asp"-->


    I'm assuming there a more cunning way to do this in asp.net 2.0? Whats my best way of approaching it so every page is automatically given access to the correct language set according to a session var without having to resort to the old include method?


    Thursday, March 16, 2006 7:19 AM

All replies

  • User89244710 posted

    hi ,

    in asp.net 2.0 you can do this so easly using localResourceFiles or globalResourceFiles and u just give yor control the key and the compiler gets the current culture and render the key from the correct resource files ,


    that's it


    by the way u don't need sessions or any thing to swap manually

    u can do this in the global file in the Application_BeginRequest

    and check the language querystring

    according to it set your site culture like this


    Thread.CurrentThread.CurrentUICulture = new CultureInfo(Request.QueryString["Culture"]);



    Tuesday, March 21, 2006 6:21 AM
  • User1035637761 posted

    Thank you Ahmed, useful info.

    For anyone else looking to do the same thing i also found a very good 4 page article at: http://www.devx.com/dotnet/Article/6997/0/page/2

    Tuesday, March 21, 2006 12:17 PM