Re: localizer and variables

2009-06-30 Thread OjO
.
 
  What would be the correct way to get a property resource when a
 String
  value
  is needed?
  --
  View this message in context:
 
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
 
 -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  View this message in context:
 
 http://www.nabble.com/localizer-and-variables-tp16548684p24259437.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24261681.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 

-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p24276535.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-29 Thread OjO

This id is used for event handling. When I moved the setMarkupId statement
into onBeforeRender method, the handler no longer work.

myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
Model (handleId)));


igor.vaynberg wrote:
 
 set it in onbeforerender
 
 -igor
 
 On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet
 been
 added to the page. This can sometimes lead to an invalid or no localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String
 value
 is needed?
 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 



-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p24258625.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-29 Thread Igor Vaynberg
probably because you call getmarkupid() before you call setmarkupid() ?

-igor

On Mon, Jun 29, 2009 at 10:43 AM, OjOfang...@washington.edu wrote:

 This id is used for event handling. When I moved the setMarkupId statement
 into onBeforeRender method, the handler no longer work.

 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));


 igor.vaynberg wrote:

 set it in onbeforerender

 -igor

 On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet
 been
 added to the page. This can sometimes lead to an invalid or no localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String
 value
 is needed?
 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org






 --
 View this message in context: 
 http://www.nabble.com/localizer-and-variables-tp16548684p24258625.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-29 Thread OjO

Here is another more complex case:

LinkSelection.properties:
edit_label=Edit
done_label=Hide Edit...
linkId=toggle_link_{id}
onclick=toggleEdit('{id}'); return(false);
divId=toggle_div_{id}

