By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 2,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

build a bilingual web?

P: n/a
Hi,

Anybody here has experience to build a english/chinese web?

The chap 15 in Developing Web Applications tells sth about how to do this,
but I want to know more details.

It seems detect and redirect are the way for me to do this. Does this mean I
have to have image button on the main page to link to chinese pages? all
chinese pages will duplicate english ones? the following is from the book,
how to get Request.UserLanguages[0]?

Many thanks. -Dale

private void Page_Load(object sender, System.EventArgs e)
{
// Get the user's preferred language.
string sLang = Request.UserLanguages[0];
// Get the first two characters of language.
sLang = sLang.Substring(0, 2);
// Redirect user based on his/her culture.
switch (sLang)
{
case "en":
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
case "es":
// Use Spanish site.
Response.Redirect("http://www.contoso.com/es");
break;
case "de":
// Use German site.
Response.Redirect("http://www.contoso.com/de");
break;
case "zh":
// Use Chinese site.
Response.Redirect("http://www.contoso.com/zh");
break;
default:
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
}
}
}

Nov 17 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
hi dale,

I think redirecting to different language page is a bad idea uless you have
a different style and content for different languages. The best idea would be
to go for resource file for different languages and setting the cultureinfo
for each language. I have done this for a very big project and i have started
loving ASP.net ever since ;)

cheers!!
pradeep

"dale zhang" wrote:
Hi,

Anybody here has experience to build a english/chinese web?

The chap 15 in Developing Web Applications tells sth about how to do this,
but I want to know more details.

It seems detect and redirect are the way for me to do this. Does this mean I
have to have image button on the main page to link to chinese pages? all
chinese pages will duplicate english ones? the following is from the book,
how to get Request.UserLanguages[0]?

Many thanks. -Dale

private void Page_Load(object sender, System.EventArgs e)
{
// Get the user's preferred language.
string sLang = Request.UserLanguages[0];
// Get the first two characters of language.
sLang = sLang.Substring(0, 2);
// Redirect user based on his/her culture.
switch (sLang)
{
case "en":
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
case "es":
// Use Spanish site.
Response.Redirect("http://www.contoso.com/es");
break;
case "de":
// Use German site.
Response.Redirect("http://www.contoso.com/de");
break;
case "zh":
// Use Chinese site.
Response.Redirect("http://www.contoso.com/zh");
break;
default:
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
}
}
}

Nov 17 '05 #2

P: n/a
Thanks, Pradeep. I agree that resource file is the right approach. Do you
know where I can find a good material to tell me how to do this?


"pradeep_TP" wrote:
hi dale,

I think redirecting to different language page is a bad idea uless you have
a different style and content for different languages. The best idea would be
to go for resource file for different languages and setting the cultureinfo
for each language. I have done this for a very big project and i have started
loving ASP.net ever since ;)

cheers!!
pradeep

"dale zhang" wrote:
Hi,

Anybody here has experience to build a english/chinese web?

The chap 15 in Developing Web Applications tells sth about how to do this,
but I want to know more details.

It seems detect and redirect are the way for me to do this. Does this mean I
have to have image button on the main page to link to chinese pages? all
chinese pages will duplicate english ones? the following is from the book,
how to get Request.UserLanguages[0]?

Many thanks. -Dale

private void Page_Load(object sender, System.EventArgs e)
{
// Get the user's preferred language.
string sLang = Request.UserLanguages[0];
// Get the first two characters of language.
sLang = sLang.Substring(0, 2);
// Redirect user based on his/her culture.
switch (sLang)
{
case "en":
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
case "es":
// Use Spanish site.
Response.Redirect("http://www.contoso.com/es");
break;
case "de":
// Use German site.
Response.Redirect("http://www.contoso.com/de");
break;
case "zh":
// Use Chinese site.
Response.Redirect("http://www.contoso.com/zh");
break;
default:
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
}
}
}

Nov 17 '05 #3

