Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Shapper
Guest
 
Posts: n/a
#1: Nov 19 '05
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
Guest
 
Posts: n/a
#2: Nov 19 '05

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


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:OLcVZGZSFHA.3096@TK2MSFTNGP12.phx.gbl...[color=blue]
> 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
>[/color]


TDAVISJR
Guest
 
Posts: n/a
#3: Nov 19 '05

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


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" <nomailreplies@nowhere.com> wrote in message
news:OJGUSjZSFHA.2680@TK2MSFTNGP09.phx.gbl...[color=blue]
> 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:OLcVZGZSFHA.3096@TK2MSFTNGP12.phx.gbl...[color=green]
>> 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
>>[/color]
>
>[/color]


Juan T. Llibre
Guest
 
Posts: n/a
#4: Nov 19 '05

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


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" <anonymous@microsoft.com> wrote in message
news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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" <nomailreplies@nowhere.com> wrote in message
> news:OJGUSjZSFHA.2680@TK2MSFTNGP09.phx.gbl...[color=green]
>> 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:OLcVZGZSFHA.3096@TK2MSFTNGP12.phx.gbl...[color=darkred]
>>> 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
>>>[/color]
>>
>>[/color]
>
>[/color]


TDAVISJR
Guest
 
Posts: n/a
#5: Nov 19 '05

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


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

--
TDAVISJR
aka - Tampa.NET Koder


"Juan T. Llibre" <nomailreplies@nowhere.com> wrote in message
news:ekgvyLaSFHA.204@TK2MSFTNGP15.phx.gbl...[color=blue]
> 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" <anonymous@microsoft.com> wrote in message
> news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl...[color=green]
>> 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" <nomailreplies@nowhere.com> wrote in message
>> news:OJGUSjZSFHA.2680@TK2MSFTNGP09.phx.gbl...[color=darkred]
>>> 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:OLcVZGZSFHA.3096@TK2MSFTNGP12.phx.gbl...
>>>> 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
>>>>
>>>
>>>[/color]
>>
>>[/color]
>
>[/color]


Lucas Tam
Guest
 
Posts: n/a
#6: Nov 19 '05

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


"TDAVISJR" <anonymous@microsoft.com> wrote in
news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl:
[color=blue]
> 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:[/color]

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 (REMOVEnntp@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Shapper
Guest
 
Posts: n/a
#7: Nov 19 '05

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


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" <REMOVEnntp@rogers.com> wrote in message
news:REMOVEnntp@rogers.com:
[color=blue]
> "TDAVISJR" <anonymous@microsoft.com> wrote in
> news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl:
>
>[color=green]
> > 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:[/color]
>
>
> 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 (REMOVEnntp@rogers.com)
> Please delete "REMOVE" from the e-mail address when replying.
> http://members.ebay.com/aboutme/coolspot18/[/color]

Shapper
Guest
 
Posts: n/a
#8: Nov 19 '05

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


Something like this:
http://samples.gotdotnet.com/quickst...s/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" <REMOVEnntp@rogers.com> wrote in message
news:REMOVEnntp@rogers.com:
[color=blue]
> "TDAVISJR" <anonymous@microsoft.com> wrote in
> news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl:
>
>[color=green]
> > 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:[/color]
>
>
> 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 (REMOVEnntp@rogers.com)
> Please delete "REMOVE" from the e-mail address when replying.
> http://members.ebay.com/aboutme/coolspot18/[/color]

Shapper
Guest
 
Posts: n/a
#9: Nov 19 '05

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


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" <REMOVEnntp@rogers.com> wrote in message
news:REMOVEnntp@rogers.com:
[color=blue]
> "TDAVISJR" <anonymous@microsoft.com> wrote in
> news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl:
>
>[color=green]
> > 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:[/color]
>
>
> 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 (REMOVEnntp@rogers.com)
> Please delete "REMOVE" from the e-mail address when replying.
> http://members.ebay.com/aboutme/coolspot18/[/color]

TDAVISJR
Guest
 
Posts: n/a
#10: Nov 19 '05

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


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

http://msdn.microsoft.com/library/de...owsertopic.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:%23u1jwLcSFHA.3944@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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" <REMOVEnntp@rogers.com> wrote in message
> news:REMOVEnntp@rogers.com:
>[color=green]
>> "TDAVISJR" <anonymous@microsoft.com> wrote in
>> news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl:
>>
>>[color=darkred]
>> > 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:[/color]
>>
>>
>> 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 (REMOVEnntp@rogers.com)
>> Please delete "REMOVE" from the e-mail address when replying.
>> http://members.ebay.com/aboutme/coolspot18/[/color]
>[/color]


TDAVISJR
Guest
 
Posts: n/a
#11: Nov 19 '05

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


CODE CORRECTION:

Dim primaryLanguage = userLanguages(0).ToString()

forgot the s on userLanguages


--
TDAVISJR
aka - Tampa.NET Koder


"TDAVISJR" <anonymous@microsoft.com> wrote in message
news:uvPJcvcSFHA.2964@TK2MSFTNGP15.phx.gbl...[color=blue]
> Try looking at the Request.UserLanguages property. Here is the link
>
> http://msdn.microsoft.com/library/de...owsertopic.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:%23u1jwLcSFHA.3944@TK2MSFTNGP10.phx.gbl...[color=green]
>> 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" <REMOVEnntp@rogers.com> wrote in message
>> news:REMOVEnntp@rogers.com:
>>[color=darkred]
>>> "TDAVISJR" <anonymous@microsoft.com> wrote in
>>> news:O5OO58ZSFHA.748@TK2MSFTNGP10.phx.gbl:
>>>
>>>
>>> > 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 (REMOVEnntp@rogers.com)
>>> Please delete "REMOVE" from the e-mail address when replying.
>>> http://members.ebay.com/aboutme/coolspot18/[/color]
>>[/color]
>
>[/color]


Closed Thread