What approach changing language with querystring?

Last post 02-18-2008 4:23 PM by Tok Bek. 8 replies.

Sort Posts:

  • What approach changing language with querystring?

    01-06-2008, 12:17 PM
    • Loading...
    • zipfeli
    • Joined on 08-07-2005, 4:07 PM
    • Posts 97

    Hi

    I now change the language from site using dropdown and saving the language in sessionobject (global.asax).

    Thinking about search engine optimization I ask you:

    1. Do you recommend using querystring rather than dropdown?
    2. How should I pass the selected language to next page e.g. CultureUI in global.asax is changed, how Do I insert that into querystring?
    3. Do I have to add a sitemap if I use querystring for changing language and if yes, Do I have to add every page 4 times with appropriate language querystring?

    Many thanks for your suggestions

  • Re: What approach changing language with querystring?

    01-06-2008, 5:59 PM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,553

     Look at http://www.guysmithferrier.com/ and in particular at Guy Smith's book ISBN 0321341384. The book is available online at Safari books at http://safari.oreilly.com/0321341384

    Also his presentation http://www.guysmithferrier.com/downloads/teni18n.pdf

    If you are using ASP.NET 2.0, then it is fairly simple to move text into a resource file that can be translated for each language you wish to support. So only one page, just 4 sets of resource files. 

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: What approach changing language with querystring?

    01-10-2008, 8:47 AM
    • Loading...
    • zipfeli
    • Joined on 08-07-2005, 4:07 PM
    • Posts 97

    Thank you, but Localization is no issue, that is already done. I'm asking about using querystrings for changing the language.

  • Re: What approach changing language with querystring?

    02-15-2008, 1:57 PM

    I'm having the same issue, and would love to see a reply.  I've decided to go the querystring route as the cookies route excludes some people and search engines, and the url rewriting route would take more time than I have for this round.

  • Re: What approach changing language with querystring?

    02-15-2008, 7:14 PM
    • Loading...
    • Tok Bek
    • Joined on 07-09-2006, 6:27 AM
    • Israel
    • Posts 113

     I think that the best way is using Url ReWrite.

    In this way youll have www.xxx.yy/en , www.xxx.yy/fr, www.xxx.yy/gr etc.

    It is very easy to implement, and very elegant. Thats how i do it !

    Here is a simple code sample (far from optimize):

        public class UrlHandler : IHttpModule
    {
    public UrlHandler()
    {

    }

    public void Dispose()
    {
    // do nothing
    }

    public void Init(HttpApplication context)
    {
    context.BeginRequest += new EventHandler(SetLanguageURL);
    }

    void SetLanguageURL(object sender, EventArgs e)
    {
    HttpApplication app = (HttpApplication)sender;
    if (app.Request.RawUrl.ToLower().Contains("/fr/"))
    {
    app.Context.RewritePath(app.Request.Path.Replace("/fr/", "/"), "", app.Request.QueryString.ToString());
    }
    if (app.Request.RawUrl.ToLower().Contains("/ru/"))
    {
    app.Context.RewritePath(app.Request.Path.Replace("/ru/", "/"), "", app.Request.QueryString.ToString());
    }
    }
    }

     

    when you rewright the url u can add to the querystring your LangID value:

    something like ---- app.Request.QueryString.ToString() + "&LangID=fr"

    it is better practice to use the .net built in globalization and localization support, instead of using a querystring.

    For further details end examples see:
    http://www.asp.net/learn/videos/video-40.aspx

    http://www.asp.net/learn/videos/video-154.aspx

     

    Good luck Smile
     

     

    Dont forget to click "Mark as Answer" on the post that helped you
  • Re: What approach changing language with querystring?

    02-15-2008, 7:32 PM

    Looks like a great example.  Thanks!  I'll give it a try.

    Oh, and since this is .Net URL rewriting, for everyone's information, I think there's a gotcha that if you want HTML files to get rewritten (or anything other than
     ASPX), you need to make those file extensions route through the ASP.Net ISAPI filter in IIS6 (dunno about 7).

  • Re: What approach changing language with querystring?

    02-15-2008, 7:39 PM
    • Loading...
    • Tok Bek
    • Joined on 07-09-2006, 6:27 AM
    • Israel
    • Posts 113

    of course. you also need to handle image and other non .aspx files. 

    Dont forget to click "Mark as Answer" on the post that helped you
  • Re: What approach changing language with querystring?

    02-18-2008, 4:04 PM

    I think that the best way is using Url ReWrite.

    In this way youll have www.xxx.yy/en , www.xxx.yy/fr, www.xxx.yy/gr etc.

     

    Ok, but in this way you split the number of links to same page in two or tree pieces.

    Imagine if you had a page with one item. If you using the scheme with language code in the URL, then if you have ten links to this page with the item in English and ten pages links to the page in German.

    On the other hand, if you have the same url adress to this page no matter of the language, then you'll have 20 links pointing to this page with the item.

    Which I think will lead to higher page rank.

     
    Am I wrong or am I wright?

     Any suggestions are very welcome.
     

    Best regards,

    Krasimir Evtimov 

  • Re: What approach changing language with querystring?

    02-18-2008, 4:23 PM
    • Loading...
    • Tok Bek
    • Joined on 07-09-2006, 6:27 AM
    • Israel
    • Posts 113

    Maybe, im not an expert to search engines but the link in your Inner links in your app,
    are only 1 parameter to set the page rank.
    All big website do it in this way (even this one), so i guess it is not a problem Smile

    Dont forget to click "Mark as Answer" on the post that helped you
Page 1 of 1 (9 items)
Microsoft Communities
Page view counter