P: n/a
hi dale,

When you think of multilingual in classic ASP context then it is a very
dauting task. But in ASP.net its just a matter of setting the right
clutureinfo. You can go through any web site that gives you informtion on
localizing web pages in ASP.net. The below URL would be a good start for you

http://msdn2.microsoft.com/library/f...us,vs.80).aspx

cheers!!
pradeep_TP

"dale zhang" wrote:
Thanks, Pradeep. I agree that resource file is the right approach. Do you
know where I can find a good material to tell me how to do this?


"pradeep_TP" wrote:
hi dale,

I think redirecting to different language page is a bad idea uless you have
a different style and content for different languages. The best idea would be
to go for resource file for different languages and setting the cultureinfo
for each language. I have done this for a very big project and i have started
loving ASP.net ever since ;)

cheers!!
pradeep

"dale zhang" wrote:
Hi,

Anybody here has experience to build a english/chinese web?

The chap 15 in Developing Web Applications tells sth about how to do this,
but I want to know more details.

It seems detect and redirect are the way for me to do this. Does this mean I
have to have image button on the main page to link to chinese pages? all
chinese pages will duplicate english ones? the following is from the book,
how to get Request.UserLanguages[0]?

Many thanks. -Dale

private void Page_Load(object sender, System.EventArgs e)
{
// Get the user's preferred language.
string sLang = Request.UserLanguages[0];
// Get the first two characters of language.
sLang = sLang.Substring(0, 2);
// Redirect user based on his/her culture.
switch (sLang)
{
case "en":
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
case "es":
// Use Spanish site.
Response.Redirect("http://www.contoso.com/es");
break;
case "de":
// Use German site.
Response.Redirect("http://www.contoso.com/de");
break;
case "zh":
// Use Chinese site.
Response.Redirect("http://www.contoso.com/zh");
break;
default:
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
}
}
}

Nov 17 '05 #4

P: n/a
hi dale,

When you think of multilingual in classic ASP context then it is a very
dauting task. But in ASP.net its just a matter of setting the right
clutureinfo. You can go through any web site that gives you informtion on
localizing web pages in ASP.net. The below URL would be a good start for you

http://msdn2.microsoft.com/library/f...us,vs.80).aspx

cheers!!
pradeep_TP

"dale zhang" wrote:
Thanks, Pradeep. I agree that resource file is the right approach. Do you
know where I can find a good material to tell me how to do this?


"pradeep_TP" wrote:
hi dale,

I think redirecting to different language page is a bad idea uless you have
a different style and content for different languages. The best idea would be
to go for resource file for different languages and setting the cultureinfo
for each language. I have done this for a very big project and i have started
loving ASP.net ever since ;)

cheers!!
pradeep

"dale zhang" wrote:
Hi,

Anybody here has experience to build a english/chinese web?

The chap 15 in Developing Web Applications tells sth about how to do this,
but I want to know more details.

It seems detect and redirect are the way for me to do this. Does this mean I
have to have image button on the main page to link to chinese pages? all
chinese pages will duplicate english ones? the following is from the book,
how to get Request.UserLanguages[0]?

Many thanks. -Dale

private void Page_Load(object sender, System.EventArgs e)
{
// Get the user's preferred language.
string sLang = Request.UserLanguages[0];
// Get the first two characters of language.
sLang = sLang.Substring(0, 2);
// Redirect user based on his/her culture.
switch (sLang)
{
case "en":
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
case "es":
// Use Spanish site.
Response.Redirect("http://www.contoso.com/es");
break;
case "de":
// Use German site.
Response.Redirect("http://www.contoso.com/de");
break;
case "zh":
// Use Chinese site.
Response.Redirect("http://www.contoso.com/zh");
break;
default:
// Use US site.
Response.Redirect("http://www.contoso.com/usa");
break;
}
}
}

Nov 17 '05 #5

P: n/a
Hi Pradeep,

