0

LabelLocator2 implementation?

asked 2012-01-19 22:17:09 +0800

Sam777 gravatar image Sam777
33

Hi guys,

I read the page http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/Internationalization/Labels that talks abut using
LabelLocator2 to do i18n from database BUT the example it gave is like

public class FooDBLocator extends org.zkoss.util.resource.LabelLocator2 {
    private String _field;
    public FooDBLocator(String field) {
        _field = field;
    }
    public InputStream locate(Locale locale) {
        InputStream is = ... //load the properties from, say, database
        return is;
    }
    public String getCharset() {
        return "UTF-8"; //depending the encoding you use
    }
}

Does anyone have a more solid example of how to construct the inputstream in locate(..) above?

Thanks,

Sam

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-02-02 08:11:48 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

From DB you can get label strings. Once you have them you can create ByteArrayInputStream. Google it you should find several examples. Here is one solution

link publish delete flag offensive edit

answered 2013-04-19 16:38:55 +0800

cmsandiga gravatar image cmsandiga
0 1

Maybe it can help you : http:/ github.com/cmsandiga/zk-multiligual-BD

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-19 22:17:09 +0800

Seen: 131 times

Last updated: Apr 19 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More