You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephan Windmüller <st...@cs.tu-dortmund.de> on 2009/11/13 13:26:17 UTC

Getting I18n messages from another page

Hello!

One quick question: Is it possible to retrieve the I18n messages from
another page? I tried this:

---

class SomePage {
	private Messages messages;

	public String getTitle() {
		return messages.get("title");
	}
}

class AnotherPage {
	@InjectPage
	private SomePage somePage;

	public void printTitle() {
		System.out.println(somePage.getTitle);
	}
}


---

But I always get the title of anotherPage.

TIA
 Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: Getting I18n messages from another page

Posted by "Blower, Andy" <An...@proquest.co.uk>.
You could give both pages a base class (assuming that the app catalog is not an appropriate solution) then the base class has the properties and they can be referenced by both pages. (note that the pages shouldn't have prop files)

> -----Original Message-----
> From: Stephan Windmüller [mailto:stephan.windmueller@cs.tu-dortmund.de]
> Sent: 13 November 2009 12:26
> To: users@tapestry.apache.org
> Subject: Getting I18n messages from another page
> 
> Hello!
> 
> One quick question: Is it possible to retrieve the I18n messages from
> another page? I tried this:
> 
> ---
> 
> class SomePage {
> 	private Messages messages;
> 
> 	public String getTitle() {
> 		return messages.get("title");
> 	}
> }
> 
> class AnotherPage {
> 	@InjectPage
> 	private SomePage somePage;
> 
> 	public void printTitle() {
> 		System.out.println(somePage.getTitle);
> 	}
> }
> 
> 
> ---
> 
> But I always get the title of anotherPage.
> 
> TIA
>  Stephan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Getting I18n messages from another page

Posted by "Juan E. Maya" <ma...@gmail.com>.
I don't think that's possible. If u want to have a common message u
should use the Application Catalog.

On Fri, Nov 13, 2009 at 1:26 PM, Stephan Windmüller
<st...@cs.tu-dortmund.de> wrote:
> Hello!
>
> One quick question: Is it possible to retrieve the I18n messages from
> another page? I tried this:
>
> ---
>
> class SomePage {
>        private Messages messages;
>
>        public String getTitle() {
>                return messages.get("title");
>        }
> }
>
> class AnotherPage {
>        @InjectPage
>        private SomePage somePage;
>
>        public void printTitle() {
>                System.out.println(somePage.getTitle);
>        }
> }
>
>
> ---
>
> But I always get the title of anotherPage.
>
> TIA
>  Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org