Thanks for the link. It is really good. based on that, i tried to do this by:
1. go to a designer page
2. on the tools menu, click Generat Local Resource.

I looked around, could not find Generat Local Resource in 2003 VS.

Do I have to do this in 2005 VS?

Thanks. -Dale

"pradeep_TP" wrote:
hi dale,

When you think of multilingual in classic ASP context then it is a very
dauting task. But in ASP.net its just a matter of setting the right
clutureinfo. You can go through any web site that gives you informtion on
localizing web pages in ASP.net. The below URL would be a good start for you

http://msdn2.microsoft.com/library/f...us,vs.80).aspx

cheers!!
pradeep_TP

"dale zhang" wrote:
Thanks, Pradeep. I agree that resource file is the right approach. Do you
know where I can find a good material to tell me how to do this?


"pradeep_TP" wrote:
hi dale,

I think redirecting to different language page is a bad idea uless you have
a different style and content for different languages. The best idea would be
to go for resource file for different languages and setting the cultureinfo
for each language. I have done this for a very big project and i have started
loving ASP.net ever since ;)

cheers!!
pradeep

"dale zhang" wrote:

> Hi,
>
> Anybody here has experience to build a english/chinese web?
>
> The chap 15 in Developing Web Applications tells sth about how to do this,
> but I want to know more details.
>
> It seems detect and redirect are the way for me to do this. Does this mean I
> have to have image button on the main page to link to chinese pages? all
> chinese pages will duplicate english ones? the following is from the book,
> how to get Request.UserLanguages[0]?
>
> Many thanks. -Dale
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Get the user's preferred language.
> string sLang = Request.UserLanguages[0];
> // Get the first two characters of language.
> sLang = sLang.Substring(0, 2);
> // Redirect user based on his/her culture.
> switch (sLang)
> {
> case "en":
> // Use US site.
> Response.Redirect("http://www.contoso.com/usa");
> break;
> case "es":
> // Use Spanish site.
> Response.Redirect("http://www.contoso.com/es");
> break;
> case "de":
> // Use German site.
> Response.Redirect("http://www.contoso.com/de");
> break;
> case "zh":
> // Use Chinese site.
> Response.Redirect("http://www.contoso.com/zh");
> break;
> default:
> // Use US site.
> Response.Redirect("http://www.contoso.com/usa");
> break;
> }
> }
> }
>

Nov 17 '05 #6

P: n/a
Hi Pradeep,

Thanks for the link. It is really good. based on that, i tried to do this by:
1. go to a designer page
2. on the tools menu, click Generat Local Resource.

I looked around, could not find Generat Local Resource in 2003 VS.

Do I have to do this in 2005 VS?

Thanks. -Dale

"pradeep_TP" wrote:
hi dale,

When you think of multilingual in classic ASP context then it is a very
dauting task. But in ASP.net its just a matter of setting the right
clutureinfo. You can go through any web site that gives you informtion on
localizing web pages in ASP.net. The below URL would be a good start for you

http://msdn2.microsoft.com/library/f...us,vs.80).aspx

cheers!!
pradeep_TP

"dale zhang" wrote:
Thanks, Pradeep. I agree that resource file is the right approach. Do you
know where I can find a good material to tell me how to do this?


"pradeep_TP" wrote:
hi dale,

I think redirecting to different language page is a bad idea uless you have
a different style and content for different languages. The best idea would be
to go for resource file for different languages and setting the cultureinfo
for each language. I have done this for a very big project and i have started
loving ASP.net ever since ;)

cheers!!
pradeep

"dale zhang" wrote:

