<g:ListBox> <g:item> use i18n

360 views
Skip to first unread message

Luke

unread,
Feb 3, 2012, 9:06:36 AM2/3/12
to Google Web Toolkit
<g:ListBox>
<g:item>
how to use i18n for list box's item ?
</g:item>
</g:ListBox>

Patrick Julien

unread,
Feb 3, 2012, 9:09:11 AM2/3/12
to google-we...@googlegroups.com

Luke

unread,
Feb 3, 2012, 9:27:24 AM2/3/12
to Google Web Toolkit
<g:item value='test'>
<ui:text from="{msg.SomeValue}">somevalue</ui:text>
</g:item>

i tried above, and not working

Luke

unread,
Feb 3, 2012, 9:33:12 AM2/3/12
to Google Web Toolkit
Illegal child <ui:text> in a text-only context. Perhaps you are
trying to use unescaped HTML where text is required, as in a HasText
widget? Element <g:item value='test'> (:83)

Joanna

unread,
Apr 12, 2012, 6:14:21 AM4/12/12
to google-we...@googlegroups.com
I would use <ui:msg> instead of <ui:text>
Something like:

<g:ListBox>
<g:item><ui:msg key="item1_text">Some text</ui:msg></g:item>
</g:ListBox>

worked well for me.

I know that's late, but hope it helps.

Joseph Lust

unread,
Apr 20, 2012, 6:07:46 PM4/20/12
to google-we...@googlegroups.com
Perhaps you're not crossing all the 't's correctly here? Here is the code I use. It works for me with HTML, no need to escape it, the GWT compiler/runtime does that.

# messages file
page.title=<b>My Title!</b>

# message interfaces java file
package com.me;

import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.Messages;

public interface MyMessages extends Messages {
   
    @Key("page.title")
    String getPageTitle();

    public static class Default {

        private static final MyMessages instance = GWT.create(MyMessages.class);

        public static MyMessages getInstance() {
            return instance;
        }
    }
}

# UiBinder File
<ui:with field='msg' type='com.me.MyMessages'/> 

<ui:text from="{msg.getPageTitle}"/>


Sincerely,
Joseph 
Reply all
Reply to author
Forward
0 new messages