Hi,

Thanks for the answer.

I don't quite understand it though!

As far as I can tell, there's still only 1 resource, which has the locale of the page (at creation time).

But I have a link on the page which allows you to change the locale. This link is stateful, so it just calls the callback on the current page and sets the locale.

Since one ResourceReference doesn't seem to have more than one (version of a) Resource associated with it, I don't see how the code below is going to help me...

Thus my situation is:

I have 2 versions of a resource, an english generated pdf and a dutch one. They represent the same content, but in different languages. I want to mount them respectively on /downloads/cvs_en.pdf and /downloads/cvs_nl.pdf (in general, /downloads/resourcename_locale.pdf). And I want a resource link in the page which links to the proper one of the two depending on the current locale...

Currently I just have multiple links, one to each (version of the) resource, with only one link visible at a time, but that feels like a hack to me.

Regards,
Sebastiaan

Kent Tong wrote:

Sebastiaan van Erk wrote:
In my web page with the resource link I do the following:

fragment.add(new ResourceLink("cvEnglishLink", new ResourceReference("cvs_en.pdf")) {
        @Override
                public boolean isVisible() {
                        return "en".equals(getLocale().getLanguage());
                }
        });


Try:

public class P1 extends WebPage {
        public P1() {
                ResourceReference resourceRef = new 
ResourceReference("cvs.pdf") {
                        protected Resource newResource() {
                                return new PDFResource(getLocale());
                        }
                };
                resourceRef.setLocale(getLocale()); //THIS IS THE LINE
                ResourceLink link = new ResourceLink("link", resourceRef);
                add(link);
        }
}



-----
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to