> Hi,
>
> Anybody here has experience to build a english/chinese web?
>
> The chap 15 in Developing Web Applications tells sth about how to do this,
> but I want to know more details.
>
> It seems detect and redirect are the way for me to do this. Does this mean I
> have to have image button on the main page to link to chinese pages? all
> chinese pages will duplicate english ones? the following is from the book,
> how to get Request.UserLanguages[0]?
>
> Many thanks. -Dale
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Get the user's preferred language.
> string sLang = Request.UserLanguages[0];
> // Get the first two characters of language.
> sLang = sLang.Substring(0, 2);
> // Redirect user based on his/her culture.
> switch (sLang)
> {
> case "en":
> // Use US site.
> Response.Redirect("http://www.contoso.com/usa");
> break;
> case "es":
> // Use Spanish site.
> Response.Redirect("http://www.contoso.com/es");
> break;
> case "de":
> // Use German site.
> Response.Redirect("http://www.contoso.com/de");
> break;
> case "zh":
> // Use Chinese site.
> Response.Redirect("http://www.contoso.com/zh");
> break;
> default:
> // Use US site.
> Response.Redirect("http://www.contoso.com/usa");
> break;
> }
> }
> }
>

Nov 17 '05 #7

P: n/a
hi dale,

I am using visual studio 2003, with .net 1.1. Here is what I do to compile
the resource file. I use a bach file to compile the resource file. You can
paste the code below in a batch file for eg. res.bat and run the batch file
from the command prompt

PATH %WINDIR%\Microsoft.NET\Framework\v1.1.4322;%PATH%

resgen testrest.en-US.resx al
/embed:testrest.en-US.resources,testrest.en-US.resources
/out:testrest.resources.dll /c:en-US

resgen is a utility which you can find under the folder where .net framework
is installed. You can read more about resgen utility by just typing resgen at
the command prompt.

cheers
pradeep_tp
"dale zhang" wrote:
Hi Pradeep,

Thanks for the link. It is really good. based on that, i tried to do this by:
1. go to a designer page
2. on the tools menu, click Generat Local Resource.

I looked around, could not find Generat Local Resource in 2003 VS.

Do I have to do this in 2005 VS?

Thanks. -Dale

"pradeep_TP" wrote:
hi dale,

When you think of multilingual in classic ASP context then it is a very
dauting task. But in ASP.net its just a matter of setting the right
clutureinfo. You can go through any web site that gives you informtion on
localizing web pages in ASP.net. The below URL would be a good start for you

http://msdn2.microsoft.com/library/f...us,vs.80).aspx

cheers!!
pradeep_TP

"dale zhang" wrote:
Thanks, Pradeep. I agree that resource file is the right approach. Do you
know where I can find a good material to tell me how to do this?


"pradeep_TP" wrote:

> hi dale,
>
> I think redirecting to different language page is a bad idea uless you have
> a different style and content for different languages. The best idea would be
> to go for resource file for different languages and setting the cultureinfo
> for each language. I have done this for a very big project and i have started
> loving ASP.net ever since ;)
>
> cheers!!
> pradeep
>
> "dale zhang" wrote:
>
> > Hi,
> >
> > Anybody here has experience to build a english/chinese web?
> >
> > The chap 15 in Developing Web Applications tells sth about how to do this,
> > but I want to know more details.
> >
> > It seems detect and redirect are the way for me to do this. Does this mean I
> > have to have image button on the main page to link to chinese pages? all
> > chinese pages will duplicate english ones? the following is from the book,
> > how to get Request.UserLanguages[0]?
> >
> > Many thanks. -Dale
> >
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > // Get the user's preferred language.
> > string sLang = Request.UserLanguages[0];
> > // Get the first two characters of language.
> > sLang = sLang.Substring(0, 2);
> > // Redirect user based on his/her culture.
> > switch (sLang)
> > {
> > case "en":
> > // Use US site.
> > Response.Redirect("http://www.contoso.com/usa");
> > break;
> > case "es":
> > // Use Spanish site.
> > Response.Redirect("http://www.contoso.com/es");
> > break;
> > case "de":
> > // Use German site.
> > Response.Redirect("http://www.contoso.com/de");
> > break;
> > case "zh":
> > // Use Chinese site.
> > Response.Redirect("http://www.contoso.com/zh");
> > break;
> > default:
> > // Use US site.
> > Response.Redirect("http://www.contoso.com/usa");
> > break;
> > }
> > }
> > }
> >

