How to create a 2 languages web site? Thank You.

Discussion in 'ASP .Net' started by Shapper, Apr 25, 2005.

  1. Shapper

    Shapper Guest

    Hello,

    I am working on an ASP.NET / VB web site and I need to have 2 versions:
    In English and French.

    I could create two versions of the web site by duplicating all the
    pages. Is that the right way?

    All my contents come from a database so I can duplicate the the fields
    so I can have 2 language content.

    I also have a "French Version" or an "English Version" button in my
    page. It should show only one.

    Thank You,
    Miguel
     
    Shapper, Apr 25, 2005
    #1
    1. Advertising

  2. Read Karl Seguin's excellent tutorial at :

    http://www.openmymind.net/MyArticles.aspx?documentId=3
    http://www.openmymind.net/MyArticles.aspx?documentId=4



    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    news:...
    > Hello,
    >
    > I am working on an ASP.NET / VB web site and I need to have 2 versions: In English and
    > French.
    >
    > I could create two versions of the web site by duplicating all the pages. Is that the
    > right way?
    >
    > All my contents come from a database so I can duplicate the the fields so I can have 2
    > language content.
    >
    > I also have a "French Version" or an "English Version" button in my page. It should show
    > only one.
    >
    > Thank You,
    > Miguel
    >
     
    Juan T. Llibre, Apr 25, 2005
    #2
    1. Advertising

  3. Shapper

    TDAVISJR Guest

    There is another method that seems to be much simpler. Doing it all with
    user controls and dynamically loading them at runtime. This is the baisc
    concept. You have 2 languages say english and french. You will have the
    directory structure of:

    MyWebsite
    en (text in english)
    header.ascx
    |_ header.ascx.vb
    content.ascx
    |_ content.ascx.vb
    footer.ascx
    |_ footer.ascx.vb

    fr (text in french)
    header.ascx
    content.ascx
    footer.ascx

    default.aspx
    contentpage1.aspx

    So, in the default.aspx you can ask the user which language they want. Then
    store their language either in a persistant cookie or in a session variable.
    Depending on what language they choose, dynamically load the user controls
    from the folders that has the english or french in the contentpage1.aspx
    page. One thing to note. Only the en foder will have the ascx file and the
    ascx.vb codebehind file all the other languages will just have the ascx
    file. The idea is that each of the usercontrols under each language folder
    will have the EXACT same server contols or controls with the EXACT same name
    in the ascx file. So, in the @Control directive at the top of the
    usercontrol in source view you can tell it that it inherits from the ascx.vb
    files located under the english folder. I guess its more to it than that
    but this is a very easy way to get going if you need a more simpler
    approach.

    --
    TDAVISJR
    aka - Tampa.NET Koder


    "Juan T. Llibre" <> wrote in message
    news:...
    > Read Karl Seguin's excellent tutorial at :
    >
    > http://www.openmymind.net/MyArticles.aspx?documentId=3
    > http://www.openmymind.net/MyArticles.aspx?documentId=4
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    > news:...
    >> Hello,
    >>
    >> I am working on an ASP.NET / VB web site and I need to have 2 versions:
    >> In English and French.
    >>
    >> I could create two versions of the web site by duplicating all the pages.
    >> Is that the right way?
    >>
    >> All my contents come from a database so I can duplicate the the fields so
    >> I can have 2 language content.
    >>
    >> I also have a "French Version" or an "English Version" button in my page.
    >> It should show only one.
    >>
    >> Thank You,
    >> Miguel
    >>

    >
    >
     
    TDAVISJR, Apr 25, 2005
    #3
  4. That's simpler ? ( Only half-kidding... )

    If you're going to go that way, you don't even have to
    store the language preference to get the job done.

    Just redirecting to the appropiate language directory
    will suffice, if you use relative URLs in the app.

    I think the idea is to *avoid* having a duplicated directory
    for each and every language you use, since that becomes
    quite unmanageable, fast, as you add languages.

    A slightly different approach would be to use XML files,
    or database tables, for the different language contents.

    It would be like creating a different "skin" for each language.

    That's much easier to manage, from a data storage point of view.

    I'd rather have a different XML file with all the localized strings,
    or a different database column with all the localized strings,
    than having different files, ascx controls, etc. for each language.



    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "TDAVISJR" <> wrote in message
    news:...
    > There is another method that seems to be much simpler. Doing it all with user controls
    > and dynamically loading them at runtime. This is the baisc concept. You have 2
    > languages say english and french. You will have the directory structure of:
    >
    > MyWebsite
    > en (text in english)
    > header.ascx
    > |_ header.ascx.vb
    > content.ascx
    > |_ content.ascx.vb
    > footer.ascx
    > |_ footer.ascx.vb
    >
    > fr (text in french)
    > header.ascx
    > content.ascx
    > footer.ascx
    >
    > default.aspx
    > contentpage1.aspx
    >
    > So, in the default.aspx you can ask the user which language they want. Then store their
    > language either in a persistant cookie or in a session variable. Depending on what
    > language they choose, dynamically load the user controls from the folders that has the
    > english or french in the contentpage1.aspx page. One thing to note. Only the en foder
    > will have the ascx file and the ascx.vb codebehind file all the other languages will
    > just have the ascx file. The idea is that each of the usercontrols under each language
    > folder will have the EXACT same server contols or controls with the EXACT same name in
    > the ascx file. So, in the @Control directive at the top of the usercontrol in source
    > view you can tell it that it inherits from the ascx.vb files located under the english
    > folder. I guess its more to it than that but this is a very easy way to get going if
    > you need a more simpler approach.
    >
    > --
    > TDAVISJR
    > aka - Tampa.NET Koder
    >
    >
    > "Juan T. Llibre" <> wrote in message
    > news:...
    >> Read Karl Seguin's excellent tutorial at :
    >>
    >> http://www.openmymind.net/MyArticles.aspx?documentId=3
    >> http://www.openmymind.net/MyArticles.aspx?documentId=4
    >>
    >>
    >>
    >> Juan T. Llibre
    >> ASP.NET MVP
    >> http://asp.net.do/foros/
    >> Foros de ASP.NET en Español
    >> Ven, y hablemos de ASP.NET...
    >> ======================
    >>
    >> "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    >> news:...
    >>> Hello,
    >>>
    >>> I am working on an ASP.NET / VB web site and I need to have 2 versions: In English and
    >>> French.
    >>>
    >>> I could create two versions of the web site by duplicating all the pages. Is that the
    >>> right way?
    >>>
    >>> All my contents come from a database so I can duplicate the the fields so I can have 2
    >>> language content.
    >>>
    >>> I also have a "French Version" or an "English Version" button in my page. It should
    >>> show only one.
    >>>
    >>> Thank You,
    >>> Miguel
    >>>

    >>
    >>

    >
    >
     
    Juan T. Llibre, Apr 25, 2005
    #4
  5. Shapper

    TDAVISJR Guest

    fair enough. what ever gets the job done! :)

    --
    TDAVISJR
    aka - Tampa.NET Koder


    "Juan T. Llibre" <> wrote in message
    news:...
    > That's simpler ? ( Only half-kidding... )
    >
    > If you're going to go that way, you don't even have to
    > store the language preference to get the job done.
    >
    > Just redirecting to the appropiate language directory
    > will suffice, if you use relative URLs in the app.
    >
    > I think the idea is to *avoid* having a duplicated directory
    > for each and every language you use, since that becomes
    > quite unmanageable, fast, as you add languages.
    >
    > A slightly different approach would be to use XML files,
    > or database tables, for the different language contents.
    >
    > It would be like creating a different "skin" for each language.
    >
    > That's much easier to manage, from a data storage point of view.
    >
    > I'd rather have a different XML file with all the localized strings,
    > or a different database column with all the localized strings,
    > than having different files, ascx controls, etc. for each language.
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > "TDAVISJR" <> wrote in message
    > news:...
    >> There is another method that seems to be much simpler. Doing it all with
    >> user controls and dynamically loading them at runtime. This is the baisc
    >> concept. You have 2 languages say english and french. You will have the
    >> directory structure of:
    >>
    >> MyWebsite
    >> en (text in english)
    >> header.ascx
    >> |_ header.ascx.vb
    >> content.ascx
    >> |_ content.ascx.vb
    >> footer.ascx
    >> |_ footer.ascx.vb
    >>
    >> fr (text in french)
    >> header.ascx
    >> content.ascx
    >> footer.ascx
    >>
    >> default.aspx
    >> contentpage1.aspx
    >>
    >> So, in the default.aspx you can ask the user which language they want.
    >> Then store their language either in a persistant cookie or in a session
    >> variable. Depending on what language they choose, dynamically load the
    >> user controls from the folders that has the english or french in the
    >> contentpage1.aspx page. One thing to note. Only the en foder will have
    >> the ascx file and the ascx.vb codebehind file all the other languages
    >> will just have the ascx file. The idea is that each of the usercontrols
    >> under each language folder will have the EXACT same server contols or
    >> controls with the EXACT same name in the ascx file. So, in the @Control
    >> directive at the top of the usercontrol in source view you can tell it
    >> that it inherits from the ascx.vb files located under the english folder.
    >> I guess its more to it than that but this is a very easy way to get going
    >> if you need a more simpler approach.
    >>
    >> --
    >> TDAVISJR
    >> aka - Tampa.NET Koder
    >>
    >>
    >> "Juan T. Llibre" <> wrote in message
    >> news:...
    >>> Read Karl Seguin's excellent tutorial at :
    >>>
    >>> http://www.openmymind.net/MyArticles.aspx?documentId=3
    >>> http://www.openmymind.net/MyArticles.aspx?documentId=4
    >>>
    >>>
    >>>
    >>> Juan T. Llibre
    >>> ASP.NET MVP
    >>> http://asp.net.do/foros/
    >>> Foros de ASP.NET en Español
    >>> Ven, y hablemos de ASP.NET...
    >>> ======================
    >>>
    >>> "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    >>> news:...
    >>>> Hello,
    >>>>
    >>>> I am working on an ASP.NET / VB web site and I need to have 2 versions:
    >>>> In English and French.
    >>>>
    >>>> I could create two versions of the web site by duplicating all the
    >>>> pages. Is that the right way?
    >>>>
    >>>> All my contents come from a database so I can duplicate the the fields
    >>>> so I can have 2 language content.
    >>>>
    >>>> I also have a "French Version" or an "English Version" button in my
    >>>> page. It should show only one.
    >>>>
    >>>> Thank You,
    >>>> Miguel
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    TDAVISJR, Apr 25, 2005
    #5
  6. Shapper

    Lucas Tam Guest

    "TDAVISJR" <> wrote in
    news::

    > There is another method that seems to be much simpler. Doing it all
    > with user controls and dynamically loading them at runtime. This is
    > the baisc concept. You have 2 languages say english and french. You
    > will have the directory structure of:


    It maybe simpler to build, but maintaince would be a nightmare. You have 2x
    the amount of code to fix.

    Image if you had to do a site redesign... You'll have to edit 2 sets of
    tempaltes ; )

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Apr 25, 2005
    #6
  7. Shapper

    Shapper Guest

    Hello,

    I have been reading all the help you sent me.

    According to language I have to distinguish the following:
    1. Menu Images Buttons.
    2. Content from Database (Note. All the content is taken from a
    database)
    3. Other elements like input text box labels.

    The solution I came up:
    1. Images
    I will create N folders the following way:
    images/culture/... (Example: images/en-us)

    And a common folder such as:
    images/common/...

    2. Database
    I will have fields for each culture.
    Example: (title_en-us) and (title_pt-pt)

    3. For elements like input text box labels I can even create a small
    function with cases which uses one text label or the other.
    Or I can place the entire content in the database.

    What do you think about this?

    I am working in ASP.NET/VB and with Web Matrix.
    I have 1 button in my web site which can show "French Version" or
    "English Version". I know that I could set a cookie, URL parameter or
    Session variable to set which version the user is using.

    However I think this must be done in other way. This is what I don't
    understand very well in the documents I read until now.

    How can I determine which culture the user is using, how can I get it's
    value in my page and how can I change when I user clicks a button?

    Thanks,
    Miguel




    "Lucas Tam" <> wrote in message
    news::

    > "TDAVISJR" <> wrote in
    > news::
    >
    >
    > > There is another method that seems to be much simpler. Doing it all
    > > with user controls and dynamically loading them at runtime. This is
    > > the baisc concept. You have 2 languages say english and french. You
    > > will have the directory structure of:

    >
    >
    > It maybe simpler to build, but maintaince would be a nightmare. You have 2x
    > the amount of code to fix.
    >
    > Image if you had to do a site redesign... You'll have to edit 2 sets of
    > tempaltes ; )
    >
    > --
    > Lucas Tam ()
    > Please delete "REMOVE" from the e-mail address when replying.
    > http://members.ebay.com/aboutme/coolspot18/
     
    Shapper, Apr 25, 2005
    #7
  8. Shapper

    Shapper Guest

    Something like this:
    http://samples.gotdotnet.com/quickstart/aspplus/samples/localize/resources/News/VB/news.aspx

    Please if someone could indicate me some steps.
    I am starting at this and it's getting really confusing. :)

    Thanks,
    Miguel

    "Lucas Tam" <> wrote in message
    news::

    > "TDAVISJR" <> wrote in
    > news::
    >
    >
    > > There is another method that seems to be much simpler. Doing it all
    > > with user controls and dynamically loading them at runtime. This is
    > > the baisc concept. You have 2 languages say english and french. You
    > > will have the directory structure of:

    >
    >
    > It maybe simpler to build, but maintaince would be a nightmare. You have 2x
    > the amount of code to fix.
    >
    > Image if you had to do a site redesign... You'll have to edit 2 sets of
    > tempaltes ; )
    >
    > --
    > Lucas Tam ()
    > Please delete "REMOVE" from the e-mail address when replying.
    > http://members.ebay.com/aboutme/coolspot18/
     
    Shapper, Apr 25, 2005
    #8
  9. Shapper

    Shapper Guest

    Hi Again,

    As far as I can see in the global.asax I can set:
    1. Set the culture based on browser
    2. Set a default culture

    But how to I get the info in a page in which a culture is used?

    Cheers,
    Miguel

    "Lucas Tam" <> wrote in message
    news::

    > "TDAVISJR" <> wrote in
    > news::
    >
    >
    > > There is another method that seems to be much simpler. Doing it all
    > > with user controls and dynamically loading them at runtime. This is
    > > the baisc concept. You have 2 languages say english and french. You
    > > will have the directory structure of:

    >
    >
    > It maybe simpler to build, but maintaince would be a nightmare. You have 2x
    > the amount of code to fix.
    >
    > Image if you had to do a site redesign... You'll have to edit 2 sets of
    > tempaltes ; )
    >
    > --
    > Lucas Tam ()
    > Please delete "REMOVE" from the e-mail address when replying.
    > http://members.ebay.com/aboutme/coolspot18/
     
    Shapper, Apr 25, 2005
    #9
  10. Shapper

    TDAVISJR Guest

    Try looking at the Request.UserLanguages property. Here is the link

    http://msdn.microsoft.com/library/d...rlrfsystemwebhttprequestclassbrowsertopic.asp

    The property returns a string array of user languages preferences set in the
    browser. To obtain the primary preference, I guess you can do something
    like this:

    Dim userLanguages as String() = Request.UserLanguages
    Dim primaryLanguage = userLanguage(0).ToString()

    I have not tested; but I have to you the link to the Documentation. I hope
    this helps.





    --
    TDAVISJR
    aka - Tampa.NET Koder


    "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    news:%...
    > Hi Again,
    >
    > As far as I can see in the global.asax I can set:
    > 1. Set the culture based on browser
    > 2. Set a default culture
    >
    > But how to I get the info in a page in which a culture is used?
    >
    > Cheers,
    > Miguel
    >
    > "Lucas Tam" <> wrote in message
    > news::
    >
    >> "TDAVISJR" <> wrote in
    >> news::
    >>
    >>
    >> > There is another method that seems to be much simpler. Doing it all
    >> > with user controls and dynamically loading them at runtime. This is
    >> > the baisc concept. You have 2 languages say english and french. You
    >> > will have the directory structure of:

    >>
    >>
    >> It maybe simpler to build, but maintaince would be a nightmare. You have
    >> 2x
    >> the amount of code to fix.
    >>
    >> Image if you had to do a site redesign... You'll have to edit 2 sets of
    >> tempaltes ; )
    >>
    >> --
    >> Lucas Tam ()
    >> Please delete "REMOVE" from the e-mail address when replying.
    >> http://members.ebay.com/aboutme/coolspot18/

    >
     
    TDAVISJR, Apr 25, 2005
    #10
  11. Shapper

    TDAVISJR Guest

    CODE CORRECTION:

    Dim primaryLanguage = userLanguages(0).ToString()

    forgot the s on userLanguages


    --
    TDAVISJR
    aka - Tampa.NET Koder


    "TDAVISJR" <> wrote in message
    news:...
    > Try looking at the Request.UserLanguages property. Here is the link
    >
    > http://msdn.microsoft.com/library/d...rlrfsystemwebhttprequestclassbrowsertopic.asp
    >
    > The property returns a string array of user languages preferences set in
    > the browser. To obtain the primary preference, I guess you can do
    > something like this:
    >
    > Dim userLanguages as String() = Request.UserLanguages
    > Dim primaryLanguage = userLanguage(0).ToString()
    >
    > I have not tested; but I have to you the link to the Documentation. I
    > hope this helps.
    >
    >
    >
    >
    >
    > --
    > TDAVISJR
    > aka - Tampa.NET Koder
    >
    >
    > "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    > news:%...
    >> Hi Again,
    >>
    >> As far as I can see in the global.asax I can set:
    >> 1. Set the culture based on browser
    >> 2. Set a default culture
    >>
    >> But how to I get the info in a page in which a culture is used?
    >>
    >> Cheers,
    >> Miguel
    >>
    >> "Lucas Tam" <> wrote in message
    >> news::
    >>
    >>> "TDAVISJR" <> wrote in
    >>> news::
    >>>
    >>>
    >>> > There is another method that seems to be much simpler. Doing it all
    >>> > with user controls and dynamically loading them at runtime. This is
    >>> > the baisc concept. You have 2 languages say english and french. You
    >>> > will have the directory structure of:
    >>>
    >>>
    >>> It maybe simpler to build, but maintaince would be a nightmare. You have
    >>> 2x
    >>> the amount of code to fix.
    >>>
    >>> Image if you had to do a site redesign... You'll have to edit 2 sets of
    >>> tempaltes ; )
    >>>
    >>> --
    >>> Lucas Tam ()
    >>> Please delete "REMOVE" from the e-mail address when replying.
    >>> http://members.ebay.com/aboutme/coolspot18/

    >>

    >
    >
     
    TDAVISJR, Apr 25, 2005
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miguel Dias Moura
    Replies:
    1
    Views:
    422
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Apr 1, 2004
  2. Miguel Dias Moura
    Replies:
    1
    Views:
    374
    Cor Ligthert
    Apr 12, 2004
  3. Miguel Dias Moura
    Replies:
    1
    Views:
    438
    Lars Netzel
    Jun 18, 2004
  4. Miguel Dias Moura
    Replies:
    2
    Views:
    369
    Martin
    Jun 22, 2004
  5. Shawn
    Replies:
    8
    Views:
    406
    Shawn
    Sep 21, 2006
Loading...

Share This Page