新开发的产品需要考虑多语言的问题,i18n一直只是看过,并没有正在的用到项目中,觉得应该是个很容易的事情,谁知今天却折腾了我一把:(

首先修改webwork.properties:

webwork.locale = zh_CN
webwork.i18n.encoding
= GBK
修改native2ascii的编码
     < target  name ="i18n" >
        
< native2ascii
                
encoding ="GBK"
                src
="${src.java.dir}"
                dest
="${classes.dir}"
                includes
="**/*_zh_CN.properties" />

        
< copy
                
todir ="${classes.dir}" >
            
< fileset  dir ="${src.java.dir}" >
                
< exclude  name ="**/*.java" />
                
< exclude  name ="**/*_zh_CN.properties" />
            
</ fileset >
        
</ copy >
    
</ target >

修改页面:
<% @ page contentType = " text/html; charset=GBK "   %>

搞定了!这个问题居然折腾我好大一会儿,一开始我以为用utf-8就行了,谁知道就是不灵:(

webwork i18n:http://www.opensymphony.com/webwork/wikidocs/Internationalization.html