Nov 17 '05 #8

P: n/a
hi dale,

I am using visual studio 2003, with .net 1.1. Here is what I do to compile
the resource file. I use a bach file to compile the resource file. You can
paste the code below in a batch file for eg. res.bat and run the batch file
from the command prompt

PATH %WINDIR%\Microsoft.NET\Framework\v1.1.4322;%PATH%

resgen testrest.en-US.resx al
/embed:testrest.en-US.resources,testrest.en-US.resources
/out:testrest.resources.dll /c:en-US

resgen is a utility which you can find under the folder where .net framework
is installed. You can read more about resgen utility by just typing resgen at
the command prompt.

cheers
pradeep_tp
"dale zhang" wrote:
Hi Pradeep,

Thanks for the link. It is really good. based on that, i tried to do this by:
1. go to a designer page
2. on the tools menu, click Generat Local Resource.

I looked around, could not find Generat Local Resource in 2003 VS.

Do I have to do this in 2005 VS?

Thanks. -Dale

"pradeep_TP" wrote:
hi dale,

When you think of multilingual in classic ASP context then it is a very
dauting task. But in ASP.net its just a matter of setting the right
clutureinfo. You can go through any web site that gives you informtion on
localizing web pages in ASP.net. The below URL would be a good start for you

http://msdn2.microsoft.com/library/f...us,vs.80).aspx

cheers!!
pradeep_TP

"dale zhang" wrote:
Thanks, Pradeep. I agree that resource file is the right approach. Do you
know where I can find a good material to tell me how to do this?


"pradeep_TP" wrote:

> hi dale,
>
> I think redirecting to different language page is a bad idea uless you have
> a different style and content for different languages. The best idea would be
> to go for resource file for different languages and setting the cultureinfo
> for each language. I have done this for a very big project and i have started
> loving ASP.net ever since ;)
>
> cheers!!
> pradeep
>
> "dale zhang" wrote:
>
> > Hi,
> >
> > Anybody here has experience to build a english/chinese web?
> >
> > The chap 15 in Developing Web Applications tells sth about how to do this,
> > but I want to know more details.
> >
> > It seems detect and redirect are the way for me to do this. Does this mean I
> > have to have image button on the main page to link to chinese pages? all
> > chinese pages will duplicate english ones? the following is from the book,
> > how to get Request.UserLanguages[0]?
> >
> > Many thanks. -Dale
> >
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > // Get the user's preferred language.
> > string sLang = Request.UserLanguages[0];
> > // Get the first two characters of language.
> > sLang = sLang.Substring(0, 2);
> > // Redirect user based on his/her culture.
> > switch (sLang)
> > {
> > case "en":
> > // Use US site.
> > Response.Redirect("http://www.contoso.com/usa");
> > break;
> > case "es":
> > // Use Spanish site.
> > Response.Redirect("http://www.contoso.com/es");
> > break;
> > case "de":
> > // Use German site.
> > Response.Redirect("http://www.contoso.com/de");
> > break;
> > case "zh":
> > // Use Chinese site.
> > Response.Redirect("http://www.contoso.com/zh");
> > break;
> > default:
> > // Use US site.
> > Response.Redirect("http://www.contoso.com/usa");
> > break;
> > }
> > }
> > }
> >

Nov 17 '05 #9

P: n/a
Hi Pradeep,

Thank you for your support. I got them working. It is great. I start to love
..net now:-).

