RE: template and I18N
Gregor This works template:put name='title' direct='true' bean:message key='app.login' / /template:put or template:put name='title' direct='true' content='bean:message key='app.login'/'/ Cal -Original Message- From: Gregor Rayman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 30, 2001 09:02 To: [EMAIL PROTECTED] Subject: Re: template and I18N Johan Compagner [EMAIL PROTECTED] writes: look at the bean:message tag: bean:message key=title/ johan Hi Johan, this does not help me. bean:message key=title / prints the internationalized word Title. But I want to use it in the template to print various titles. Example (without the headers): ApplicationResources.properties === app.login=Login app.logout=Logout ApplicationResources_de.properties == app.login=Anmelden app.logout=Abmelden now the template files: template.jsp ... headtitletemplate:get name=title //title/head ... login.jsp = template:insert template='/template.jsp' template:put name='title' content='Login' direct='true'/ ... /template:insert logout.jsp == template:insert template='/template.jsp' template:put name='title' content='Logout' direct='true'/ ... /template:insert As you can see, I have to insert the words Login and Logout into the files login.jsp and logout.jsp literally, instead of inserting the keys app.login and app.logout Of course I could use the scripplet approach and use template:put name='title' content='%= resources.getMessage(locale, app.login) %' direct='true' / instead. But is there a nicer way? Something like: template:put name='title' direct='true' bean:message key='app.login' / /template:put Groetjes -- gR
Re: template and I18N
Niall Pemberton [EMAIL PROTECTED] wrote: 1. This was answered before. See following message: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05207.html Thanks. 2. IMHO avoid scriptlets. As well IMHO :-) -- gR
template and I18N
Hi all, I've just started to use Struts and I have some questions: 1. How can I use the I18N features in the template tags? In my template.jsp I've got the following tag: titletemplate:get name='title'//title In the page using this teplate the following: template:put name='title' content='Kalkulation' direct='true'/ I'd like to replace the German text 'Kalkulation' with its key e.g. 'app.title.calculation' Is there a nice way to do this? 2. How can I use use the I18N features in Struts directly in Java Scriplets? Sometimes I need the translated texts in scriplets. What is the best way to access them? Now I am using this aproach: % MessageResources resources = (MessageResources) pageContext.getAttribute( Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE); Locale locale = (Locale) pageContext.getAttribute( Action.LOCALE_KEY, PageContext.SESSION_SCOPE); if (null == locale) { locale = request.getLocale(); } String myText = resources.getMessage(locale, app.the.text,key); % Thanks for an answer -- gR
RE: template and I18N
look at the bean:message tag: bean:message key=title/ johan -Original Message- From: Gregor Rayman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 30, 2001 2:12 PM To: [EMAIL PROTECTED] Subject: template and I18N Hi all, I've just started to use Struts and I have some questions: 1. How can I use the I18N features in the template tags? In my template.jsp I've got the following tag: titletemplate:get name='title'//title In the page using this teplate the following: template:put name='title' content='Kalkulation' direct='true'/ I'd like to replace the German text 'Kalkulation' with its key e.g. 'app.title.calculation' Is there a nice way to do this? 2. How can I use use the I18N features in Struts directly in Java Scriplets? Sometimes I need the translated texts in scriplets. What is the best way to access them? Now I am using this aproach: % MessageResources resources = (MessageResources) pageContext.getAttribute( Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE); Locale locale = (Locale) pageContext.getAttribute( Action.LOCALE_KEY, PageContext.SESSION_SCOPE); if (null == locale) { locale = request.getLocale(); } String myText = resources.getMessage(locale, app.the.text,key); % Thanks for an answer -- gR
Re: template and I18N
Johan Compagner [EMAIL PROTECTED] writes: look at the bean:message tag: bean:message key=title/ johan Hi Johan, this does not help me. bean:message key=title / prints the internationalized word Title. But I want to use it in the template to print various titles. Example (without the headers): ApplicationResources.properties === app.login=Login app.logout=Logout ApplicationResources_de.properties == app.login=Anmelden app.logout=Abmelden now the template files: template.jsp ... headtitletemplate:get name=title //title/head ... login.jsp = template:insert template='/template.jsp' template:put name='title' content='Login' direct='true'/ ... /template:insert logout.jsp == template:insert template='/template.jsp' template:put name='title' content='Logout' direct='true'/ ... /template:insert As you can see, I have to insert the words Login and Logout into the files login.jsp and logout.jsp literally, instead of inserting the keys app.login and app.logout Of course I could use the scripplet approach and use template:put name='title' content='%= resources.getMessage(locale, app.login) %' direct='true' / instead. But is there a nicer way? Something like: template:put name='title' direct='true' bean:message key='app.login' / /template:put Groetjes -- gR
RE: template and I18N
try bean:message key=%= title % / == call teh bean and pass the key using a jsp-value good luck Alexander -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 30, 2001 3:02 PM To: [EMAIL PROTECTED] Subject: Re: template and I18N Johan Compagner [EMAIL PROTECTED] writes: look at the bean:message tag: bean:message key=title/ johan Hi Johan, this does not help me. bean:message key=title / prints the internationalized word Title. But I want to use it in the template to print various titles. Example (without the headers): ApplicationResources.properties === app.login=Login app.logout=Logout ApplicationResources_de.properties == app.login=Anmelden app.logout=Abmelden now the template files: template.jsp ... headtitletemplate:get name=title //title/head ... login.jsp = template:insert template='/template.jsp' template:put name='title' content='Login' direct='true'/ ... /template:insert logout.jsp == template:insert template='/template.jsp' template:put name='title' content='Logout' direct='true'/ ... /template:insert As you can see, I have to insert the words Login and Logout into the files login.jsp and logout.jsp literally, instead of inserting the keys app.login and app.logout Of course I could use the scripplet approach and use template:put name='title' content='%= resources.getMessage(locale, app.login) %' direct='true' / instead. But is there a nicer way? Something like: template:put name='title' direct='true' bean:message key='app.login' / /template:put Groetjes -- gR
RE: template and I18N
1. This was answered before. See following message: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05207.html 2. IMHO avoid scriptlets. Niall -Original Message- From: Gregor Rayman [mailto:[EMAIL PROTECTED]] Sent: 30 May 2001 13:12 To: [EMAIL PROTECTED] Subject: template and I18N Hi all, I've just started to use Struts and I have some questions: 1. How can I use the I18N features in the template tags? In my template.jsp I've got the following tag: titletemplate:get name='title'//title In the page using this teplate the following: template:put name='title' content='Kalkulation' direct='true'/ I'd like to replace the German text 'Kalkulation' with its key e.g. 'app.title.calculation' Is there a nice way to do this? 2. How can I use use the I18N features in Struts directly in Java Scriplets? Sometimes I need the translated texts in scriplets. What is the best way to access them? Now I am using this aproach: % MessageResources resources = (MessageResources) pageContext.getAttribute( Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE); Locale locale = (Locale) pageContext.getAttribute( Action.LOCALE_KEY, PageContext.SESSION_SCOPE); if (null == locale) { locale = request.getLocale(); } String myText = resources.getMessage(locale, app.the.text,key); % Thanks for an answer -- gR