[求助]关于系统的国际化问题

对于页面的jsp静态信息,Struts提供了不错的功能

但是动态数据如何实现?有没有什么好的解决方案或者框架?

petstore好像解决的也不好,多种语言的信息都存放在一个表里面,但是后台管理起来似乎很麻烦啊

谢谢各位大哥们了~~

使用Struts的属性可以定义页面不同的语言。

不过我感觉这妨碍设计师设计页面,实用方法还是将语言做在JSP中,不同语言不同JSP,因为语言不同,设计师设计的页面可能不一样。

当初我们同事之间为这个多语言的方案争论过很多次。
我主张以模版基础,开发一个模板替换的工具(用 ANT 实际就可以做到)。
这样可以通过工具将页面中的 Label 替换成各语种信息文件中的信息,形成静态的文档,可以提高访问效率。
但是因为当时公司有很一套整在使用的方案(主要因为是DM设计的),它使用的也是模板替换,但是每次访问页面时都要从数据库中取相应的Label信息进行替换,很耗时(用过我们公司出的 OBS/BSS 系统的都会觉得系统慢)。没办法,老大说这种方案成熟,很多产品都用,所以,最后,还是从数据库里取的Label

>>这样可以通过工具将页面中的 Label 替换成各语种信息文件中的信息,形成静态的文档,可以提高访问效率。

如果要提高访问速度,就应该这么做。我在上一个公司就是这样做:如果页面控制数据修改了,则需要重新生成静态页面。----实际上页面修改的频度相当低,一星期还改不了一次呢。

to :iceant

用cache就快多了,不必每次到数据库中取。

java与模式的多例模式有一个case就是讲这个问题,那章可以下载。

TO: banq

针对每个页面的 tag 做 cache?

也许可以吧~~

我们在实际过程中也遇到了国际化的问题,我觉得国际化大致分为以下几个方面:
1。前台页面显示
2。后台组件
3。数据库存储
4。用户输入(本地化)

记得在看JRun文档时,在说到本地化和国际化时,其解决方案之一是:
(小弟我e文不好,为了不影响大家理解,贴上原文了)
Using ResourceBundles
-----------------------------
ResourceBundles let you create a separate source file for each locale that you support in
your web applications. These files can contain text or other objects, such as images, that
are specific to each locale.
ResourceBundles are an abstract class in the java.util package and must be
implemented as one of the following subclasses:
• ListResourceBundle Use to store pointers to images or other objects in your
resource bundle. Uses Java classes to store resource information.
• PropertyResourceBundle Use to store text in your resource bundle. Uses
plain-text property files to store the raw data.
If your web application requires mostly localized text information, then it is easiest to use
property files (required by PropertyResourceBundle) rather than class files (required by
ListResourceBundles) to store your data.
JRun uses the following conventions to determine which resource bundle to fetch based
on the filename:
ClassName_languagecode_COUNTRYCODE.class
ClassName_languagecode_COUNTRYCODE.properties
The languagecode is mandatory except for the default system locale, such as en. The
COUNTRYCODE is optional.
When you invoke the getBundle method with the locale, JRun fetches the proper
resource class or file automatically. For example, if the locale is set to Japanese, JRun
fetches MyResources_ja.class or MyResources_ja.properties.
To use resource bundles in your web applications, you provide the client locale to the
ResourceBundle.getBundle method. Then you invoke the appropriate methods on the
resource bundle, as the following example shows:
...
ResourceBundle bundle =
ResourceBundle.getBundle(“Resources”,request.getLocale());


<html>
<head><title><%= bundle.getString("title") %></title></head>
<body>
<%-- Display all the contents based on ResourceBundle --%>
<h2><%= bundle.getString(
"hello_message") %></h2>
</body>
</html>

...
The contents of the resource bundle properties file are as follows:
title=Morning Greeting
hello_message=Good Morning
For an example, see SampleJDBCLoginModule in the
/samples/SERVER-INF/lib/jrun/samples/security directory.

1。前台页面显示
2。后台组件
3。数据库存储
4。用户输入(本地化)
-----------------------------------

第一点比较容易解决,使用Struts就可以

3、4这两个解决起来比较困难

不知道有没有成型的框架?

象Jdon这样使用ISO88591,我个人认为不是一个非常好的处理方法。

我想从某一个方面解决国际化的方法是使用统一的字符集,就是“Unicode”,当然从前端到中间,再到后端,都必须处理好,我曾写了这样一篇文章,有时间整理一下,贴上来。

国际化是一个很宽的话题,字符集只是一个方面,还有以上几位讲的Resource Bundle等等,还有许多。。。。

不知有哪位可以推荐几篇介绍的比较全面的文章。