LinkSelection.java has the following in the constructor:
@Override
protected void populateItem(ListItem item) {

  bk = (BkItemI)item.getModelObject();
  
  // 1. the edit icon
  Label editLink = new Label (edit_item_link, 
  ( isEditBk(bk) 
? new ResourceModel (done_label)
: new ResourceModel (edit_label)))
{
  @Override
protected void onBeforeRender()
  {
setOutputMarkupId(true);
setMarkupId (getLocalizer().getString 
 (linkIdPrefix, LinkSelection.this,
  new PropertyModel (LinkSelection.this.bk, id)));
add (new SimpleAttributeModifier 
 (onclick, getLocalizer().getString 
  (onclick, LinkSelection.this, 
   new PropertyModel (LinkSelection.this.bk, id;
super.onBeforeRender();
  }
};
  item.add (editLink);
   ...

ERROR 29 11:58:24.086 Error attaching this container for rendering:
[MarkupContainer [Component id = 0]] [o.a.w.RequestCycle]
org.apache.wicket.WicketRuntimeException: Error attaching this container for
rendering: [MarkupContainer [Component id = 0]]
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1717)
at org.apache.wicket.Component.onBeforeRender(Component.java:3757)



igor.vaynberg wrote:
 
 set it in onbeforerender
 
 -igor
 
 On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet
 been
 added to the page. This can sometimes lead to an invalid or no localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String
 value
 is needed?
 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p24259437.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-29 Thread Igor Vaynberg
the property files are made for i18n, you are really abusing them. if
you want these things externalized then load them from an external
resource yourself.

-igor

On Mon, Jun 29, 2009 at 12:14 PM, OjOfang...@washington.edu wrote:

 Here is another more complex case:

 LinkSelection.properties:
 edit_label=Edit
 done_label=Hide Edit...
 linkId=toggle_link_{id}
 onclick=toggleEdit('{id}'); return(false);
 divId=toggle_div_{id}

 LinkSelection.java has the following in the constructor:
 @Override
        protected void populateItem(ListItem item) {

          bk = (BkItemI)item.getModelObject();

          // 1. the edit icon
          Label editLink = new Label (edit_item_link,
                                      ( isEditBk(bk)
                                        ? new ResourceModel (done_label)
                                        : new ResourceModel (edit_label)))
            {
             �...@override
                protected void onBeforeRender()
              {
                setOutputMarkupId(true);
                setMarkupId (getLocalizer().getString
                             (linkIdPrefix, LinkSelection.this,
                              new PropertyModel (LinkSelection.this.bk, 
 id)));
                add (new SimpleAttributeModifier
                     (onclick, getLocalizer().getString
                      (onclick, LinkSelection.this,
                       new PropertyModel (LinkSelection.this.bk, id;
                super.onBeforeRender();
              }
            };
          item.add (editLink);
               ...

 ERROR 29 11:58:24.086 Error attaching this container for rendering:
 [MarkupContainer [Component id = 0]] [o.a.w.RequestCycle]
 org.apache.wicket.WicketRuntimeException: Error attaching this container for
 rendering: [MarkupContainer [Component id = 0]]
        at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1717)
        at org.apache.wicket.Component.onBeforeRender(Component.java:3757)



 igor.vaynberg wrote:

 set it in onbeforerender

 -igor

 On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet
 been
 added to the page. This can sometimes lead to an invalid or no localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String
 value
 is needed?
 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 View this message in context: 
 http://www.nabble.com/localizer-and-variables-tp16548684p24259437.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-29 Thread OjO

Sorry, I did not mean to abuse them. I am seeking the right way of getting
String properties associated with a panel class. What do you mean by
externalized? What is an external resource?


igor.vaynberg wrote:
 
 the property files are made for i18n, you are really abusing them. if
 you want these things externalized then load them from an external
 resource yourself.
 
 -igor
 
 On Mon, Jun 29, 2009 at 12:14 PM, OjOfang...@washington.edu wrote:

 Here is another more complex case:

 LinkSelection.properties:
 edit_label=Edit
 done_label=Hide Edit...
 linkId=toggle_link_{id}
 onclick=toggleEdit('{id}'); return(false);
 divId=toggle_div_{id}

 LinkSelection.java has the following in the constructor:
 @Override
        protected void populateItem(ListItem item) {

          bk = (BkItemI)item.getModelObject();

          // 1. the edit icon
          Label editLink = new Label (edit_item_link,
                                      ( isEditBk(bk)
                                        ? new ResourceModel (done_label)
                                        : new ResourceModel
 (edit_label)))
            {
             �...@override
                protected void onBeforeRender()
              {
                setOutputMarkupId(true);
                setMarkupId (getLocalizer().getString
                             (linkIdPrefix, LinkSelection.this,
                              new PropertyModel (LinkSelection.this.bk,
 id)));
                add (new SimpleAttributeModifier
                     (onclick, getLocalizer().getString
                      (onclick, LinkSelection.this,
                       new PropertyModel (LinkSelection.this.bk, id;
                super.onBeforeRender();
              }
            };
          item.add (editLink);
               ...

 ERROR 29 11:58:24.086 Error attaching this container for rendering:
 [MarkupContainer [Component id = 0]] [o.a.w.RequestCycle]
 org.apache.wicket.WicketRuntimeException: Error attaching this container
 for
 rendering: [MarkupContainer [Component id = 0]]
        at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1717)
        at org.apache.wicket.Component.onBeforeRender(Component.java:3757)



 igor.vaynberg wrote:

 set it in onbeforerender

 -igor

 On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this,
 new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet
 been
 added to the page. This can sometimes lead to an invalid or no
 localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String
 value
 is needed?
 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24259437.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p24261681.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-29 Thread Igor Vaynberg
an external resource can be any file that is not javacode.

eg inside your panel you can do
Properties props=new Properties();
props.load(getClassLoader().getResourceAsStream(getClass().getName().replace(.,/)+.external.properties));

and have a MyPanel.external.properties file next to your MyPanel.java

i dont see why you are trying to externalize such strings though, they
are clearly part of the code.

-igor

On Mon, Jun 29, 2009 at 2:59 PM, OjOfang...@washington.edu wrote:

 Sorry, I did not mean to abuse them. I am seeking the right way of getting
 String properties associated with a panel class. What do you mean by
 externalized? What is an external resource?


 igor.vaynberg wrote:

 the property files are made for i18n, you are really abusing them. if
 you want these things externalized then load them from an external
 resource yourself.

 -igor

 On Mon, Jun 29, 2009 at 12:14 PM, OjOfang...@washington.edu wrote:

 Here is another more complex case:

 LinkSelection.properties:
 edit_label=Edit
 done_label=Hide Edit...
 linkId=toggle_link_{id}
 onclick=toggleEdit('{id}'); return(false);
 divId=toggle_div_{id}

 LinkSelection.java has the following in the constructor:
 @Override
        protected void populateItem(ListItem item) {

          bk = (BkItemI)item.getModelObject();

          // 1. the edit icon
          Label editLink = new Label (edit_item_link,
                                      ( isEditBk(bk)
                                        ? new ResourceModel (done_label)
                                        : new ResourceModel
 (edit_label)))
            {
             �...@override
                protected void onBeforeRender()
              {
                setOutputMarkupId(true);
                setMarkupId (getLocalizer().getString
                             (linkIdPrefix, LinkSelection.this,
                              new PropertyModel (LinkSelection.this.bk,
 id)));
                add (new SimpleAttributeModifier
                     (onclick, getLocalizer().getString
                      (onclick, LinkSelection.this,
                       new PropertyModel (LinkSelection.this.bk, id;
                super.onBeforeRender();
              }
            };
          item.add (editLink);
               ...

 ERROR 29 11:58:24.086 Error attaching this container for rendering:
 [MarkupContainer [Component id = 0]] [o.a.w.RequestCycle]
 org.apache.wicket.WicketRuntimeException: Error attaching this container
 for
 rendering: [MarkupContainer [Component id = 0]]
        at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1717)
        at org.apache.wicket.Component.onBeforeRender(Component.java:3757)



 igor.vaynberg wrote:

 set it in onbeforerender

 -igor

 On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this,
 new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet
 been
 added to the page. This can sometimes lead to an invalid or no
 localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String
 value
 is needed?
 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24259437.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 View this message in context: 
 http://www.nabble.com/localizer-and-variables-tp16548684p24261681.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org

Re: localizer and variables

2009-06-29 Thread Luther Baker
OjO,

Ideally, strings or text that users actually see and interact with are
candidates for i18n.

javascript, markup ids, onclick attributes and the like need not be i18n.
This kind of text can strictly be considered part of your codebase.

Remember, strings exist in the i18n properties files to isolate them - so
that their values can easily be *replaced *by other language specific text
values 

Before putting strings there - ask yourself if you really need language
specific versions of this 'string'.

From your second example, it looks like the *editLink* is a fine candidate
for an i18n string ... but using i18n string for the *markupid *and *onclick
*handlers is actually confusing. That'd be like putting your html markup
in an i18n properties file. It is code and has no international variant.
Feel comfortable keeping those strings *internal*. Don't *externalize* them.
Keep them collocated/embedded in the code - since they are themselves, code.

I hope I didn't misunderstand you. Hope that helps,

-Luther



On Mon, Jun 29, 2009 at 5:06 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 an external resource can be any file that is not javacode.

 eg inside your panel you can do
 Properties props=new Properties();

 props.load(getClassLoader().getResourceAsStream(getClass().getName().replace(.,/)+.external.properties));

 and have a MyPanel.external.properties file next to your MyPanel.java

 i dont see why you are trying to externalize such strings though, they
 are clearly part of the code.

 -igor

 On Mon, Jun 29, 2009 at 2:59 PM, OjOfang...@washington.edu wrote:
 
  Sorry, I did not mean to abuse them. I am seeking the right way of
 getting
  String properties associated with a panel class. What do you mean by
  externalized? What is an external resource?
 
 
  igor.vaynberg wrote:
 
  the property files are made for i18n, you are really abusing them. if
  you want these things externalized then load them from an external
  resource yourself.
 
  -igor
 
  On Mon, Jun 29, 2009 at 12:14 PM, OjOfang...@washington.edu wrote:
 
  Here is another more complex case:
 
  LinkSelection.properties:
  edit_label=Edit
  done_label=Hide Edit...
  linkId=toggle_link_{id}
  onclick=toggleEdit('{id}'); return(false);
  divId=toggle_div_{id}
 
  LinkSelection.java has the following in the constructor:
  @Override
 protected void populateItem(ListItem item) {
 
   bk = (BkItemI)item.getModelObject();
 
   // 1. the edit icon
   Label editLink = new Label (edit_item_link,
   ( isEditBk(bk)
 ? new ResourceModel
 (done_label)
 : new ResourceModel
  (edit_label)))
 {
   @Override
 protected void onBeforeRender()
   {
 setOutputMarkupId(true);
 setMarkupId (getLocalizer().getString
  (linkIdPrefix, LinkSelection.this,
   new PropertyModel (LinkSelection.this.bk,
  id)));
 add (new SimpleAttributeModifier
  (onclick, getLocalizer().getString
   (onclick, LinkSelection.this,
new PropertyModel (LinkSelection.this.bk,
 id;
 super.onBeforeRender();
   }
 };
   item.add (editLink);
...
 
  ERROR 29 11:58:24.086 Error attaching this container for rendering:
  [MarkupContainer [Component id = 0]] [o.a.w.RequestCycle]
  org.apache.wicket.WicketRuntimeException: Error attaching this
 container
  for
  rendering: [MarkupContainer [Component id = 0]]
 at
 
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1717)
 at
 org.apache.wicket.Component.onBeforeRender(Component.java:3757)
 
 
 
  igor.vaynberg wrote:
 
  set it in onbeforerender
 
  -igor
 
  On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:
 
  I am using the following:
  myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this,
  new
  Model (handleId)));
 
  but still getting WARNing:
 
  Tried to retrieve a localized string for a component that has not yet
  been
  added to the page. This can sometimes lead to an invalid or no
  localized
  resource returned. Make sure you are not calling
 Component#getString()
  inside your Component's constructor.
 
  What would be the correct way to get a property resource when a
 String
  value
  is needed?
  --
  View this message in context:
 
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org

Re: localizer and variables

2009-06-26 Thread OjO

I am using the following:
myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
Model (handleId)));

but still getting WARNing:

Tried to retrieve a localized string for a component that has not yet been
added to the page. This can sometimes lead to an invalid or no localized
resource returned. Make sure you are not calling Component#getString()
inside your Component's constructor.

What would be the correct way to get a property resource when a String value
is needed?
-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-26 Thread Igor Vaynberg
set it in onbeforerender

-igor

On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet been
 added to the page. This can sometimes lead to an invalid or no localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String value
 is needed?
 --
 View this message in context: 
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: localizer and variables

2009-06-26 Thread OjO

Do you mean override the onbeforerender method of the current class or inside
the class of myCom object? Could you give an example?

 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));


igor.vaynberg wrote:
 
 set it in onbeforerender
 
 -igor
 
 On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote:

 I am using the following:
 myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new
 Model (handleId)));

 but still getting WARNing:

 Tried to retrieve a localized string for a component that has not yet
 been
 added to the page. This can sometimes lead to an invalid or no localized
 resource returned. Make sure you are not calling Component#getString()
 inside your Component's constructor.

 What would be the correct way to get a property resource when a String
 value
 is needed?
 --
 View this message in context:
 http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p24227830.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



localizer and variables

2008-04-08 Thread Mathias P.W Nilsson

Hi!

In my property file i can do this

email.subject=Hi {name}! Here is your confirmation.

How can I use this in my wicket page? I have looked at getLocalizer() but
there is no were to set the name variable. How can I use this in wicket?
-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p16548684.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: localizer and variables

2008-04-08 Thread Korbinian Bachl - privat

Hi,

 How can I use this in my wicket page? I have looked at getLocalizer() but
 there is no were to set the name variable. How can I use this in wicket?

you could start using the search function on the mailinglist or browisng 
the wicket wiki as we had this question just 23 hours ago


http://cwiki.apache.org/WICKET/general-i18n-in-wicket.html

shows you how to use it;

Regards,

Korbinian


Mathias P.W Nilsson schrieb:

Hi!

In my property file i can do this

email.subject=Hi {name}! Here is your confirmation.

How can I use this in my wicket page? I have looked at getLocalizer() but
there is no were to set the name variable. How can I use this in wicket?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: localizer and variables

2008-04-08 Thread Mathias P.W Nilsson

This is what I got so far

 new StringResourceModel( email.forgotlogin.body , Login.this, new
Model(), new Object[]{  user.getUserName(), user.getPassWord() } 
).getString();

must I really do this for every string?
-- 
View this message in context: 
http://www.nabble.com/localizer-and-variables-tp16548684p16550530.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: localizer and variables

2008-04-08 Thread Korbinian Bachl - privat
well, in your case its not an easy string, but one with 2 parameters - 
in case you have a plain string you can also use the wicket:message 
method that is quite better suited for this (e.g: 2 message blocks - 1 
before, 1 after and in middle a simple label that spews out the user data);


if you need many hard facts inserted into many strings holding many 
parameters it might be easier to supply different language-markups (aka: 
i8n of whole page in wiki) all over (however, im not sure how your email 
thing works under the hood);


here in your case I could imagine that having several

mailcontent.html
mailcontent_en.html


might be easier so you just put in the hard facts using simple label; if 
its just this one line however your solution is best IMHO;


Best,

Korbinian


Mathias P.W Nilsson schrieb:

This is what I got so far

 new StringResourceModel( email.forgotlogin.body , Login.this, new
Model(), new Object[]{  user.getUserName(), user.getPassWord() } 
).getString();


must I really do this for every string?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: localizer and variables

2008-04-08 Thread Erik van Oosten
I thought that something like this would work also:

  email.subject=Hi {userName}! Here is your confirmation.

  getLocalizer().getString(email.subject, Login.this, new Model(user));


Regards,
Erik.


Mathias P.W Nilsson schreef:
 This is what I got so far

  new StringResourceModel( email.forgotlogin.body , Login.this, new
 Model(), new Object[]{  user.getUserName(), user.getPassWord() } 
 ).getString();

 must I really do this for every string?
   

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]