One more concern: I read MSDN about this topic. They said that automatic
pick up language from IE (ie. Request.UserLanguages[0]) may not be reliable.
We should always add button to allow users to manually select language. Is
this still true? I can see some people in china may have "zh" in IE, others
may have "zh-cn" in IE. So my code should handle those by setting my lang to
zh-cn and save it to a session variable if user select Chinese button
manually?
When I test default selection (ie. I do not string for "zh", but IE returns
"zh"), the code should go to default lang based on MSDN if I do not have the
selection. But my code returns error to complain I do not have string for
"zh". Is this right? If so, I need to enhance my code to handle the case.
Thanks. -Dale
"pradeep_TP" wrote:
hi dale,

I am using visual studio 2003, with .net 1.1. Here is what I do to compile
the resource file. I use a bach file to compile the resource file. You can
paste the code below in a batch file for eg. res.bat and run the batch file
from the command prompt

PATH %WINDIR%\Microsoft.NET\Framework\v1.1.4322;%PATH%

resgen testrest.en-US.resx al
/embed:testrest.en-US.resources,testrest.en-US.resources
/out:testrest.resources.dll /c:en-US

resgen is a utility which you can find under the folder where .net framework
is installed. You can read more about resgen utility by just typing resgen at
the command prompt.

cheers
pradeep_tp
"dale zhang" wrote:
Hi Pradeep,

Thanks for the link. It is really good. based on that, i tried to do this by:
1. go to a designer page
2. on the tools menu, click Generat Local Resource.

I looked around, could not find Generat Local Resource in 2003 VS.

Do I have to do this in 2005 VS?

Thanks. -Dale

"pradeep_TP" wrote:
hi dale,

When you think of multilingual in classic ASP context then it is a very
dauting task. But in ASP.net its just a matter of setting the right
clutureinfo. You can go through any web site that gives you informtion on
localizing web pages in ASP.net. The below URL would be a good start for you

http://msdn2.microsoft.com/library/f...us,vs.80).aspx

cheers!!
pradeep_TP

"dale zhang" wrote:

> Thanks, Pradeep. I agree that resource file is the right approach. Do you
> know where I can find a good material to tell me how to do this?
>
>
>
>
> "pradeep_TP" wrote:
>
> > hi dale,
> >
> > I think redirecting to different language page is a bad idea uless you have
> > a different style and content for different languages. The best idea would be
> > to go for resource file for different languages and setting the cultureinfo
> > for each language. I have done this for a very big project and i have started
> > loving ASP.net ever since ;)
> >
> > cheers!!
> > pradeep
> >
> > "dale zhang" wrote:
> >
> > > Hi,
> > >
> > > Anybody here has experience to build a english/chinese web?
> > >
> > > The chap 15 in Developing Web Applications tells sth about how to do this,
> > > but I want to know more details.
> > >
> > > It seems detect and redirect are the way for me to do this. Does this mean I
> > > have to have image button on the main page to link to chinese pages? all
> > > chinese pages will duplicate english ones? the following is from the book,
> > > how to get Request.UserLanguages[0]?
> > >
> > > Many thanks. -Dale
> > >
> > > private void Page_Load(object sender, System.EventArgs e)
> > > {
> > > // Get the user's preferred language.
> > > string sLang = Request.UserLanguages[0];
> > > // Get the first two characters of language.
> > > sLang = sLang.Substring(0, 2);
> > > // Redirect user based on his/her culture.
> > > switch (sLang)
> > > {
> > > case "en":
> > > // Use US site.
> > > Response.Redirect("http://www.contoso.com/usa");
> > > break;
> > > case "es":
> > > // Use Spanish site.
> > > Response.Redirect("http://www.contoso.com/es");
> > > break;
> > > case "de":
> > > // Use German site.
> > > Response.Redirect("http://www.contoso.com/de");
> > > break;
> > > case "zh":
> > > // Use Chinese site.
> > > Response.Redirect("http://www.contoso.com/zh");
> > > break;
> > > default:
> > > // Use US site.
> > > Response.Redirect("http://www.contoso.com/usa");
> > > break;
> > > }
> > > }
> > > }
> > >

Nov 17 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.