如何创建2种语言的网站?谢谢。 [英] How to create a 2 languages web site? Thank You.

查看:70
本文介绍了如何创建2种语言的网站?谢谢。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我正在开发一个ASP.NET / VB网站,我需要有两个版本:

英文和法文。


我可以通过复制所有

页面来创建两个版本的网站。这是正确的方法吗?


我的所有内容都来自数据库,所以我可以复制字段

所以我可以有2种语言内容。 />

我还有一个法语版或英文版我的

页面中的按钮。它应该只显示一个。


谢谢,

Miguel

解决方案

阅读Karl Seguin的优秀教程:

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>在消息中写道

新闻:OL ************** @ TK2MSFTNGP12.phx.gbl ...

你好,
我正在开发一个ASP.NET / VB网站,我需要有两个版本:英文和
法文。

我可以创建两个版本的网页网站通过复制所有页面。这是正确的方式吗?

我的所有内容都来自数据库,所以我可以复制这些字段,这样我就可以有2种语言内容。

谢谢你,
Miguel



还有另一种方法似乎要简单得多。使用

用户控件并在运行时动态加载它们。这是baisc

的概念。你有两种语言说英语和法语。您将拥有

目录结构:


MyWebsite

en(英文文本)

header.ascx

| _ header.ascx.vb

content.ascx

| _ content.ascx.vb

footer.ascx

| _ footer.ascx.vb

fr(法语文本)

header.ascx

content.ascx

footer.ascx


default.aspx

contentpage1.aspx


因此,在default.aspx中,您可以询问用户他们想要哪种语言。然后

将他们的语言存储在持久cookie或会话变量中。

根据他们选择的语言,动态加载用户控件

来自contentpage1.aspx

页面中包含英语或法语的文件夹。有一点需要注意。只有en foder将具有ascx文件和

ascx.vb代码隐藏文件,所有其他语言将只有ascx

文件。这个想法是每个语言文件夹下的每个用户控件

将在ascx文件中具有完全相同的服务器控件或控件,并且具有完全相同的名称

。因此,在源视图中

usercontrol顶部的@Control指令中,您可以告诉它它继承自英文文件夹下的ascx.vb

文件。我想它比它更多

但如果你需要一个更简单的

方法,这是一个非常简单的方法。


-

TDAVISJR

又名 - Tampa.NET Koder

" Juan T. Llibre" <无*********** @ nowhere.com>在消息中写道

新闻:OJ ************** @ TK2MSFTNGP09.phx.gbl ...

阅读Karl Seguin''优秀的教程:

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>在消息中写道
新闻:OL ************** @ TK2MSFTNGP12.phx.gbl ...

你好,
我正在开发一个ASP.NET / VB网站,我需要有两个版本:
英文和法文。

我可以通过复制所有网站来创建两个版本的网站页面。
这是正确的方法吗?

我的所有内容都来自数据库,因此我可以复制这些字段,因此我可以拥有2种语言内容。

我还有一个法语版或英文版我的页面中的按钮。
它应该只显示一个。

谢谢你,
Miguel




那更简单? (只有半开玩笑......)


如果你打算这样做,你甚至不需要

存储完成工作的语言偏好。


只需重定向到适当的语言目录

就足够了,如果你在应用程序中使用相对URL。


我认为这个想法是*避免*为你使用的每种语言都有一个重复的目录

,因为它变成了

相当无法管理,快速,当你添加语言时。


一种稍微不同的方法是使用XML文件,

或数据库表,用于不同的语言内容。


这就像创建一个不同的皮肤一样。对于每种语言。


从数据存储的角度来看,这更容易管理。


我宁愿有一个不同的XML文件,包含所有本地化字符串,

或带有所有本地化字符串的不同数据库列,

比每个文件具有不同的文件,ascx控件等语言。


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" <一个******* @ microsoft.com>在消息中写道

新闻:O5 ************* @ TK2MSFTNGP10.phx.gbl ...

还有另一种方法似乎更简单。使用用户控件完成所有操作并在运行时动态加载它们。这是baisc的概念。你有2种语言说英语和法语。您将拥有以下目录结构:

我的网站
en(英文文本)
header.ascx
| _ header.ascx.vb
内容.ascx
| _ content.ascx.vb
footer.ascx
| _ footer.ascx.vb

fr(法文文本)
标题.ascx
content.ascx
footer.ascx

default.aspx
contentpage1.aspx

那么,在default.aspx你可以询问用户他们想要哪种语言。然后将他们的
语言存储在持久cookie或会话变量中。根据他们选择的语言,从contentpage1.aspx页面中具有
英语或法语的文件夹中动态加载用户控件。有一点需要注意。只有en foder
将具有ascx文件和ascx.vb代码隐藏文件,所有其他语言将只有ascx文件。这个想法是每个语言文件夹下的每个用户控件都将具有与ascx文件中的EXACT相同名称的EXACT相同的服务器控件或控件。因此,在源
视图中usercontrol顶部的@Control指令中,您可以告诉它它继承自位于英语
文件夹下的ascx.vb文件。我想它不仅如此,但如果你需要一种更简单的方法,这是一个非常简单的方法。

-
TDAVISJR
aka - Tampa.NET Koder

" Juan T. Llibre" <无*********** @ nowhere.com>在消息中写道
新闻:OJ ************** @ TK2MSFTNGP09.phx.gbl ...

阅读Karl Seguin的优秀教程:

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>在消息中写道
新闻:OL ************** @ TK2MSFTNGP12.phx.gbl ...

你好,
我正在开发一个ASP.NET / VB网站,我需要有两个版本:英文版和
法文版。

我可以通过复制所有版本创建两个版本的网站页面。这是正确的方式吗?

我的所有内容都来自数据库,所以我可以复制这些字段,这样我就可以有2种语言内容。

谢谢你,
Miguel





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

解决方案

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:OL**************@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



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" <no***********@nowhere.com> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...

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:OL**************@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




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" <an*******@microsoft.com> wrote in message
news:O5*************@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:

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" <no***********@nowhere.com> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...

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:OL**************@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





这篇关于如何创建2种语言的网站?谢谢。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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