建立双语网络? [英] build a bilingual web?

查看:61
本文介绍了建立双语网络?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这里有人有建立英文/中文网页的经验吗?


开发Web应用程序的第15章告诉某人关于如何做到这一点,

但我想知道更多细节。


似乎检测和重定向是我这样做的方式。这是否意味着我需要在主页上有图像按钮链接到中文页面?所有

中文页面会复制英文页面吗?以下是从书中,

如何获得Request.UserLanguages [0]?


非常感谢。 -Dale


private void Page_Load(object sender,System.EventArgs e)

{

//获取用户''首选语言。

string sLang = Request.UserLanguages [0];

//获取语言的前两个字符。

sLang = sLang.Substring(0,2);

//根据他/她的文化重定向用户。

开关(sLang)

{

case" en":

//使用美国网站。

Response.Redirect(" http://www.contoso.com / usa");

休息;

case" es":

//使用西班牙语网站。

Response.Redirect(" http://www.contoso.com/es");

break;

case" de":

//使用德语网站。

Response.Redirect(" http://www.contoso.com/de");

break;

case" zh":

//使用中文网站。

Response.Redirect(" http://www.contoso.com/zh" ;);

休息;

默认值:

//使用美国网站。

Response.Redirect(" http://www.contoso.com/usa");

休息;

}

}

}

解决方案

嗨dale,


我认为重定向到不同的语言页面是一个坏主意,无论你有什么不同的风格和内容为不同的语言。最好的想法是

去寻找不同语言的资源文件,并为每种语言设置cultureinfo

。我已经为一个非常大的项目做了这个,从那以后我就开始了自己的ASP.net
;)


欢呼!!

pradeep


" dale zhang"写道:



这里有人有建立英文/中文网页的经验吗?

开发网络的第15章应用程序告诉我们如何做到这一点,
但我想了解更多细节。

似乎检测和重定向是我这样做的方式。这是否意味着我必须在主页面上有图像按钮才能链接到中文页面?所有
中文页面都会复制英文页面?以下是来自本书,
如何获取Request.UserLanguages [0]?

非常感谢。 -Dale

private void Page_Load(object sender,System.EventArgs e)
//
//获取用户的首选语言。
string sLang = Request .UserLanguages [0];
//获取语言的前两个字符。
sLang = sLang.Substring(0,2);
//根据用户的文化重定向用户。
switch(sLang)
{
case" en":
//使用美国网站。
Response.Redirect(" http://www.contoso .com / usa");
break;
case" es":
//使用西班牙语网站。
Response.Redirect(" http://www.contoso .com / es");
休息;
案例" de":
//使用德语网站。
Response.Redirect(" http://www.contoso .com / de");
休息;
案例" zh":
//使用中文网站。
Response.Redir ect(" http://www.contoso.com/zh");
中断;
默认:
//使用美国网站。
Response.Redirect(" http://www.contoso.com/usa");
休息;
}
}
}


谢谢Pradeep。我同意资源文件是正确的方法。你知道我能在哪里找到一个好的材料告诉我怎么做吗?


" pradeep_TP"写道:

嗨dale,

我认为重定向到不同的语言页面是一个坏主意,无论你有不同的风格和不同的内容语言。最好的想法是使用不同语言的资源文件并为每种语言设置cultureinfo
。我已经为一个非常大的项目做了这个,从那以后我开始爱好ASP.net;)欢呼!!
pradeep

; dale zhang写道:



这里有人有建立英文/中文网页的经验吗?

开发网络的第15章应用程序告诉我们如何做到这一点,
但我想了解更多细节。

似乎检测和重定向是我这样做的方式。这是否意味着我必须在主页面上有图像按钮才能链接到中文页面?所有
中文页面都会复制英文页面?以下是来自本书,
如何获取Request.UserLanguages [0]?

非常感谢。 -Dale

private void Page_Load(object sender,System.EventArgs e)
//
//获取用户的首选语言。
string sLang = Request .UserLanguages [0];
//获取语言的前两个字符。
sLang = sLang.Substring(0,2);
//根据用户的文化重定向用户。
switch(sLang)
{
case" en":
//使用美国网站。
Response.Redirect(" http://www.contoso .com / usa");
break;
case" es":
//使用西班牙语网站。
Response.Redirect(" http://www.contoso .com / es");
休息;
案例" de":
//使用德语网站。
Response.Redirect(" http://www.contoso .com / de");
休息;
案例" zh":
//使用中文网站。
Response.Redir ect(" http://www.contoso.com/zh");
中断;
默认:
//使用美国网站。
Response.Redirect(" http://www.contoso.com/usa");
休息;
}
}
}



嗨dale,


当你想到经典ASP语境中的多语言时,那么这是一个非常好的b $ b dauting任务。但是在ASP.net中它只是设置正确的问题

clutureinfo。您可以浏览任何网站,告知您在ASP.net中本地化网页的信息。以下网址对您来说是一个好的开始

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


欢呼!!

pradeep_TP

" dale zhang"写道:

谢谢,普拉迪普。我同意资源文件是正确的方法。你知道我在哪里可以找到一个很好的材料来告诉我怎么做吗?


" pradeep_TP"写道:

嗨dale,

我认为重定向到不同的语言页面是一个坏主意,无论你有不同的风格和不同的内容语言。最好的想法是使用不同语言的资源文件并为每种语言设置cultureinfo
。我已经为一个非常大的项目做了这个,从那以后我开始爱好ASP.net;)欢呼!!
pradeep

; dale zhang写道:



这里有人有建立英文/中文网页的经验吗?

开发网络的第15章应用程序告诉我们如何做到这一点,
但我想了解更多细节。

似乎检测和重定向是我这样做的方式。这是否意味着我必须在主页面上有图像按钮才能链接到中文页面?所有
中文页面都会复制英文页面?以下是来自本书,
如何获取Request.UserLanguages [0]?

非常感谢。 -Dale

private void Page_Load(object sender,System.EventArgs e)
//
//获取用户的首选语言。
string sLang = Request .UserLanguages [0];
//获取语言的前两个字符。
sLang = sLang.Substring(0,2);
//根据用户的文化重定向用户。
switch(sLang)
{
case" en":
//使用美国网站。
Response.Redirect(" http://www.contoso .com / usa");
break;
case" es":
//使用西班牙语网站。
Response.Redirect(" http://www.contoso .com / es");
休息;
案例" de":
//使用德语网站。
Response.Redirect(" http://www.contoso .com / de");
休息;
案例" zh":
//使用中文网站。
Response.Redir ect(" http://www.contoso.com/zh");
中断;
默认:
//使用美国网站。
Response.Redirect(" http://www.contoso.com/usa");
休息;
}
}
}


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;
}
}
}

解决方案

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;
}
}
}



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;
}
}
}



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;
}
}
}



这篇关于建立双语网络?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