lxw
2020-06-27 8aee9dfec05e1a9333abf03f1bd35dd7cfa9d352
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.fgkj.actions;
 
import java.util.Locale;
import com.opensymphony.xwork2.ActionContext;
 
public class I18nAction extends ActionUtil{
    private String lanuage;
    private String key;
    private String value;
    
    public String findValue(){
        //System.out.println(key+"&&&&&&&&&&&&");
        value=this.getText(key);
        //value=ActionUtil.tojson(value);
        //System.out.println(value+"$$$$$$$");
        return SUCCESS;
    }
    
    //切换中英文环境
    public String SetLocale(){
        Locale local = Locale.getDefault();
        if(lanuage!=null){
            if("US".equalsIgnoreCase(lanuage)){
                local = Locale.US;
                
            }else if("CH".equalsIgnoreCase(lanuage)){
                local = Locale.CHINA;
            }
            //System.out.println(local.getCountry());
        }
        ActionContext.getContext().setLocale(local);
        getSession().setAttribute("WW_TRANS_I18N_LOCALE", local);
        return SUCCESS;
    }
 
    public String getValue() {
        return value;
    }
 
    public String getKey() {
        return key;
    }
 
    public void setValue(String value) {
        this.value = value;
    }
 
    public void setKey(String key) {
        this.key = key;
    }
 
    public void setLanuage(String lanuage) {
        this.lanuage = lanuage;
    }
    
}