Re: i18n Interceptor cookie
śr., 20 lut 2019 o 13:21 Rita Brito napisał(a): > I am defining an i18n interceptor with name="localeStorage">cookie so that a cookie with the user's > selected language is stored. > > Everything is working fine if when I navigate in my domain (eg: > my.domain.com/somepage.html). > > However, when navigating to a subdomain (eg: > my.domain.com/subdomain/somepage.html), a new cookie is created with > path=/subdomain and the previous one (path=/) is not overriden, due to > having different paths (despite having the same name). > > My question is: is there a way of defining the cookie path other than > having a custom i18n interceptor? Sorry but not. You must redefine the interceptor and feel free to open a ticket in JIRA to cover this case. If overriding the interceptor you must just override the "getLocaleHandler" method and implement your own "LocaleHandler". Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: I18N Interceptor Change
HI Zoran, can you please register an Issue for this request? https://issues.apache.org/jira/browse/WW Thank you Johannes # web: http://www.jgeppert.com twitter: http://twitter.com/jogep 2016-08-16 12:06 GMT+02:00 Zoran Avtarovski: > HI Guys, > > > > We have an old project which has been happily working for years. Recently > we updated it to 2.5.x which was surprisingly easy. > > > > One issue we did run into which was quite annoying was the I18N > Interceptor now validates locales against the list of default available > locales in this bit of code: > > > > if (locale != null && > !Arrays.asList(Locale.getAvailableLocales()).contains(locale)) > { > > locale = Locale.getDefault(); > > } > > > > The problem is our app is for refugees and not all the languages in in the > available locales array. This must be relatively new as it worked in the > old version 2.x ish. > > > > As a work-around we over-rode the standard interceptor without the > validation but I wanted to ask if the sore team could use a parameter to > bi-pass the validation. > > > > For example a tag in the struts.xml file: > > > > > > > > false > > > > > > > > and then access it in the interceptor. > > > > Z. > >
Re: i18N @s.radio enum
Hi, Using s:set tag, s:select list can use I18N text. Please refer following. https://stackoverflow.com/questions/5548104/struts-select-tag-localization-implementation/17258640#17258640 I think, s:radio tag is also be able to localize with s:set tag. Regards, Noriyuki Okamoto - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n language setting
I think you can pass request_locale via the URL. So index.action?request_locale=du_NL. I think this will then keep in in the session until you change it. Check out http://struts.apache.org/2.x/docs/faqs.html - localization section. In particular http://struts.apache.org/2.x/docs/how-do-we-change-locales.html. On Sat, Sep 24, 2011 at 3:13 PM, Debraj Mallick sridebrajmall...@gmail.comwrote: hi, i need to set language form action, if i set struts.locale = du_NL in struts.properties then dutch will the default language. how can i set language from action, i have tried using session.put(WW_TRANS_I18N_LOCALE, du_NL); and locale = new Locale(du); ActionContext.getContext().setLocale(locale); but all these does not work. any suggestion would be appreciated. Thanks Regards, Debraj Mallick 9674247281 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n problem with Struts2 - getting weird
Yeah. But the issue was that i have not defined the needed: %...@page pageEncoding=UTF-8 contentType=text/html; charset=UTF-8 % --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 05.04.2010 um 13:58 schrieb Alex Rodriguez Lopez: Do you have your struts.custom.i18n.resources property correctly assigned to your bundle(s)? Em 05-04-2010 11:27, Marc Logemann escreveu: Hi, imagine the following jsp (saved in UTF-8 encoding): -- snipp --- %@ taglib prefix=s uri=/struts-tags % html body Hauptmenübr/ s:text name=menu.mainmenu/br/ s:property value=foo/br/ /body /html -- END snipp --- Now i have a resource bundle like that: menu.mainmenu=Hauptmen\u00fc Inside its the german u with 2 dots on top. Now i run the following action: -- snipp --- public class TestStruts2Action extends ActionSupport { String foo; public String execute() { foo = getText(menu.mainmenu); return Action.SUCCESS; } public String getFoo() { return foo; } } -- END snipp --- When i run this in the browser, i am getting 3 different things. * The hardcoded Hauptmenü in the JSP will be displayed correcty. This means that the browser has correctly read the stream with a UTF-8 encoder. * The string gets out of the bundle vias:text ... wil be broken. Instead of an Entity or the raw UTF-8 character, i am getting ef bf bd as last character, means unknown character. * the third way of exposing attribute foo will result in the word Hauptmenuuml; (with the correct HTML entity). Remeber, it comes from the same bundle as you can see in the action. So something is wrong withs:text tag but what. I tried solving this one for about 4 hours without any luck. When switching the browser encoding to ISO-8859-1, thes:text works but then of course variant 1 doesnt work because i hardcoded the umlaut to the JSP and i definitely need that running because thats the natural way to do. Thanks for hints. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n problem with Struts2 - getting weird
Do you have your struts.custom.i18n.resources property correctly assigned to your bundle(s)? Em 05-04-2010 11:27, Marc Logemann escreveu: Hi, imagine the following jsp (saved in UTF-8 encoding): -- snipp --- %@ taglib prefix=s uri=/struts-tags % html body Hauptmenübr/ s:text name=menu.mainmenu/br/ s:property value=foo/br/ /body /html -- END snipp --- Now i have a resource bundle like that: menu.mainmenu=Hauptmen\u00fc Inside its the german u with 2 dots on top. Now i run the following action: -- snipp --- public class TestStruts2Action extends ActionSupport { String foo; public String execute() { foo = getText(menu.mainmenu); return Action.SUCCESS; } public String getFoo() { return foo; } } -- END snipp --- When i run this in the browser, i am getting 3 different things. * The hardcoded Hauptmenü in the JSP will be displayed correcty. This means that the browser has correctly read the stream with a UTF-8 encoder. * The string gets out of the bundle vias:text ... wil be broken. Instead of an Entity or the raw UTF-8 character, i am getting ef bf bd as last character, means unknown character. * the third way of exposing attribute foo will result in the word Hauptmenuuml; (with the correct HTML entity). Remeber, it comes from the same bundle as you can see in the action. So something is wrong withs:text tag but what. I tried solving this one for about 4 hours without any luck. When switching the browser encoding to ISO-8859-1, thes:text works but then of course variant 1 doesnt work because i hardcoded the umlaut to the JSP and i definitely need that running because thats the natural way to do. Thanks for hints. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: i18n database backed
Lukasz - I have configured the bean in struts.xml as follows: bean type=com.opensymphony.xwork2.TextProvider name=seek class=com.setech.seek.struts2.i18n.TextProviderSupport / Aside from configuring this bean with the tag above, is there any other settings or changes I need to make to my struts.xml configuration allowing this provider to be used when I use s:text/ and getText() methods? Chris -Original Message- From: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] Sent: Monday, February 15, 2010 12:58 AM To: Struts Users Mailing List Subject: Re: i18n database backed 2010/2/12 CRANFORD, CHRIS chris.cranf...@setech.com: Anyone have any suggested ways to support i18n internationalization backed by a database table rather than property files? You have to write your own TextProvider - take a look on ActionSupport implementation to get more details. And then configure it as a bean in struts.xml Regards -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n database backed
W dniu 15 lutego 2010 15:15 użytkownik CRANFORD, CHRIS chris.cranf...@setech.com napisał: Lukasz - I have configured the bean in struts.xml as follows: bean type=com.opensymphony.xwork2.TextProvider name=seek class=com.setech.seek.struts2.i18n.TextProviderSupport / Aside from configuring this bean with the tag above, is there any other settings or changes I need to make to my struts.xml configuration allowing this provider to be used when I use s:text/ and getText() methods? You have to define your bean as below, to override framework settings: bean type=com.opensymphony.xwork2.TextProvider name=xwork1 class=com.setech.seek.struts2.i18n.TextProviderSupport scope=default / bean type=com.opensymphony.xwork2.TextProvider name=struts class=com.setech.seek.struts2.i18n.TextProviderSupport scope=default / And also, are all your actions base on ActionSupport? -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n database backed
W dniu 15 lutego 2010 15:28 użytkownik CRANFORD, CHRIS chris.cranf...@setech.com napisał: Yes they are. In fact, all my actions are based on a custom common action called SeekBaseAction which extends ActionSupport. So, just define TextProvider as mentioned by me and should work! Regards -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: i18n database backed
k -Original Message- From: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] Sent: Monday, February 15, 2010 8:38 AM To: Struts Users Mailing List Subject: Re: i18n database backed W dniu 15 lutego 2010 15:28 użytkownik CRANFORD, CHRIS chris.cranf...@setech.com napisał: Yes they are. In fact, all my actions are based on a custom common action called SeekBaseAction which extends ActionSupport. So, just define TextProvider as mentioned by me and should work! Regards -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n database backed
W dniu 15 lutego 2010 17:33 użytkownik CRANFORD, CHRIS chris.cranf...@setech.com napisał: 2.1.6 I cannot move to 2.1.8 yet without impact to a few other things sadly :(. I made a small mistake, you have to define your own bean and then define two constants in struts.xml: bean class=org.demo.MyTextProvider name=myTextProvider type=com.opensymphony.xwork2.TextProvider/ constant name=struts.xworkTextProvider value=myTextProvider/ if you want to also use your implementation for framework's messages define another constant (remember to put all framework messages into) constant name=system value=myTextProvider / But that will work from version 2.1.7 of xwork (Struts 2.1.8). You can try to define your own ActionSupport and implement as it is right now http://svn.opensymphony.com/svn/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java Regards -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n database backed
2010/2/12 CRANFORD, CHRIS chris.cranf...@setech.com: Anyone have any suggested ways to support i18n internationalization backed by a database table rather than property files? You have to write your own TextProvider - take a look on ActionSupport implementation to get more details. And then configure it as a bean in struts.xml Regards -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n database backed
I can see how it can be beneficial in these ways: 1) The application does not have to be redeployed if changing existing labels. 2) Label descriptions can be modified in real time. 3) If there are multiple applications and common labels, they can be shared among the other applications. If you only have one application, and it's relatively simple, having a database resource may be an overkill. I guess if I were supporting such a thing, I would create some tables something like this: Table: Resource Columns: resource_sid : Unique identifier for record; autoincrementing # value label_name : Resource identifier label_text : Text to associate with label language_code : Coded value representing the language Composite key would be language_code + label_name. Table: Language Columns: language_sid : Unique identifier for record; autoincrementing # value language_code : Coded value representing the language (e.g. 0, 1, 2, ...) langauge_text : Text representing the coded value (e.g. English, Spanish, French, ...) You would then have to track a language code in your user web session and use this code when generating your views to pull out the desired language labels. -- View this message in context: http://old.nabble.com/i18n-database-backed-tp27569081p27579439.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n database backed
Chris, What sort of benefit database will offer over properties files? Regards, Balwinder Kumar CRANFORD, CHRIS wrote: Anyone have any suggested ways to support i18n internationalization backed by a database table rather than property files? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i18n within dojo attribute
You¹re missing the closing inverted comma on fieldPrompt. Z. It occurred to me to use an OGNL form to do this, but I am still having a challenge getting it to work. I've tried s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=${getText('fieldPrompt)} / This gets me past the first problem, but still doesn't work. I am getting message that getText must have a prefix in the default namespace. I'm not sure where to take it from there. Any suggestions? -- Larry - Original Message - From: larryreed larryr...@comcast.net To: user user@struts.apache.org Sent: Friday, October 23, 2009 4:58:42 PM GMT -08:00 US/Canada Pacific Subject: i18n within dojo attribute I have a text field which I would like to 'dojo-ize' by turning it into a ValidationTextBox. One of the parameters, 'promptMessage' is a text message that is put up as a help when the focus enters the text box. My problem is that I would like to internationalize this message. My thought was to place a struts2 text tag as the value of this attribute. However, placing the tag inside the attribute quotes quotes the tag. Here is what I did: s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=Enter field value / This works, but the message is in English. To internationalize it, I tried this: s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=s:text name='fieldPrompt' / / But this quotes the angle brackets and the result is: promptMessage=lt;s:text name='username' /gt; I've tried a couple of other variations that do not work either. Any suggestions as to how I might do this? -- Larry
Re: i18n within dojo attribute
Thank you for your help. This was, I believe, a typo in the email, but not in the code. In any case, including the closing single quote does not solve the problem. Here is the exact text and error message: s:textfield key=siSignInEMail required=true dojoType=dijit.form.ValidationTextBox promptMessage=${getText('siSignInEMail')} / The generated error text: 'The function getText must be used with a prefix when a default namespace is not specified ' In response to Samuel, thank you also. Your solution does not generate an error. It simply results in the text between double quotes being taken literally: s:textfield key=signInEMail required=true dojoType=dijit.form.ValidationTextBox promptMessage=%{getText('signInEMail')} / This results in a prompt containing %{getText('signInEMail')}. - Original Message - From: Zoran Avtarovski zo...@sparecreative.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, October 29, 2009 2:11:30 AM GMT -08:00 US/Canada Pacific Subject: Re: i18n within dojo attribute You¹re missing the closing inverted comma on fieldPrompt. Z. It occurred to me to use an OGNL form to do this, but I am still having a challenge getting it to work. I've tried s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=${getText('fieldPrompt)} / This gets me past the first problem, but still doesn't work. I am getting message that getText must have a prefix in the default namespace. I'm not sure where to take it from there. Any suggestions? -- Larry - Original Message - From: larryreed larryr...@comcast.net To: user user@struts.apache.org Sent: Friday, October 23, 2009 4:58:42 PM GMT -08:00 US/Canada Pacific Subject: i18n within dojo attribute I have a text field which I would like to 'dojo-ize' by turning it into a ValidationTextBox. One of the parameters, 'promptMessage' is a text message that is put up as a help when the focus enters the text box. My problem is that I would like to internationalize this message. My thought was to place a struts2 text tag as the value of this attribute. However, placing the tag inside the attribute quotes quotes the tag. Here is what I did: s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=Enter field value / This works, but the message is in English. To internationalize it, I tried this: s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=s:text name='fieldPrompt' / / But this quotes the angle brackets and the result is: promptMessage=lt;s:text name='username' /gt; I've tried a couple of other variations that do not work either. Any suggestions as to how I might do this? -- Larry
Re: i18n within dojo attribute
It occurred to me to use an OGNL form to do this, but I am still having a challenge getting it to work. I've tried s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=${getText('fieldPrompt)} / This gets me past the first problem, but still doesn't work. I am getting message that getText must have a prefix in the default namespace. I'm not sure where to take it from there. Any suggestions? -- Larry - Original Message - From: larryreed larryr...@comcast.net To: user user@struts.apache.org Sent: Friday, October 23, 2009 4:58:42 PM GMT -08:00 US/Canada Pacific Subject: i18n within dojo attribute I have a text field which I would like to 'dojo-ize' by turning it into a ValidationTextBox. One of the parameters, 'promptMessage' is a text message that is put up as a help when the focus enters the text box. My problem is that I would like to internationalize this message. My thought was to place a struts2 text tag as the value of this attribute. However, placing the tag inside the attribute quotes quotes the tag. Here is what I did: s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=Enter field value / This works, but the message is in English. To internationalize it, I tried this: s:textfield key=fieldName dojoType=dijit.form.ValidationTextBox promptMessage=s:text name='fieldPrompt' / / But this quotes the angle brackets and the result is: promptMessage=lt;s:text name='username' /gt; I've tried a couple of other variations that do not work either. Any suggestions as to how I might do this? -- Larry
RE: I18n blew up
Upon further examination, it looks like 'struts.properties' is not being loaded -- When I cause an exception, I don't see the development-mode data that I would expect for having this line in that file: struts.devMode = true Still very confused. -Original Message- From: Jon Pearson Sent: Tuesday, May 19, 2009 3:59 PM To: Struts Users Mailing List Subject: I18n blew up I moved away from the web side of my project for a couple of days to take a break, and now as I come back, I18n has completely stopped working. In 'struts.properties' I have the line struts.custom.i18n.resources = global-messages And in 'global-messages.properties' I have text like this i18n.property = Property i18n.value = Value i18n.submit = Submit But Struts can't seem to find these properties... Any idea what might have happened? I don't think I changed anything related to this since last week, when it was working... If it helps any, I'm using Eclipse for Java EE and Tomcat 6.0.18. Sorry to post a tech-support type of problem, but it really makes no sense to me. Jonathan P. Pearson - Software Engineer -- SIXNET - Solutions for Your Industrial Networking Challenges 331 Ushers Road, Ballston Lake, NY 12019 Tel: 1.518.877.5173, Fax: 1.518.877.8346 www.sixnet.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: I18n blew up
As far as I can tell, Eclipse is placing struts.xml into WEB-INF/classes when it deploys to Tomcat, but not struts.properties or any of the other important files that I need. No idea why, and I haven't yet figured out how to fix this. Anyone else experience a problem like this? Any idea how to get Eclipse to behave properly again? -Original Message- From: Jon Pearson Sent: Tuesday, May 19, 2009 4:04 PM To: Struts Users Mailing List Subject: RE: I18n blew up Upon further examination, it looks like 'struts.properties' is not being loaded -- When I cause an exception, I don't see the development-mode data that I would expect for having this line in that file: struts.devMode = true Still very confused. -Original Message- From: Jon Pearson Sent: Tuesday, May 19, 2009 3:59 PM To: Struts Users Mailing List Subject: I18n blew up I moved away from the web side of my project for a couple of days to take a break, and now as I come back, I18n has completely stopped working. In 'struts.properties' I have the line struts.custom.i18n.resources = global-messages And in 'global-messages.properties' I have text like this i18n.property = Property i18n.value = Value i18n.submit = Submit But Struts can't seem to find these properties... Any idea what might have happened? I don't think I changed anything related to this since last week, when it was working... If it helps any, I'm using Eclipse for Java EE and Tomcat 6.0.18. Sorry to post a tech-support type of problem, but it really makes no sense to me. Jonathan P. Pearson - Software Engineer -- SIXNET - Solutions for Your Industrial Networking Challenges 331 Ushers Road, Ballston Lake, NY 12019 Tel: 1.518.877.5173, Fax: 1.518.877.8346 www.sixnet.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: I18n blew up
typical use is to use getText to acquire the property attribute as defined here s:textfield label=%{getText('label.firstName')} name=firstName /modifying controlheader-core.ftl would allow you to supply neccesary call to getText ${parameters.label?html}:#t/ #assign mm=getText('+parameters.label?html+') /#t/ ${stack.findValue(mm)}:#t/ !-- you can now use the value of label as the key without intervening getText -- s:textfield label=label.firstName name=firstName / struts-default.xml defines the interceptor class as interceptor name=i18n class=com.opensymphony.xwork2.interceptor.I18nInterceptor/ http://www.docjar.com/html/api/com/opensymphony/xwork2/interceptor/I18nInterceptor.java.html which either gets/sets the request_locale parameter and pushes that to ActionContext.map s:param name=request_localeen/s:param http://cwiki.apache.org/WW/internationalization.html properties are located in one of the following locations ActionClass.propertiesBaseClass.properties (all the way to Object.properties)Interface.properties (every interface and sub-interface)package.properties struts.properties 6.webwork.properties HTH Martin __ Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: RE: I18n blew up Date: Tue, 19 May 2009 16:04:15 -0400 From: jon.pear...@sixnet.com To: user@struts.apache.org Upon further examination, it looks like 'struts.properties' is not being loaded -- When I cause an exception, I don't see the development-mode data that I would expect for having this line in that file: struts.devMode = true Still very confused. -Original Message- From: Jon Pearson Sent: Tuesday, May 19, 2009 3:59 PM To: Struts Users Mailing List Subject: I18n blew up I moved away from the web side of my project for a couple of days to take a break, and now as I come back, I18n has completely stopped working. In 'struts.properties' I have the line struts.custom.i18n.resources = global-messages And in 'global-messages.properties' I have text like this i18n.property = Property i18n.value = Value i18n.submit = Submit But Struts can't seem to find these properties... Any idea what might have happened? I don't think I changed anything related to this since last week, when it was working... If it helps any, I'm using Eclipse for Java EE and Tomcat 6.0.18. Sorry to post a tech-support type of problem, but it really makes no sense to me. Jonathan P. Pearson - Software Engineer -- SIXNET - Solutions for Your Industrial Networking Challenges 331 Ushers Road, Ballston Lake, NY 12019 Tel: 1.518.877.5173, Fax: 1.518.877.8346 www.sixnet.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
RE: I18n blew up
Thanks, but the problem is definitely Eclipse. It was working last week, and now it isn't. Eclipse isn't copying the necessary properties files containing those translations for getText() when I deploy to my local Tomcat server for development/testing. It will copy struts.xml, but none of the other files (including other .xml files which struts.xml references). -Original Message- From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Tuesday, May 19, 2009 5:00 PM To: Struts Users Mailing List Subject: RE: I18n blew up typical use is to use getText to acquire the property attribute as defined here s:textfield label=%{getText('label.firstName')} name=firstName /modifying controlheader-core.ftl would allow you to supply neccesary call to getText ${parameters.label?html}:#t/ #assign mm=getText('+parameters.label?html+') /#t/ ${stack.findValue(mm)}:#t/ !-- you can now use the value of label as the key without intervening getText -- s:textfield label=label.firstName name=firstName / struts-default.xml defines the interceptor class as interceptor name=i18n class=com.opensymphony.xwork2.interceptor.I18nInterceptor/ http://www.docjar.com/html/api/com/opensymphony/xwork2/interce ptor/I18nInterceptor.java.html which either gets/sets the request_locale parameter and pushes that to ActionContext.map s:param name=request_localeen/s:param http://cwiki.apache.org/WW/internationalization.html properties are located in one of the following locations ActionClass.propertiesBaseClass.properties (all the way to Object.properties)Interface.properties (every interface and sub-interface)package.properties struts.properties 6.webwork.properties HTH Martin __ Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: RE: I18n blew up Date: Tue, 19 May 2009 16:04:15 -0400 From: jon.pear...@sixnet.com To: user@struts.apache.org Upon further examination, it looks like 'struts.properties' is not being loaded -- When I cause an exception, I don't see the development-mode data that I would expect for having this line in that file: struts.devMode = true Still very confused. -Original Message- From: Jon Pearson Sent: Tuesday, May 19, 2009 3:59 PM To: Struts Users Mailing List Subject: I18n blew up I moved away from the web side of my project for a couple of days to take a break, and now as I come back, I18n has completely stopped working. In 'struts.properties' I have the line struts.custom.i18n.resources = global-messages And in 'global-messages.properties' I have text like this i18n.property = Property i18n.value = Value i18n.submit = Submit But Struts can't seem to find these properties... Any idea what might have happened? I don't think I changed anything related to this since last week, when it was working... If it helps any, I'm using Eclipse for Java EE and Tomcat 6.0.18. Sorry to post a tech-support type of problem, but it really makes no sense to me. Jonathan P. Pearson - Software Engineer -- SIXNET - Solutions for Your Industrial Networking Challenges 331 Ushers Road, Ballston Lake, NY 12019 Tel: 1.518.877.5173, Fax: 1.518.877.8346 www.sixnet.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e
RE: I18n blew up
Fixed -- I had been building the properties files and whatnot in the src/ folder, and Eclipse had been copying them. But then it stopped, so I had to manually move my files from src/ to web/WEB-INF/classes/. Not that this is an Eclipse support forum, but I thought that someone else may encounter this issue in the future. -Original Message- From: Jon Pearson Sent: Tuesday, May 19, 2009 5:04 PM To: Struts Users Mailing List Subject: RE: I18n blew up Thanks, but the problem is definitely Eclipse. It was working last week, and now it isn't. Eclipse isn't copying the necessary properties files containing those translations for getText() when I deploy to my local Tomcat server for development/testing. It will copy struts.xml, but none of the other files (including other .xml files which struts.xml references). -Original Message- From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Tuesday, May 19, 2009 5:00 PM To: Struts Users Mailing List Subject: RE: I18n blew up typical use is to use getText to acquire the property attribute as defined here s:textfield label=%{getText('label.firstName')} name=firstName /modifying controlheader-core.ftl would allow you to supply neccesary call to getText ${parameters.label?html}:#t/ #assign mm=getText('+parameters.label?html+') /#t/ ${stack.findValue(mm)}:#t/ !-- you can now use the value of label as the key without intervening getText -- s:textfield label=label.firstName name=firstName / struts-default.xml defines the interceptor class as interceptor name=i18n class=com.opensymphony.xwork2.interceptor.I18nInterceptor/ http://www.docjar.com/html/api/com/opensymphony/xwork2/interce ptor/I18nInterceptor.java.html which either gets/sets the request_locale parameter and pushes that to ActionContext.map s:param name=request_localeen/s:param http://cwiki.apache.org/WW/internationalization.html properties are located in one of the following locations ActionClass.propertiesBaseClass.properties (all the way to Object.properties)Interface.properties (every interface and sub-interface)package.properties struts.properties 6.webwork.properties HTH Martin __ Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: RE: I18n blew up Date: Tue, 19 May 2009 16:04:15 -0400 From: jon.pear...@sixnet.com To: user@struts.apache.org Upon further examination, it looks like 'struts.properties' is not being loaded -- When I cause an exception, I don't see the development-mode data that I would expect for having this line in that file: struts.devMode = true Still very confused. -Original Message- From: Jon Pearson Sent: Tuesday, May 19, 2009 3:59 PM To: Struts Users Mailing List Subject: I18n blew up I moved away from the web side of my project for a couple of days to take a break, and now as I come back, I18n has completely stopped working. In 'struts.properties' I have the line struts.custom.i18n.resources = global-messages And in 'global-messages.properties' I have text like this i18n.property = Property i18n.value = Value i18n.submit = Submit But Struts can't seem to find these properties... Any idea what might have happened? I don't think I changed anything related to this since last week, when it was working
Re: I18N on labels of form
2009/1/23 Michael Obster mich...@obster.org: Writing s:textfield ... label=s:property value=mystring / / doesn't work. Is there a way to implement correct I18N on form labels? Use key attribute instead s:textfield key=mystring name=myProperty/ or you can use OGNL expression s:textfield label=%{getText('mystring')} namemyProperty/ Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: I18N on labels of form
Thank you! /Michael Lukasz Lenart schrieb: 2009/1/23 Michael Obster mich...@obster.org: Writing s:textfield ... label=s:property value=mystring / / doesn't work. Is there a way to implement correct I18N on form labels? Use key attribute instead s:textfield key=mystring name=myProperty/ or you can use OGNL expression s:textfield label=%{getText('mystring')} namemyProperty/ Regards - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: I18n problem
--- On Sun, 9/28/08, [EMAIL PROTECTED] wrote: [...] for maintenance reasons, i prefer to have one copy or the doc for each locale i must provide, and to switch in function of the current locale. There is some features of s2 i can use? Depending on how you're delivering the document the information provided by ActionSupport.getLocale() may be all you need to create the document's filename, for example. The information in the I18N interceptor [1], ActionSupport [2], and LocaleProvider [3] docs may point you in the right direction. Dave [1] http://struts.apache.org/2.x/docs/i18n-interceptor.html [2] http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html [3] http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/LocaleProvider.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N issue in form tags
s:textfield id=authorSearchPost label=s:text name='back.comment.search.author' / name=author/ Use instead s:textfield key=back.comment.search.author name=author / Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N issue in form tags
It works perfectly, thank you very much ! 2008/8/19 Lukasz Lenart [EMAIL PROTECTED] s:textfield id=authorSearchPost label=s:text name='back.comment.search.author' / name=author/ Use instead s:textfield key=back.comment.search.author name=author / Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N issue in form tags
--- On Tue, 8/19/08, matthieu martin wrote: It works perfectly, thank you very much ! 2008/8/19 Lukasz Lenart s:textfield id=authorSearchPost label=s:text name='back.comment.search.author' / name=author/ For completeness, the reason this doesn't work is because you can't nest custom tags like that; that would imply recursive tag parsing, and it doesn't work like that. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Struts Jco Code in Windows English and Polish System
On Friday 23 May 2008 13:51:08 Raghuveer wrote: I am working on Struts ,SAP-JCO . This is i18n application running on Tomcat. I have designed my application in UTF8 charset. When Saving the polish characters from application they are saved into SAP Database properly. Before Saving i am doing following String modifications. The same code doesn't work on Tomcat Server on Windows English System.Here the Polish characters( aeclónszz ) are saved as #. What would be cause for this. What changes i need to do in my code to work on both English And Polish Windows (Tomcat Server) strConvertedMessage = new String(strText.getBytes(UTF8), UTF8); inputTable.setValue(strConvertedMessage,TABLENAME); Without more information, it's difficult to suggest the soloution, but a couple of questions come to mind. Firstly what are the values of strConvertedMessage and inputTable before you try to update SAP? Have you tried debugging your Function Module in SAP to see what SAP is recieving before you commit your update to the database (I assume that its Oracle?) Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Struts Jco Code in Windows English and Polish System
Raghuveer wrote: I am working on Struts ,SAP-JCO . This is i18n application running on Tomcat. I have designed my application in UTF8 charset. When Saving the polish characters from application they are saved into SAP Database properly. Before Saving i am doing following String modifications. The same code doesn't work on Tomcat Server on Windows English System.Here the Polish characters( aeclónszz ) are saved as #. What would be cause for this. What changes i need to do in my code to work on both English And Polish Windows (Tomcat Server) strConvertedMessage = new String(strText.getBytes(UTF8), UTF8); inputTable.setValue(strConvertedMessage,TABLENAME); That string conversion is redundant. You are saying convert this string into a sequence of bytes in UTF-8 and then interpret those bytes as UTF-8 to construct a new string. Assuming strText is not null, strText.equals(strConvertedMessage) is garanteed true. There are a number of places where character set conversion can get messed up. It may be right up front when accessing the request parameters, during propagation into your SAP database, on retrieval from the database, or during output (assuming you're not doing something bad with the data in between those points). Start by figuring out exactly where the mis-encoding occurs; that should tell you which input/output boundary to concentrate on. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
mraible wrote: Yes, that sound about right. My action is a POJO that only extends ModelDriven. WW-2592 Struts2.1.1 now provides useful developer feedback for missing text resources: - when a TextProvider was not found, - when a message was not found, - when the default value was used as an expression, - when the default value was used as a literal string eg. WARNING: [04:28.191] Could not find property [some] WARNING: [04:28.211] The first TextProvider in the ValueStack (org.apache.struts2.TestAction) could not locate the message resource with key 'some.invalid.key.so.we.should.get.the.default.message' WARNING: [04:28.211] The default value expression 'Sample Of Default Message' was evaluated and did not match a property. The literal value 'Sample Of Default Message' will be used. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
That¹s great news Jeromy. You don¹t know how much this will help us. As an aside, is there a timeline for the appearance of an official 2.1 beta build? Z. mraible wrote: Yes, that sound about right. My action is a POJO that only extends ModelDriven. WW-2592 Struts2.1.1 now provides useful developer feedback for missing text resources: - when a TextProvider was not found, - when a message was not found, - when the default value was used as an expression, - when the default value was used as a literal string eg. WARNING: [04:28.191] Could not find property [some] WARNING: [04:28.211] The first TextProvider in the ValueStack (org.apache.struts2.TestAction) could not locate the message resource with key 'some.invalid.key.so.we.should.get.the.default.message' WARNING: [04:28.211] The default value expression 'Sample Of Default Message' was evaluated and did not match a property. The literal value 'Sample Of Default Message' will be used. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
Zoran Avtarovski wrote: That¹s great news Jeromy. You don¹t know how much this will help us. As an aside, is there a timeline for the appearance of an official 2.1 beta build? Z. Hi Zoran. I'm not really sure. We tried to push forward and hit a small obstacle.. If nothing progresses I'll push again around the end of the month. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
Jeromy Evans - Blue Sky Minds wrote: mraible wrote: I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins. FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags in my decorator. In src/main/resources/com/company/app/package.properties, I have: webapp.name=Foo webapp.tagline=Bar In my decorators/default.ftl, I have: [EMAIL PROTECTED] name=webapp.name/] And it renders: webapp.name I've committed an update to 2.1.1 that may affect this. However, my guess is that your action doesn't extend ActionSupport and there's no alternate TextProvider available. In that case, the first TextProvider found is the DefaultTextProvider which only serves resources from the global resource bundle. Does that sound right? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yes, that sound about right. My action is a POJO that only extends ModelDriven. -- View this message in context: http://www.nabble.com/i18n-Tags-in-FreeMarker-Decorator-for-SiteMesh-tp16599500p16646077.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
mraible wrote: I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins. FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags in my decorator. In src/main/resources/com/company/app/package.properties, I have: webapp.name=Foo webapp.tagline=Bar In my decorators/default.ftl, I have: [EMAIL PROTECTED] name=webapp.name/] And it renders: webapp.name I've committed an update to 2.1.1 that may affect this. However, my guess is that your action doesn't extend ActionSupport and there's no alternate TextProvider available. In that case, the first TextProvider found is the DefaultTextProvider which only serves resources from the global resource bundle. Does that sound right? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
mraible wrote: I tried [EMAIL PROTECTED] value=text('key')/] and that doesn't seem to work either. I don't have a struts.xml or struts.properties in my project. I tried putting the i18n bundle in all packages using it at the Action level (ActionName.properties), but that didn't work either. Creating a src/main/resources/struts.properties with the following in it is the only thing that seems to work. struts.custom.i18n.resources=messages And then putting my keys in src/main/resources/messages.properties. AFAICT, i18n bundles at the action/package level seems to be completely broken in 2.1.1. Matt Sorry Matt, I can't replicate this issue. I created a freemarker decorator that uses @s.text and it was able to find: - resources in the global resource bundle (specified via struts.custom.i18n.resources) - resources in the named resource bundle when contained within an @s.i18n tag - resources in the actionName.properties resource bundle - resources in the package.properties resource bundle I used each technique one at at a time, inside and outside a decorator and in both FTL and JSP. My test action extended ActionSupport for the TextProvider. However, I'm am still convinced there's a problem. A possible scenario: - getText matches the first TextProvider found in the value stack. Not the first TextProvider providing the requested key. - some operations can push another TextProvider onto the stack (in front of the action). The i18n tag does this. - there are cases where the alternate TextProvider is not popped off the stack (see https://issues.apache.org/struts/browse/WW-2539) I've started cleaning up the implementation to isolate it. See my post in struts-dev. regards, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
Hi Matt, is it only the @s.text tag that isn't working? eg. is @s.property working? I've suspected there's a problem with the text tag and i18n tag not finding some resource bundles in the S2.1.1 branch but haven't had a chance to investigate. There's several related issues in JIRA and I recall something specifically about package-level properties. I may have an opportunity to investigate later today. Does it find resources in your action-properties or global properties? cheers, Jeromy Evans mraible wrote: I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins. FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags in my decorator. In src/main/resources/com/company/app/package.properties, I have: webapp.name=Foo webapp.tagline=Bar In my decorators/default.ftl, I have: [EMAIL PROTECTED] name=webapp.name/] And it renders: webapp.name Any idea why my Struts FreeMarker tag isn't being processed? I have the following in my web.xml: filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
I tried [EMAIL PROTECTED] value=text('key')/] and that doesn't seem to work either. I don't have a struts.xml or struts.properties in my project. I tried putting the i18n bundle in all packages using it at the Action level (ActionName.properties), but that didn't work either. Creating a src/main/resources/struts.properties with the following in it is the only thing that seems to work. struts.custom.i18n.resources=messages And then putting my keys in src/main/resources/messages.properties. AFAICT, i18n bundles at the action/package level seems to be completely broken in 2.1.1. Matt Jeromy Evans - Blue Sky Minds wrote: Hi Matt, is it only the @s.text tag that isn't working? eg. is @s.property working? I've suspected there's a problem with the text tag and i18n tag not finding some resource bundles in the S2.1.1 branch but haven't had a chance to investigate. There's several related issues in JIRA and I recall something specifically about package-level properties. I may have an opportunity to investigate later today. Does it find resources in your action-properties or global properties? cheers, Jeromy Evans mraible wrote: I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins. FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags in my decorator. In src/main/resources/com/company/app/package.properties, I have: webapp.name=Foo webapp.tagline=Bar In my decorators/default.ftl, I have: [EMAIL PROTECTED] name=webapp.name/] And it renders: webapp.name Any idea why my Struts FreeMarker tag isn't being processed? I have the following in my web.xml: filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/i18n-Tags-in-FreeMarker-Decorator-for-SiteMesh-tp16599500p16601141.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
mraible wrote: I tried [EMAIL PROTECTED] value=text('key')/] I've already found that in 2.0.x this OGNL expression executed getText(String) but in 2.1.x it only matches the method text(String). I'm not sure when that changed in the OGNL implementation, but the new form seems correct as it's method call not a property. I've already replaced one occurrence of text('key') with getText('key') in the code but there's probably others. That's one of the consequences of allowing loosely typed expressions to creep into code. I'll definitely look further into this today as its been affecting me for a while too. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18N jsp application on linux and windows
Raghuveer wrote: Hello Lauri, This is with reference.. http://www.mail-archive.com/user@struts.apache.org/msg72782.html [...] response.getCharacterEncoding()is returning ISO-8859-1. I have set it to charset - ISO-8859-2 in JSP pages but it is returning “charset - ISO-8859-1”. Then you have something missing somewhere; from my first reply which you didn't answer: I have set ISO8859_2 in JSP page for charset. %@ page contentType=text/html;charset=ISO8859_2 % This tells the JSP engine what character encoding to use. Do you also have an HTML meta http-equiv tag in the head of your page to tell the browser what encoding it should use to process the page? When the browser submits a form, it should use the character encoding of the page that the form is in. If that's not working, start by fixing that. Same thing is happening in windows and Linux. It is working in windows with this conversion(convertTo_IS08559_2) but failing in Linux.. As I said, the conversion code you have is semantically incorrect and shouldn't be necessary anyway. Remove it and fix the issue above and see where you are then. L. Regards, Raghu _ From: Laurie Harper [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 19, 2008 4:24 AM To: [EMAIL PROTECTED] Subject: Re: i18N jsp application on linux and windows Uh, yeah, I got that; that's why I've replied to you twice, on the list; see also: http://www.mail-archive.com/user@struts.apache.org/msg72782.html Please follow up on-list if you need further help, to keep the discussion where everyone can see it. L. On 18-Feb-08, at 8:50 AM, Raghuveer wrote: I need an help related to i18n (internationalization),… http://www.mail-archive.com/user@struts.apache.org/msg72581.html http://www.mail-archive.com/user@struts.apache.org/msg72581.html I am developing an application an struts application to be used in poland for English,polish language on tomcat. There is scenario to extract SAP messages and show to the user in browser in JSP page. I have written following method to read SAP message and Convert to charsetThis is working for me on XP and Windows 2000 in Hyderabad. IS0-559-2And in JSP pages %@ page contentType=text/html;charset=iso-8859-2 % But messages are corrupted some times and getting Question marks when deployed and tested application in Poland on Linux. Linux- Nr potwierdzenia 8018340248 nie zostaÅ‚ znaleziony (proszÄ™ sprawdzić wpis) Windows Nr potwierdzenia 22 nie zosta³ znaleziony (proszê sprawdziæ wpis) - String convertTo_IS08559_2(HttpServletResponse response, StringstrMessage) throws UnsupportedEncodingException{ String charset = response.getCharacterEncoding(); Log.info(CLASS_NAME + - +METHOD_NAME+ - charset - +charset); try { } catch (UnsupportedEncodingException e) { //e.printStackTrace(); throw e; } return strFormatedMessage; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18N jsp application on linux and windows
I need an help related to i18n (internationalization),… http://www.mail-archive.com/user@struts.apache.org/msg72581.html I am developing an application an struts application to be used in poland for English,polish language on tomcat. There is scenario to extract SAP messages and show to the user in browser in JSP page. I have written following method to read SAP message and Convert to IS0-559-2 charset( for Poland). This is working for me on XP and Windows 2000 in Hyderabad. I have used IS0-559-2 as encoding attribute in web.xml And in JSP pages %@ page contentType=text/html;charset=iso-8859-2 % But messages are corrupted some times and getting Question marks when deployed and tested application in Poland on Linux. Linux- Nr potwierdzenia 8018340248 nie zostaÅ‚ znaleziony (proszÄ™ sprawdzić wpis) Windows Nr potwierdzenia 22 nie zosta³ znaleziony (proszê sprawdziæ wpis) - private String convertTo_IS08559_2(HttpServletResponse response, String strMessage) throws UnsupportedEncodingException{ final String METHOD_NAME = convertTo_IS08559_2() : ; // holds method name for logger messages String charset = response.getCharacterEncoding(); String strFormatedMessage=null; // holds formatted message Log.info(CLASS_NAME + - +METHOD_NAME+ - response - +response); Log.info(CLASS_NAME + - +METHOD_NAME+ - charset - +charset); Log.info(CLASS_NAME + - +METHOD_NAME+ - strMessage - +strMessage); if(strMessage!=null strMessage.length()0){ try { strFormatedMessage = new String(strMessage.getBytes(charset), ISO-8859-2); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block //e.printStackTrace(); Log.error(CLASS_NAME + - +METHOD_NAME+ - UnsupportedEncodingException - +e); throw e; } } Log.info(CLASS_NAME + - +METHOD_NAME+ - str - +strFormatedMessage); return strFormatedMessage; }
Re: i18N jsp application on linux and windows
Did you see my previous reply? http://www.nabble.com/i18N--jsp-application-on-linux-and-windows-tp15451735p15467087.html And for the record, your convertTo... method probably isn't doing the right thing. If response.getCharacterEncoding() returns anything other than ISO-8859-2, your code will corrupt the string since it's explicitly trying to apply ISO-8859-2 encoding to a set of bytes in a different character set...! I'd start by ripping that code out all together. L. Raghuveer wrote: I need an help related to i18n (internationalization),… http://www.mail-archive.com/user@struts.apache.org/msg72581.html I am developing an application an struts application to be used in poland for English,polish language on tomcat. There is scenario to extract SAP messages and show to the user in browser in JSP page. I have written following method to read SAP message and Convert to IS0-559-2 charset( for Poland). This is working for me on XP and Windows 2000 in Hyderabad. I have used IS0-559-2 as encoding attribute in web.xml And in JSP pages %@ page contentType=text/html;charset=iso-8859-2 % But messages are corrupted some times and getting Question marks when deployed and tested application in Poland on Linux. Linux- Nr potwierdzenia 8018340248 nie zostaÅ‚ znaleziony (proszÄ™ sprawdzić wpis) Windows Nr potwierdzenia 22 nie zosta³ znaleziony (proszê sprawdziæ wpis) - private String convertTo_IS08559_2(HttpServletResponse response, String strMessage) throws UnsupportedEncodingException{ final String METHOD_NAME = convertTo_IS08559_2() : ; // holds method name for logger messages String charset = response.getCharacterEncoding(); String strFormatedMessage=null; // holds formatted message Log.info(CLASS_NAME + - +METHOD_NAME+ - response - +response); Log.info(CLASS_NAME + - +METHOD_NAME+ - charset - +charset); Log.info(CLASS_NAME + - +METHOD_NAME+ - strMessage - +strMessage); if(strMessage!=null strMessage.length()0){ try { strFormatedMessage = new String(strMessage.getBytes(charset), ISO-8859-2); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block //e.printStackTrace(); Log.error(CLASS_NAME + - +METHOD_NAME+ - UnsupportedEncodingException - +e); throw e; } } Log.info(CLASS_NAME + - +METHOD_NAME+ - str - +strFormatedMessage); return strFormatedMessage; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18N jsp application on linux and windows
Hello Lauri, This is with reference.. http://www.mail-archive.com/user@struts.apache.org/msg72782.html Your reply on list is helping me a lot to dig into the problem.Please continue your help . response.getCharacterEncoding()is returning ISO-8859-1. I have set it to charset - ISO-8859-2 in JSP pages but it is returning “charset - ISO-8859-1”. Same thing is happening in windows and Linux. It is working in windows with this conversion(convertTo_IS08559_2) but failing in Linux.. Regards, Raghu _ From: Laurie Harper [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 19, 2008 4:24 AM To: [EMAIL PROTECTED] Subject: Re: i18N jsp application on linux and windows Uh, yeah, I got that; that's why I've replied to you twice, on the list; see also: http://www.mail-archive.com/user@struts.apache.org/msg72782.html Please follow up on-list if you need further help, to keep the discussion where everyone can see it. L. On 18-Feb-08, at 8:50 AM, Raghuveer wrote: I need an help related to i18n (internationalization),… http://www.mail-archive.com/user@struts.apache.org/msg72581.html http://www.mail-archive.com/user@struts.apache.org/msg72581.html I am developing an application an struts application to be used in poland for English,polish language on tomcat. There is scenario to extract SAP messages and show to the user in browser in JSP page. I have written following method to read SAP message and Convert to charsetThis is working for me on XP and Windows 2000 in Hyderabad. IS0-559-2And in JSP pages %@ page contentType=text/html;charset=iso-8859-2 % But messages are corrupted some times and getting Question marks when deployed and tested application in Poland on Linux. Linux- Nr potwierdzenia 8018340248 nie zostaÅ‚ znaleziony (proszÄ™ sprawdzić wpis) Windows Nr potwierdzenia 22 nie zosta³ znaleziony (proszê sprawdziæ wpis) - String convertTo_IS08559_2(HttpServletResponse response, StringstrMessage) throws UnsupportedEncodingException{ String charset = response.getCharacterEncoding(); Log.info(CLASS_NAME + - +METHOD_NAME+ - charset - +charset); try { } catch (UnsupportedEncodingException e) { //e.printStackTrace(); throw e; } return strFormatedMessage;
Re: i18N jsp application on linux and windows
Hi, Why dont you try putting UTF-8, i think this character set is not in Linux may be. Thanks, Nuwan. Raghuveer wrote: This is regarding the damage of polish messages from struts application deployed on Tomcat on Linux and Windows XP . I get polish messages from SAP that to be displayed in JSP page. I have set ISO8859_2 in JSP page for charset. %@ page contentType=text/html;charset=ISO8859_2 % I have set encoding attribute in web.xml as below ?xml version=1.0 encoding=ISO-8859-2? This is working on Windows XP. But I get Question marks and differents characters for polish messages from application deployed on Linux prosz? sprawdzi? Wpis. Please help if I need to do anything in framework.. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18N jsp application on linux and windows
Raghuveer wrote: This is regarding the damage of polish messages from struts application deployed on Tomcat on Linux and Windows XP . I get polish messages from SAP that to be displayed in JSP page. I have set ISO8859_2 in JSP page for charset. %@ page contentType=text/html;charset=ISO8859_2 % This tells the JSP engine what character encoding to use. Do you also have an HTML meta http-equiv tag in the head of your page to tell the browser what encoding it should use to process the page? I have set encoding attribute in web.xml as below ?xml version=1.0 encoding=ISO-8859-2? Err, that just tells the servlet container what character encoding to use when reading web.xml. Unless you need to include Polish language text in your web.xml file, it's not relevant. This is working on Windows XP. But I get Question marks and differents characters for polish messages from application deployed on Linux Probably the Windows and Linux machines have different default (system) locales configured and there is some point in your app where the default character encoding is being used and needs to be specified explicitly. Check if the Polish language data is being retrieved correctly from SAP on the Linux deployment (i.e. is it correct when your action receives it); failiing that, use Firebug or a packet sniffer like Ethereal to look at what's going over the wire: is the HTTP response encoded correctly? L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n
hi, I've googled a bit and found thiz: session.setAttribute(org.apache.struts.action.LOCALE, *new* Locale(en)); http://forum.java.sun.com/thread.jspa?threadID=573861messageID=2854271 http://www.jguru.com/faq/view.jsp?EID=1057614 ^g^ 2008/1/24 volkan tokmak [EMAIL PROTECTED]: hi all, I wanna ask a question about Struts i18n. I have two resource files; ApplicationResources(this contains English words) and ApplicationResources_de. Also I have flag buttons on the top of the page. I want to make multi language support like this: when you login you can see the flags on the top of the page. the default language will be English. you will see English and German flags, then when you click on of the flag, for example German flag, language will change and refresh the page we can see page in German language. Is it possible to make it? If anyone can help me, please send an e-mail? best wishes Volkan TOKMAK _ Yeni nesil Windows Live Servisleri'ne şimdi ulaşın! http://get.live.com -- Sit tibi terra levis http://yayocaturas.blogspot.com/
Re: I18n Struts problem
You probably are not using UTF-8 encoding on your pages. This can be configured using the JSP page directive. On Dec 11, 2007 7:57 AM, Laurie Harper [EMAIL PROTECTED] wrote: Chris Pat wrote: Hello In my app I write the labels with bean:message key=what.ever.label/ and I have an ApplicationProperties.properties, ApplicationProperties_el.properties with the modified \uXXXx encoding of the labels in language. I then used this for local switching and I still get the . Am I missing something? tia. Do you get '' for any locale, or only when you try to use the specific local? If the former, you don't have your message resources configured correctly, and it isn't finding either .properties file. You should be seeing a warning or error during startup of your Struts app in that case. If the problem only occurs when you switch locale, it may be a problem with how you're specifying the locale or it could be a problem with the .properties file itself (e.g. saved with wrong encoding). You'll need to provide more detail about your configuration and observed behaviour to get more specific diagnostics. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n - button names
Raghuveer wrote: Is it possible to get the Localized button names for Struts Internationalization (i18n)..? Sure. What version of Struts? Here are some likely starting points: Struts2: http://struts.apache.org/2.x/docs/localization.html Struts1: http://struts.apache.org/1.3.8/userGuide/building_view.html#i18n L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n and variable tiles definitions
May I suggest to instead of using the title value in the tiles, use the keys (e.g. titleKey), then fetched it using whatever approach you want to: Example: resource_en.properties application.title=Hello World Application tiles.xml definition name=foo extends=.template put name=titleKey value=application.title type=string/ /definition jsp page c:set var=titleNameKeytiles:getAsString name=titleKey//c:set fmt:message key=${titleNameKey}/ (of course this uses unnecessary code, but the above will work for sure) Hope this helps! Peter Rumstle wrote: Hi everyone, I am running into what appears to be a limitation in tiles. I hope someone has encountered this problem before and knows of a workaround. I have a tiles based layout that accepts a title in the tiles definition. definition name=recordDetail extends=.template put name=title value=Record Detail/ put name=body value=/WEB-INF/jsp/tiles/recordDetail.jsp/ /definition My problem is that I need the title to be more dynamic. It needs to do two things: 1. Support different titles depending on the locale. 2. Accept a dynamic field identifying the record number that the page is showing. For example, rather than say Record Detail like in my example it should say Record Detail: 38847829 and in other languages it should be translated using an existing ResourceBundle (ex. Detalle De registro: 38847829). My problem lies in the fact that my .template tile includes the title tag, but does not know which page it is rendering. Only the body tile and the actual tiles definition knows which page it is rendering for. Other pages use the same .template tile but require different dynamic fields in their title. Has anyone got something like this working before? Thanks! _ Introducing the City @ Live! Take a tour! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- Alberto A. Flores http://www.linkedin.com/in/aflores - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n and variable tiles definitions
2007/12/20, Alberto A. Flores [EMAIL PROTECTED]: c:set var=titleNameKeytiles:getAsString name=titleKey//c:set Just a last note: you can use: tiles:importAttribute name=titleKey / And your titleKey attribute value will be imported as a page-scoped titleKey bean. Ciao Antonio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n and variable tiles definitions
Thats an excellent solution for the i18n part. I will change my code to use this method. I still don't know what the best way to add variables to the title tho. I know i can have variable placeholders in my resource file ex. resource_en.properties record.detail.title=Record Detail:{0} user.detail.title=User Detail:{0} application.title=Hello World Application tiles.xml definition name=foo extends=.templateput name=titleKey value=record.detail.title type=string//definition jsp template page // Somehow i need to pass in optional variables that are provided by my controller to the title fmt:message key=${titleNameKey}/ Is this possible with tiles? btw, sorry for posting to two mailing lists about this if thats bad form. Date: Thu, 20 Dec 2007 13:29:32 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions May I suggest to instead of using the title value in the tiles, use the keys (e.g. titleKey), then fetched it using whatever approach you want to: Example: resource_en.properties application.title=Hello World Application tiles.xml definition name=foo extends=.template put name=titleKey value=application.title type=string/ /definition jsp page c:set var=titleNameKeytiles:getAsString name=titleKey//c:set fmt:message key=${titleNameKey}/ (of course this uses unnecessary code, but the above will work for sure) Hope this helps! Peter Rumstle wrote: Hi everyone, I am running into what appears to be a limitation in tiles. I hope someone has encountered this problem before and knows of a workaround. I have a tiles based layout that accepts a title in the tiles definition. definition name=recordDetail extends=.template put name=title value=Record Detail/ put name=body value=/WEB-INF/jsp/tiles/recordDetail.jsp/ /definition My problem is that I need the title to be more dynamic. It needs to do two things: 1. Support different titles depending on the locale. 2. Accept a dynamic field identifying the record number that the page is showing. For example, rather than say Record Detail like in my example it should say Record Detail: 38847829 and in other languages it should be translated using an existing ResourceBundle (ex. Detalle De registro: 38847829). My problem lies in the fact that my .template tile includes the title tag, but does not know which page it is rendering. Only the body tile and the actual tiles definition knows which page it is rendering for. Other pages use the same .template tile but require different dynamic fields in their title. Has anyone got something like this working before? Thanks! _ Introducing the City @ Live! Take a tour! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- Alberto A. Flores http://www.linkedin.com/in/aflores _ Discover new ways to stay in touch with Windows Live! Visit the City @ Live today! http://getyourliveid.ca/?icid=LIVEIDENCA006
Re: i18n and variable tiles definitions
you can do the same thing passing the strings keys in the tiles, then play with the jsp pages using JSTL fmt tag.. tiles:importAttribute name=titleKeyParameter1 / fmt:message var=parameter1Value value=${titleKeyParameter1}/ fmt:message key=foo fmt:paramc:out value=${parameter1Value}//fmt:param ... //repeat process /fmt:message I'm pretty sure you should be able to also put fmt tags within fmt tags (nested), but I've never tried it. Peter Rumstle wrote: Thats an excellent solution for the i18n part. I will change my code to use this method. I still don't know what the best way to add variables to the title tho. I know i can have variable placeholders in my resource file ex. resource_en.properties record.detail.title=Record Detail:{0} user.detail.title=User Detail:{0} application.title=Hello World Application tiles.xml definition name=foo extends=.templateput name=titleKey value=record.detail.title type=string//definition jsp template page // Somehow i need to pass in optional variables that are provided by my controller to the title fmt:message key=${titleNameKey}/ Is this possible with tiles? btw, sorry for posting to two mailing lists about this if thats bad form. Date: Thu, 20 Dec 2007 13:29:32 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions May I suggest to instead of using the title value in the tiles, use the keys (e.g. titleKey), then fetched it using whatever approach you want to: Example: resource_en.properties application.title=Hello World Application tiles.xml definition name=foo extends=.template put name=titleKey value=application.title type=string/ /definition jsp page c:set var=titleNameKeytiles:getAsString name=titleKey//c:set fmt:message key=${titleNameKey}/ (of course this uses unnecessary code, but the above will work for sure) Hope this helps! Peter Rumstle wrote: Hi everyone, I am running into what appears to be a limitation in tiles. I hope someone has encountered this problem before and knows of a workaround. I have a tiles based layout that accepts a title in the tiles definition. definition name=recordDetail extends=.template put name=title value=Record Detail/ put name=body value=/WEB-INF/jsp/tiles/recordDetail.jsp/ /definition My problem is that I need the title to be more dynamic. It needs to do two things: 1. Support different titles depending on the locale. 2. Accept a dynamic field identifying the record number that the page is showing. For example, rather than say Record Detail like in my example it should say Record Detail: 38847829 and in other languages it should be translated using an existing ResourceBundle (ex. Detalle De registro: 38847829). My problem lies in the fact that my .template tile includes the title tag, but does not know which page it is rendering. Only the body tile and the actual tiles definition knows which page it is rendering for. Other pages use the same .template tile but require different dynamic fields in their title. Has anyone got something like this working before? Thanks! _ Introducing the City @ Live! Take a tour! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- Alberto A. Flores http://www.linkedin.com/in/aflores _ Discover new ways to stay in touch with Windows Live! Visit the City @ Live today! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- Alberto A. Flores http://www.linkedin.com/in/aflores - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n and variable tiles definitions
This idea seems really promising, but I have been unable to implement it. Here is what I have tried: resource_en.properties record.detail.title=Record Detail:{0} tiles.xml definition name=foo extends=.template put name=titleKey value=record.detail.title type=string/put name=titleKeyParam1 value=recordId type=string//definition jsp template page c:set var=titleNameKeytiles:getAsString name=titleKey//c:setc:set var=titleNameKeyParam1tiles:getAsString name=titleKeyParameter1//c:setfmt:message key=${titleNameKey} fmt:paramc:out value=${titleNameKeyParam1}//fmt:param/fmt:message My controller passes to the jsp view a parameter called recordId. I know that is working because I can use the value elsewhere. The problem is that my title displays as: Record Detail: recordId instead of showing me the value of ${recordId} (I expected something like Record Detail: 12345) I've tried a few variations on this without success :-( How can I get the title to show the value of the expression i set in my tiles definition? Date: Thu, 20 Dec 2007 15:01:20 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions you can do the same thing passing the strings keys in the tiles, then play with the jsp pages using JSTL fmt tag.. tiles:importAttribute name=titleKeyParameter1 / fmt:message var=parameter1Value value=${titleKeyParameter1}/ fmt:message key=foo fmt:paramc:out value=${parameter1Value}//fmt:param ... //repeat process /fmt:message I'm pretty sure you should be able to also put fmt tags within fmt tags (nested), but I've never tried it. Peter Rumstle wrote: Thats an excellent solution for the i18n part. I will change my code to use this method. I still don't know what the best way to add variables to the title tho. I know i can have variable placeholders in my resource file ex. resource_en.properties record.detail.title=Record Detail:{0} user.detail.title=User Detail:{0} application.title=Hello World Application tiles.xml definition name=foo extends=.templateput name=titleKey value=record.detail.title type=string//definition jsp template page // Somehow i need to pass in optional variables that are provided by my controller to the title fmt:message key=${titleNameKey}/ Is this possible with tiles? btw, sorry for posting to two mailing lists about this if thats bad form. Date: Thu, 20 Dec 2007 13:29:32 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions May I suggest to instead of using the title value in the tiles, use the keys (e.g. titleKey), then fetched it using whatever approach you want to: Example: resource_en.properties application.title=Hello World Application tiles.xml definition name=foo extends=.template put name=titleKey value=application.title type=string/ /definition jsp page c:set var=titleNameKeytiles:getAsString name=titleKey//c:set fmt:message key=${titleNameKey}/ (of course this uses unnecessary code, but the above will work for sure) Hope this helps! Peter Rumstle wrote: Hi everyone, I am running into what appears to be a limitation in tiles. I hope someone has encountered this problem before and knows of a workaround. I have a tiles based layout that accepts a title in the tiles definition. definition name=recordDetail extends=.template put name=title value=Record Detail/ put name=body value=/WEB-INF/jsp/tiles/recordDetail.jsp/ /definition My problem is that I need the title to be more dynamic. It needs to do two things: 1. Support different titles depending on the locale. 2. Accept a dynamic field identifying the record number that the page is showing. For example, rather than say Record Detail like in my example it should say Record Detail: 38847829 and in other languages it should be translated using an existing ResourceBundle (ex. Detalle De registro: 38847829). My problem lies in the fact that my .template tile includes the title tag, but does not know which page it is rendering. Only the body tile and the actual tiles definition knows which page it is rendering for. Other pages use the same .template tile but require different dynamic fields in their title. Has anyone got something like this working before? Thanks! _ Introducing the City @ Live! Take a tour! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- Alberto A. Flores http://www.linkedin.com/in/aflores _ Discover new ways to stay in touch with Windows Live! Visit the City @ Live today! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- Alberto
RE: i18n and variable tiles definitions
btw, I've also tried this slight variation: tiles.xml definition name=foo extends=.template put name=titleKey value=record.detail.title type=string/put name=titleKeyParam1 value=${recordId} type=string//definition Which gives me the page title: Record Detail: ${recordId}. Also giving me the problem that it is not evaluating the expression. From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: RE: i18n and variable tiles definitions Date: Thu, 20 Dec 2007 13:41:13 -0800 This idea seems really promising, but I have been unable to implement it. Here is what I have tried: resource_en.properties record.detail.title=Record Detail:{0} tiles.xml definition name=foo extends=.template put name=titleKey value=record.detail.title type=string/put name=titleKeyParam1 value=recordId type=string//definition jsp template page c:set var=titleNameKeytiles:getAsString name=titleKey//c:setc:set var=titleNameKeyParam1tiles:getAsString name=titleKeyParameter1//c:setfmt:message key=${titleNameKey} fmt:paramc:out value=${titleNameKeyParam1}//fmt:param/fmt:message My controller passes to the jsp view a parameter called recordId. I know that is working because I can use the value elsewhere. The problem is that my title displays as: Record Detail: recordId instead of showing me the value of ${recordId} (I expected something like Record Detail: 12345) I've tried a few variations on this without success :-( How can I get the title to show the value of the expression i set in my tiles definition? Date: Thu, 20 Dec 2007 15:01:20 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions you can do the same thing passing the strings keys in the tiles, then play with the jsp pages using JSTL fmt tag.. tiles:importAttribute name=titleKeyParameter1 / fmt:message var=parameter1Value value=${titleKeyParameter1}/ fmt:message key=foo fmt:paramc:out value=${parameter1Value}//fmt:param ... //repeat process /fmt:message I'm pretty sure you should be able to also put fmt tags within fmt tags (nested), but I've never tried it. Peter Rumstle wrote: Thats an excellent solution for the i18n part. I will change my code to use this method. I still don't know what the best way to add variables to the title tho. I know i can have variable placeholders in my resource file ex. resource_en.properties record.detail.title=Record Detail:{0} user.detail.title=User Detail:{0} application.title=Hello World Application tiles.xml definition name=foo extends=.templateput name=titleKey value=record.detail.title type=string//definition jsp template page // Somehow i need to pass in optional variables that are provided by my controller to the title fmt:message key=${titleNameKey}/ Is this possible with tiles? btw, sorry for posting to two mailing lists about this if thats bad form. Date: Thu, 20 Dec 2007 13:29:32 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions May I suggest to instead of using the title value in the tiles, use the keys (e.g. titleKey), then fetched it using whatever approach you want to: Example: resource_en.properties application.title=Hello World Application tiles.xml definition name=foo extends=.template put name=titleKey value=application.title type=string/ /definition jsp page c:set var=titleNameKeytiles:getAsString name=titleKey//c:set fmt:message key=${titleNameKey}/ (of course this uses unnecessary code, but the above will work for sure) Hope this helps! Peter Rumstle wrote: Hi everyone, I am running into what appears to be a limitation in tiles. I hope someone has encountered this problem before and knows of a workaround. I have a tiles based layout that accepts a title in the tiles definition. definition name=recordDetail extends=.template put name=title value=Record Detail/ put name=body value=/WEB-INF/jsp/tiles/recordDetail.jsp/ /definition My problem is that I need the title to be more dynamic. It needs to do two things: 1. Support different titles depending on the locale. 2. Accept a dynamic field identifying the record number that the page is showing. For example, rather than say Record Detail like in my example it should say Record Detail: 38847829 and in other languages it should be translated using an existing ResourceBundle (ex. Detalle De registro: 38847829). My problem lies in the fact that my .template tile includes the title tag, but does not know which page it is rendering. Only the body tile and the actual tiles definition
RE: i18n and variable tiles definitions
So I've found a method that works. Perhaps it s what you were trying to explain in the first place. Rather than use an EL expression in the tiles definition to say which object should be used in the page title key parameter, I just define a parameter called titleKeyParam1 that the controller will optionally set directly. There is nothing about the parameters in the tiles definition file, only the titleKey. ie. tiles-layout.xml definition name=recordDetail extends=.templateput name=titleKey value=record.detail.title/put name=body value=/WEB-INF/jsp/tiles/recordDetail.jsp//definition jsp filefmt:message key=${titleNameKey} fmt:paramc:out value=${titleKeyParam1}//fmt:param/fmt:message - Then the controller optionally sets the titleKeyParam1 as an object in the model. From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: RE: i18n and variable tiles definitions Date: Thu, 20 Dec 2007 13:47:33 -0800 btw, I've also tried this slight variation: tiles.xml definition name=foo extends=.template put name=titleKey value=record.detail.title type=string/put name=titleKeyParam1 value=${recordId} type=string//definition Which gives me the page title: Record Detail: ${recordId}. Also giving me the problem that it is not evaluating the expression. From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: RE: i18n and variable tiles definitions Date: Thu, 20 Dec 2007 13:41:13 -0800 This idea seems really promising, but I have been unable to implement it. Here is what I have tried: resource_en.properties record.detail.title=Record Detail:{0} tiles.xml definition name=foo extends=.template put name=titleKey value=record.detail.title type=string/put name=titleKeyParam1 value=recordId type=string//definition jsp template page c:set var=titleNameKeytiles:getAsString name=titleKey//c:setc:set var=titleNameKeyParam1tiles:getAsString name=titleKeyParameter1//c:setfmt:message key=${titleNameKey} fmt:paramc:out value=${titleNameKeyParam1}//fmt:param/fmt:message My controller passes to the jsp view a parameter called recordId. I know that is working because I can use the value elsewhere. The problem is that my title displays as: Record Detail: recordId instead of showing me the value of ${recordId} (I expected something like Record Detail: 12345) I've tried a few variations on this without success :-( How can I get the title to show the value of the expression i set in my tiles definition? Date: Thu, 20 Dec 2007 15:01:20 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions you can do the same thing passing the strings keys in the tiles, then play with the jsp pages using JSTL fmt tag.. tiles:importAttribute name=titleKeyParameter1 / fmt:message var=parameter1Value value=${titleKeyParameter1}/ fmt:message key=foo fmt:paramc:out value=${parameter1Value}//fmt:param ... //repeat process /fmt:message I'm pretty sure you should be able to also put fmt tags within fmt tags (nested), but I've never tried it. Peter Rumstle wrote: Thats an excellent solution for the i18n part. I will change my code to use this method. I still don't know what the best way to add variables to the title tho. I know i can have variable placeholders in my resource file ex. resource_en.properties record.detail.title=Record Detail:{0} user.detail.title=User Detail:{0} application.title=Hello World Application tiles.xml definition name=foo extends=.templateput name=titleKey value=record.detail.title type=string//definition jsp template page // Somehow i need to pass in optional variables that are provided by my controller to the title fmt:message key=${titleNameKey}/ Is this possible with tiles? btw, sorry for posting to two mailing lists about this if thats bad form. Date: Thu, 20 Dec 2007 13:29:32 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions May I suggest to instead of using the title value in the tiles, use the keys (e.g. titleKey), then fetched it using whatever approach you want to: Example: resource_en.properties application.title=Hello World Application tiles.xml definition name=foo extends=.template put name=titleKey value=application.title type=string/ /definition jsp page c:set var=titleNameKeytiles:getAsString name=titleKey//c:set fmt:message key=${titleNameKey}/ (of course this uses unnecessary code, but the above will work for sure) Hope
Re: i18n and variable tiles definitions
yes Peter Rumstle wrote: So I've found a method that works. Perhaps it s what you were trying to explain in the first place. Rather than use an EL expression in the tiles definition to say which object should be used in the page title key parameter, I just define a parameter called titleKeyParam1 that the controller will optionally set directly. There is nothing about the parameters in the tiles definition file, only the titleKey. ie. tiles-layout.xml definition name=recordDetail extends=.templateput name=titleKey value=record.detail.title/put name=body value=/WEB-INF/jsp/tiles/recordDetail.jsp//definition jsp filefmt:message key=${titleNameKey}fmt:paramc:out value=${titleKeyParam1}//fmt:param/fmt:message - Then the controller optionally sets the titleKeyParam1 as an object in the model. From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: RE: i18n and variable tiles definitions Date: Thu, 20 Dec 2007 13:47:33 -0800 btw, I've also tried this slight variation: tiles.xml definition name=foo extends=.template put name=titleKey value=record.detail.title type=string/ put name=titleKeyParam1 value=${recordId} type=string//definition Which gives me the page title: Record Detail: ${recordId}. Also giving me the problem that it is not evaluating the expression. From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: RE: i18n and variable tiles definitions Date: Thu, 20 Dec 2007 13:41:13 -0800 This idea seems really promising, but I have been unable to implement it. Here is what I have tried: resource_en.properties record.detail.title=Record Detail:{0} tiles.xml definition name=foo extends=.template put name=titleKey value=record.detail.title type=string/put name=titleKeyParam1 value=recordId type=string//definition jsp template page c:set var=titleNameKeytiles:getAsString name=titleKey//c:setc:set var=titleNameKeyParam1tiles:getAsString name=titleKeyParameter1//c:setfmt:message key=${titleNameKey}fmt:paramc:out value=${titleNameKeyParam1}//fmt:param/fmt:message My controller passes to the jsp view a parameter called recordId. I know that is working because I can use the value elsewhere. The problem is that my title displays as: Record Detail: recordId instead of showing me the value of ${recordId} (I expected something like Record Detail: 12345) I've tried a few variations on this without success :-( How can I get the title to show the value of the expression i set in my tiles definition? Date: Thu, 20 Dec 2007 15:01:20 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions you can do the same thing passing the strings keys in the tiles, then play with the jsp pages using JSTL fmt tag.. tiles:importAttribute name=titleKeyParameter1 / fmt:message var=parameter1Value value=${titleKeyParameter1}/ fmt:message key=foo fmt:paramc:out value=${parameter1Value}//fmt:param ... //repeat process /fmt:message I'm pretty sure you should be able to also put fmt tags within fmt tags (nested), but I've never tried it. Peter Rumstle wrote: Thats an excellent solution for the i18n part. I will change my code to use this method. I still don't know what the best way to add variables to the title tho. I know i can have variable placeholders in my resource file ex. resource_en.properties record.detail.title=Record Detail:{0} user.detail.title=User Detail:{0} application.title=Hello World Application tiles.xml definition name=foo extends=.templateput name=titleKey value=record.detail.title type=string//definition jsp template page // Somehow i need to pass in optional variables that are provided by my controller to the title fmt:message key=${titleNameKey}/ Is this possible with tiles? btw, sorry for posting to two mailing lists about this if thats bad form. Date: Thu, 20 Dec 2007 13:29:32 -0500 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: i18n and variable tiles definitions May I suggest to instead of using the title value in the tiles, use the keys (e.g. titleKey), then fetched it using whatever approach you want to: Example: resource_en.properties application.title=Hello World Application tiles.xml definition name=foo extends=.template put name=titleKey value=application.title type=string/ /definition jsp page c:set var=titleNameKeytiles:getAsString name=titleKey//c:set fmt:message key=${titleNameKey}/ (of course this uses unnecessary code, but the above will work for sure) Hope this helps! Peter Rumstle wrote: Hi everyone, I am running into what appears to be a limitation in tiles. I hope someone has encountered this problem before and knows of a workaround. I have a tiles based layout that accepts a title in the tiles definition. definition name=recordDetail extends=.template put name=title value=Record Detail/ put name
Re: I18n Struts problem
Chris Pat wrote: Hello In my app I write the labels with bean:message key=what.ever.label/ and I have an ApplicationProperties.properties, ApplicationProperties_el.properties with the modified \uXXXx encoding of the labels in language. I then used this for local switching and I still get the . Am I missing something? tia. Do you get '' for any locale, or only when you try to use the specific local? If the former, you don't have your message resources configured correctly, and it isn't finding either .properties file. You should be seeing a warning or error during startup of your Struts app in that case. If the problem only occurs when you switch locale, it may be a problem with how you're specifying the locale or it could be a problem with the .properties file itself (e.g. saved with wrong encoding). You'll need to provide more detail about your configuration and observed behaviour to get more specific diagnostics. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N problem
I thing that ActionSupport.getText(..) does not check the global property file for some reason. It only check the class hierarchy of the action. Using s:textfield key=blabla/ does not help either. Any other ideas ? I'm about to write my own method in the base action class that does the i18n and check the global resource, but feels not right? 2007/12/5, Ian Roughley [EMAIL PROTECTED]: You should probably try using the key rather than the label attribute, I'm not even sure whether it will accept OGNL: s:textfield key=blabla/ -- Ian Roughley From Down Around, Inc. Consulting * Training / Mentoring * Agile Process * Open Source web: http://www.fdar.com - email: [EMAIL PROTECTED] Angel Gruev wrote: Hello I have read the guide for internationalization but still I cannot get it running. 1. I have a property file with internationalization data called ApplicationResources.properties (used for the old struts 1 applicaiton) There is a line blabla = test 2. In the struts.properties file I have added: struts.i18n.reload = true struts.custom.i18n.resources=ApplicationResources.properties 3. In the action configuraion i have added : interceptor-ref name=defaultStack / (this stack contains the i18n interceptor 4. In the jsp I have added: s:textfield label=%{getText('blabla')}/ The result is blabla , not test as expected. Any ideas ? Angel Gruev - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N problem
As in most cases, the problem was so stupid ... and I lost about a day in testing :) in struts.properties I have added struts.custom.i18n.resources=ApplicationResources.properties but should be: struts.custom.i18n.resources=ApplicationResources (without the properties extention) Arg! Sorry for the spam! 2007/12/6, Angel Gruev [EMAIL PROTECTED]: I thing that ActionSupport.getText(..) does not check the global property file for some reason. It only check the class hierarchy of the action. Using s:textfield key=blabla/ does not help either. Any other ideas ? I'm about to write my own method in the base action class that does the i18n and check the global resource, but feels not right? 2007/12/5, Ian Roughley [EMAIL PROTECTED]: You should probably try using the key rather than the label attribute, I'm not even sure whether it will accept OGNL: s:textfield key=blabla/ -- Ian Roughley From Down Around, Inc. Consulting * Training / Mentoring * Agile Process * Open Source web: http://www.fdar.com - email: [EMAIL PROTECTED] Angel Gruev wrote: Hello I have read the guide for internationalization but still I cannot get it running. 1. I have a property file with internationalization data called ApplicationResources.properties (used for the old struts 1 applicaiton) There is a line blabla = test 2. In the struts.properties file I have added: struts.i18n.reload = true struts.custom.i18n.resources=ApplicationResources.properties 3. In the action configuraion i have added : interceptor-ref name=defaultStack / (this stack contains the i18n interceptor 4. In the jsp I have added: s:textfield label=%{getText('blabla')}/ The result is blabla , not test as expected. Any ideas ? Angel Gruev - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N problem
Yes I actually breakpoint the getText method in the ActionSupport. It is called. 2007/12/5, Dave Newton [EMAIL PROTECTED]: Does the action extend ActionSupport? d. --- Angel Gruev [EMAIL PROTECTED] wrote: Hello I have read the guide for internationalization but still I cannot get it running. 1. I have a property file with internationalization data called ApplicationResources.properties (used for the old struts 1 applicaiton) There is a line blabla = test 2. In the struts.properties file I have added: struts.i18n.reload = true struts.custom.i18n.resources=ApplicationResources.properties 3. In the action configuraion i have added : interceptor-ref name=defaultStack / (this stack contains the i18n interceptor 4. In the jsp I have added: s:textfield label=%{getText('blabla')}/ The result is blabla , not test as expected. Any ideas ? Angel Gruev - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N problem
Does the action extend ActionSupport? d. --- Angel Gruev [EMAIL PROTECTED] wrote: Hello I have read the guide for internationalization but still I cannot get it running. 1. I have a property file with internationalization data called ApplicationResources.properties (used for the old struts 1 applicaiton) There is a line blabla = test 2. In the struts.properties file I have added: struts.i18n.reload = true struts.custom.i18n.resources=ApplicationResources.properties 3. In the action configuraion i have added : interceptor-ref name=defaultStack / (this stack contains the i18n interceptor 4. In the jsp I have added: s:textfield label=%{getText('blabla')}/ The result is blabla , not test as expected. Any ideas ? Angel Gruev - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N problem
You should probably try using the key rather than the label attribute, I'm not even sure whether it will accept OGNL: s:textfield key=blabla/ -- Ian Roughley From Down Around, Inc. Consulting * Training / Mentoring * Agile Process * Open Source web: http://www.fdar.com - email: [EMAIL PROTECTED] Angel Gruev wrote: Hello I have read the guide for internationalization but still I cannot get it running. 1. I have a property file with internationalization data called ApplicationResources.properties (used for the old struts 1 applicaiton) There is a line blabla = test 2. In the struts.properties file I have added: struts.i18n.reload = true struts.custom.i18n.resources=ApplicationResources.properties 3. In the action configuraion i have added : interceptor-ref name=defaultStack / (this stack contains the i18n interceptor 4. In the jsp I have added: s:textfield label=%{getText('blabla')}/ The result is blabla , not test as expected. Any ideas ? Angel Gruev - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n in struts2
Hi Using i18n is a very simple in struts. Lets make a sample application to say hello to the Rock. Steps to do i18n:- 1. Create a test application. 2. index.jsp would be like this:- [EMAIL PROTECTED] language=java% [EMAIL PROTECTED] uri=/WEB-INF/struts-html.tld prefix=html% [EMAIL PROTECTED] uri=/WEB-INF/struts-bean.tld prefix=bean% html head titleStruts i18 test/title /head body bean:message key=welcome.message/ Rock!!! hr %= Current Locale: + request.getLocale () % /body /html 3. Rename the ApplicationResources.properties to the locale you required. Suppose your current locale is en_US. So, rename it to ApplicationResources_en_US.properties. 4. Copy this file and paste it in the same folder and rename it to another locale you want the support for your application. Suppose french. So, it would be ApplicationResources_fr_FR.properties. 5. Now you have two properties files in your application. A) ApplicationResources_en_US.properties. B) ApplicationResources_fr_FR.properties. 6. Now add a message to ApplicationResources_en_US.properties file. welcome.message=Hello 7. Now add a message to ApplicationResources_fr_FR.properties file. welcome.message=Bonjour That's it. Now create a WAR file and deploy it on the server. Check it, if everything is right then it would print Hello Rock!!!. Now to test the french locale, go to settings of IE and choose option language. Add a language fr-FR and move it up in the list. Refresh the page and new message would be Bonjour Rock!!!. It's done dude:jumping: Mirbek Nosinov wrote: Hello How can i implements internationalization features in struts 2 application. i am using struts 2.0.9 and my user interface based on tiles 2. How can i switch from one language to another with different locale? Thanks in advanced. http://www.nabble.com/file/p12588059/i18n_test.war i18n_test.war http://www.nabble.com/file/p12588059/i18n_test.war i18n_test.war -- View this message in context: http://www.nabble.com/i18n-in-struts2-tf4412314.html#a12588059 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n for Enum values in s:select
Try this: s:select name=frmColour label=colour list=colourList listValue=%{getText('myColor.'+toString())} / and in you resources file: myColor.WHITE=Blanc myColor.RED=Rouge myColor.BLACK=Noir sarat.pediredla wrote: I have a s:select form element in my JSP that gets a list of enums to display in a drop down box. The following is my enum public enum Colour { WHITE, RED, BLACK; } The following is the action method that returns a List for my s:select public List getColourList() { return Arrays.asList(Colour.values()); } The following is my JSP s:select name=frmColour label=colour list=colourList / This works fine and the drop down list has the values from the enum. However, I want to be able to use localised string values for each enum value (ex. blanc for WHITE viz. french). I cant figure out how to get Struts 2 to grab these from the ApplicationResources.properties file. Can I even localise the content from enums in s:select at the JSP (presentation) layer? -- View this message in context: http://www.nabble.com/i18n-for-Enum-values-in-s%3Aselect-tf3959226.html#a12364787 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18n
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Juan, Juan Espinosa wrote: Hi im having problems with localization of a jsp page, i call the jsp directly, not through an action. Im using this tag the localize a text s:text name=%{getText('customer.security.login.title')} / I'm largely ignorant of JSP taglibs... is getText a struts-specific tag? If so, then you will probably have to send your requests through the ActionServlet in order to have the request set up properly to allow you to make calls like this. I had this problem long ago and it turned out that a trip through the ActionServlet was all I needed to get everything working. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF7tng9CaO5/Lv0PARAuRlAKCmzGiCybiLYf15wATfnvOGDkxMlACeIoRJ n1dEw7/LaF8fwRZQVIG7y4I= =+KNl -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18n
--- Christopher Schultz wrote: Juan Espinosa wrote: Hi im having problems with localization of a jsp page, i call the jsp directly, not through an action. Im using this tag the localize a text s:text name=%{getText('customer.security.login.title')} / I'm largely ignorant of JSP taglibs... is getText a struts-specific tag? It's a method, not a tag. If so, then you will probably have to send your requests through the ActionServlet in order to have the request set up properly to allow you to make calls like this. It's an S2 method. But I do agree (in spirit) that trying use the JSP from an ActionSupport would be a good sanity-check. d. Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: I18N Problems
In the jsp im localizing using this... s:text name=%{getText('customer.registration.registrationEnd.message')}/ I think you are right getText depends on ActionSupport but im not pass throw an acttion.how could i do to get i18n work properly when i call a jsp throw an struts action that has no Action class itself Regards, juan -Mensaje original- De: news [mailto:[EMAIL PROTECTED] En nombre de Laurie Harper Enviado el: viernes, 16 de febrero de 2007 2:14 Para: user@struts.apache.org Asunto: Re: I18N Problems Juan Espinosa wrote: Hi to all, i need some help with a intenationalization. I have a file named package.properties in the folder where i have located the actions. The localization is not working in actionerrors, i have the following code in the action: addActionError(myapplication.registration.error.userNameNotFound) Assuming you're extending ActionSupport: addActionError(getText(myapplication.registration.error.userNameNotFound)) ; addActionError takes the litteral error text, so you need to do the resource bundle lookup explicitly. I dont know why this code is not working, i have an entry myapplication.registration.error.userNameNotFound in package.properties but this thing doesnt work Another thing that does not work is this i have this action to call a jsp (i dont want to call it directly) action name=viewCustomerLogin result/private/customer/security/login.jsp/result /action in this case the localization also does not work, alsto i tried to put the I18N interceptor interceptor-ref name=i18n/ but no way but if i call the jsp throw a real action the localization works... action name=viewCustomerLogin method=viewCustomerLogin class=uy.com.MyActionClass result/private/customer/security/login.jsp/result /action I don't know how you're trying to localize that JSP, but my guess would be that you're depending on action functionality which, if you don't specify an action, wont be there. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.39/687 - Release Date: 14/02/2007 16:17 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.18.0/689 - Release Date: 15/02/2007 17:40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N Problems
Juan Espinosa wrote: Hi to all, i need some help with a intenationalization. I have a file named package.properties in the folder where i have located the actions. The localization is not working in actionerrors, i have the following code in the action: addActionError(myapplication.registration.error.userNameNotFound) Assuming you're extending ActionSupport: addActionError(getText(myapplication.registration.error.userNameNotFound)); addActionError takes the litteral error text, so you need to do the resource bundle lookup explicitly. I dont know why this code is not working, i have an entry myapplication.registration.error.userNameNotFound in package.properties but this thing doesnt work Another thing that does not work is this i have this action to call a jsp (i dont want to call it directly) action name=viewCustomerLogin result/private/customer/security/login.jsp/result /action in this case the localization also does not work, alsto i tried to put the I18N interceptor interceptor-ref name=i18n/ but no way but if i call the jsp throw a real action the localization works... action name=viewCustomerLogin method=viewCustomerLogin class=uy.com.MyActionClass result/private/customer/security/login.jsp/result /action I don't know how you're trying to localize that JSP, but my guess would be that you're depending on action functionality which, if you don't specify an action, wont be there. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N
--- Juan Espinosa [EMAIL PROTECTED] wrote: I have a file named package.properties in the folder where i have located the actions. The localization is not working when i call a jsp like this action name=viewCustomerLogin result /private/customer/security/login.jsp /result /action So... - You say you have a package.properties in the package of your actions. - What Action (and, nomre importantly, what package is it in) when you configure an action as you have above? That's one way to start thinking about the problem, anyway. d. Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: I18N
The package names are uy com nilo customer (here is the package.properties) registration (here are the actions) But when i call the jsp i dont use an action, there is no action in the mapping action name=viewCustomerLogin result /private/customer/security/login.jsp /result /action I think behind the scenes if the mapping doesnt have an action struts uses an action to do The forward, i use this because i dont want to call directly the jsp I found the example in the struts2 wiki -Mensaje original- De: Dave Newton [mailto:[EMAIL PROTECTED] Enviado el: miércoles, 14 de febrero de 2007 9:49 Para: Struts Users Mailing List Asunto: Re: I18N --- Juan Espinosa [EMAIL PROTECTED] wrote: I have a file named package.properties in the folder where i have located the actions. The localization is not working when i call a jsp like this action name=viewCustomerLogin result /private/customer/security/login.jsp /result /action So... - You say you have a package.properties in the package of your actions. - What Action (and, nomre importantly, what package is it in) when you configure an action as you have above? That's one way to start thinking about the problem, anyway. d. Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007 13:23 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007 13:23 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: I18N
Maybe i must put a speciall tag in the jsp to load the file (package.properties) in the context, to get the I18N work. -Mensaje original- De: Juan Espinosa [mailto:[EMAIL PROTECTED] Enviado el: miércoles, 14 de febrero de 2007 10:56 Para: 'Struts Users Mailing List' Asunto: RE: I18N The package names are uy com nilo customer (here is the package.properties) registration (here are the actions) But when i call the jsp i dont use an action, there is no action in the mapping action name=viewCustomerLogin result /private/customer/security/login.jsp /result /action I think behind the scenes if the mapping doesnt have an action struts uses an action to do The forward, i use this because i dont want to call directly the jsp I found the example in the struts2 wiki -Mensaje original- De: Dave Newton [mailto:[EMAIL PROTECTED] Enviado el: miércoles, 14 de febrero de 2007 9:49 Para: Struts Users Mailing List Asunto: Re: I18N --- Juan Espinosa [EMAIL PROTECTED] wrote: I have a file named package.properties in the folder where i have located the actions. The localization is not working when i call a jsp like this action name=viewCustomerLogin result /private/customer/security/login.jsp /result /action So... - You say you have a package.properties in the package of your actions. - What Action (and, nomre importantly, what package is it in) when you configure an action as you have above? That's one way to start thinking about the problem, anyway. d. Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007 13:23 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007 13:23 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007 13:23 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007 13:23 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n usage when new window opened.
Some things to consider: 1) Is the calendar popup using Struts to create the calendar? Is it a 3rd party tag library or something? This would affect getting the Struts locale, if it is not aware of it. 2) If popping up a window loses the session, then consider the session never existed. Sometimes the problem really is what it is. 3) The only way a popup can lose a session if the session ID is issued by a cookie and you're switching domains. Or, if you're using URL rewriting, you did not create the link to the calendar using c:url which will preserve the JSESSIONID in the URL. Paul Sharon Jolly [EMAIL PROTECTED] wrote: Hi, There is a requirement in my application where i need to open a calendar popup from a link. The application that i am taking about here is a J2EE application where struts is being used which i18n complaint. The session object holds the locale information and that is what is used to determine what language the web page should be shown. This is applicable for the calendar popup also. As of now the applcation opens the calendar popup using javascript window.open() and it always defaults to english language. I tried adding scriptlets to the calendar.jsp to get the session object and extract the locale information from there. But i do not get the session object in the new window that was opened from the parent window which has a session object associated with it. My question is how can i get the session information in a new window that is opened using window.open() from a main page that has a session associated with it. Collagues here suggested sending one more parameter from the calling js function in the main page which will identify what is the locale that is stored in the session object. There are more than 100 places where the calendar is being opened and i do not want to change the code now. Its important that i do something soon. Could someone tell me what can be done ASAP. Regards, Sharon _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or [EMAIL PROTECTED] and delete this EMAIL including any attachments _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better.
RE: i18n, refreshing ApplicationResources
Bharat, If you are just distributing your application's war file to be deployed at your customer's server, you need not give the whole code base to him. As the properties files are required for i18n features in the project, your client may need to change the messages and labels etc. as per his requirements. So, he should not need to re-build war file and re-deploy the application. Instead, the application should itself be capable to read the modified entries. Danny, I have some code that detects such changes and enables your app to read entries dynamically without restart and recompile. But it wont be a good thing to post it here. If you want, I can send the files at your personal mail id. , -Original Message- From: Bharat Kumar Meda [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 13, 2006 3:45 PM To: Struts Users Mailing List Subject: RE: i18n, refreshing ApplicationResources Hi, I need one clarification, don't we have to redeploy the application after changing the ApplicationResources_XX.properties file? (believing they are part of the war/ear) Regards, Bharat -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Danny Lee Sent: Tuesday, June 13, 2006 3:39 PM To: user@struts.apache.org Subject: i18n, refreshing ApplicationResources Hi guys! I'm wondering if there's a way to set a refresh rate of Struts ApplicationResources_XX.properties files. I hate restarting Tomcat everytime I've changed something there... Thanks in advance! Cheers, Danny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS End of Disclaimer INFOSYS*** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n, refreshing ApplicationResources
Hi, I need one clarification, don't we have to redeploy the application after changing the ApplicationResources_XX.properties file? (believing they are part of the war/ear) Regards, Bharat -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Danny Lee Sent: Tuesday, June 13, 2006 3:39 PM To: user@struts.apache.org Subject: i18n, refreshing ApplicationResources Hi guys! I'm wondering if there's a way to set a refresh rate of Struts ApplicationResources_XX.properties files. I hate restarting Tomcat everytime I've changed something there... Thanks in advance! Cheers, Danny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS End of Disclaimer INFOSYS*** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n with javascript validations
Kalra, Ashwani wrote: Hi, My project is using javascript validations generated through struts validator. I want to do some currency validations based on the language/country. Is it possible? Yes, it's possible, though Struts / Commons Validator don't include currency validation rules. You can specify your validation rules using 'mask', if you can express them with regular expressions. Otherwise you'll need to create your own validation rule(s) and add them to the base set in validator-rules.xml. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n with javascript validations
Hi Laurie, It will be too difficult to use mask with javascript validations. How javascript will handle locales. For eg in some countries decimal is represented by comma /Ashwani -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Tuesday, February 21, 2006 2:53 AM To: user@struts.apache.org Subject: Re: i18n with javascript validations Kalra, Ashwani wrote: Hi, My project is using javascript validations generated through struts validator. I want to do some currency validations based on the language/country. Is it possible? Yes, it's possible, though Struts / Commons Validator don't include currency validation rules. You can specify your validation rules using 'mask', if you can express them with regular expressions. Otherwise you'll need to create your own validation rule(s) and add them to the base set in validator-rules.xml. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n with javascript validations
I got it. I think I can specify it for each formset which are based on language and country. -Original Message- From: Kalra, Ashwani [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 10:44 AM To: Struts Users Mailing List Subject: RE: i18n with javascript validations Hi Laurie, It will be too difficult to use mask with javascript validations. How javascript will handle locales. For eg in some countries decimal is represented by comma /Ashwani -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Tuesday, February 21, 2006 2:53 AM To: user@struts.apache.org Subject: Re: i18n with javascript validations Kalra, Ashwani wrote: Hi, My project is using javascript validations generated through struts validator. I want to do some currency validations based on the language/country. Is it possible? Yes, it's possible, though Struts / Commons Validator don't include currency validation rules. You can specify your validation rules using 'mask', if you can express them with regular expressions. Otherwise you'll need to create your own validation rule(s) and add them to the base set in validator-rules.xml. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n Issue for Chinese Locale.
I fixed the Chinese locale issue and the mistake was forgetting the encoding option in native2ascii. Used native2ascii dummy.properties ApplicationResources_zh.properties instead native2ascii -encoding UTF-8 dummy.properties ApplicationResources_zh.properties Thanks for all. Have a good weekend. Bala -Original Message- From: Balasubramaniam, Sezhiyan Sent: Friday, November 18, 2005 1:01 PM To: 'Struts Users Mailing List' Subject: i18n Issue for Chinese Locale. Hi, Jason suggested some fix and I tried. Still some where it is going wrong. Any other suggestions please, Thanks in advance, Bala I attached the output html: HTML lang=zhHEAD META http-equiv=Content-Type content=text/html; charset=UTF-8 META content=MSHTML 6.00.2800.1522 name=GENERATOR/HEAD BODY亲爱的 /BODY/HTML -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, November 17, 2005 12:41 PM To: Struts Users Mailing List Subject: Re: i18n Issue for Chinese Locale. Everything looks good. UTF-8 is fine for Chinese. You are getting 9 bytes as a result, which is what you should get for UTF-8 encoding, which is good. But it seems the browser isn't reading it as UTF-8 and just displaying the bytes instead under the default ISO encoding. Try adding this html:html locale=true head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head If that doesn't work, can you post the html that is generated. Balasubramaniam, Sezhiyan wrote: Hi, We use STRUTS 1.0.2 in one of our extranet application and we need to support CHINESE locale as part of the scope. I used the following steps as Laurie pointed out in the earlier mail, but somehow the character set is getting corrupted and we are not getting the right result. Can Laurie, Frank or someone else can point me, where the problem could be? Thanks in advance, Bala Created dummy.properties in dreamweaver(UTF-8 supported) as bala1=亲爱的 bala2=非常高兴的通知您被升职为 Ran native2ascii dummy.properties ApplicationResources_zh.properties and the output is, bala1=\u00e4\u00ba\u00b2\u00e7\u02c6\u00b1\u00e7\u0161\u201e bala2=\u00e9\ufffd\u017e\u00e5\u00b8\u00b8\u00e9\u00ab\u02dc\u00e5\u2026\u00b4\u00e7\u0161\u201e\u00e9\u20ac\u0161\u00e7\u0178\u00a5\u00e6\u201a\u00a8\u00e8\u00a2\u00ab\u00e5\ufffd\u2021\u00e8\ufffd\u0152\u00e4\u00b8\u00ba JSP is, %@ page contentType=text/html; charset=UTF-8 % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ page import=java.util.* % %@ page import=java.text.* % %@ page import=org.apache.struts.action.* % % Locale locale=new Locale(zh, CN); session.setAttribute(org.apache.struts.action.LOCALE,locale); % html:html locale=true head /head body bean:message key=bala1/ /BODY /HTML Result is, 亲爱的
Re: i18n Issue for Chinese Locale.
UTF-8 doesnt support DBCS but UTF-16 does Good Luck, - Original Message - From: Balasubramaniam, Sezhiyan [EMAIL PROTECTED] To: user@struts.apache.org Cc: [EMAIL PROTECTED] Sent: Thursday, November 17, 2005 2:52 PM Subject: i18n Issue for Chinese Locale. Hi, We use STRUTS 1.0.2 in one of our extranet application and we need to support CHINESE locale as part of the scope. I used the following steps as Laurie pointed out in the earlier mail, but somehow the character set is getting corrupted and we are not getting the right result. Can Laurie, Frank or someone else can point me, where the problem could be? Thanks in advance, Bala Created dummy.properties in dreamweaver(UTF-8 supported) as bala1=亲爱的 bala2=非常高兴的通知您被升职为 Ran native2ascii dummy.properties ApplicationResources_zh.properties and the output is, bala1=\u00e4\u00ba\u00b2\u00e7\u02c6\u00b1\u00e7\u0161\u201e bala2=\u00e9\ufffd\u017e\u00e5\u00b8\u00b8\u00e9\u00ab\u02dc\u00e5\u2026\u00b4\u00e7\u0161\u201e\u00e9\u20ac\u0161\u00e7\u0178\u00a5\u00e6\u201a\u00a8\u00e8\u00a2\u00ab\u00e5\ufffd\u2021\u00e8\ufffd\u0152\u00e4\u00b8\u00ba JSP is, %@ page contentType=text/html; charset=UTF-8 % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ page import=java.util.* % %@ page import=java.text.* % %@ page import=org.apache.struts.action.* % % Locale locale=new Locale(zh, CN); session.setAttribute(org.apache.struts.action.LOCALE,locale); % html:html locale=true head /head body bean:message key=bala1/ /BODY /HTML Result is, 亲爱的 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Issue for Chinese Locale.
Everything looks good. UTF-8 is fine for Chinese. You are getting 9 bytes as a result, which is what you should get for UTF-8 encoding, which is good. But it seems the browser isn't reading it as UTF-8 and just displaying the bytes instead under the default ISO encoding. Try adding this html:html locale=true head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head If that doesn't work, can you post the html that is generated. Balasubramaniam, Sezhiyan wrote: Hi, We use STRUTS 1.0.2 in one of our extranet application and we need to support CHINESE locale as part of the scope. I used the following steps as Laurie pointed out in the earlier mail, but somehow the character set is getting corrupted and we are not getting the right result. Can Laurie, Frank or someone else can point me, where the problem could be? Thanks in advance, Bala Created dummy.properties in dreamweaver(UTF-8 supported) as bala1=亲爱的 bala2=非常高兴的通知您被升职为 Ran native2ascii dummy.properties ApplicationResources_zh.properties and the output is, bala1=\u00e4\u00ba\u00b2\u00e7\u02c6\u00b1\u00e7\u0161\u201e bala2=\u00e9\ufffd\u017e\u00e5\u00b8\u00b8\u00e9\u00ab\u02dc\u00e5\u2026\u00b4\u00e7\u0161\u201e\u00e9\u20ac\u0161\u00e7\u0178\u00a5\u00e6\u201a\u00a8\u00e8\u00a2\u00ab\u00e5\ufffd\u2021\u00e8\ufffd\u0152\u00e4\u00b8\u00ba JSP is, %@ page contentType=text/html; charset=UTF-8 % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ page import=java.util.* % %@ page import=java.text.* % %@ page import=org.apache.struts.action.* % % Locale locale=new Locale(zh, CN); session.setAttribute(org.apache.struts.action.LOCALE,locale); % html:html locale=true head /head body bean:message key=bala1/ /BODY /HTML Result is, 亲爱的 -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n Issue for Chinese Locale.
I tried putting head:meta tag and still the issue is there. I attached the output html. HTML lang=zhHEAD META http-equiv=Content-Type content=text/html; charset=UTF-8 META content=MSHTML 6.00.2800.1522 name=GENERATOR/HEAD BODY亲爱的 /BODY/HTML Thanks a lot Jason for the help. -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, November 17, 2005 12:41 PM To: Struts Users Mailing List Subject: Re: i18n Issue for Chinese Locale. Everything looks good. UTF-8 is fine for Chinese. You are getting 9 bytes as a result, which is what you should get for UTF-8 encoding, which is good. But it seems the browser isn't reading it as UTF-8 and just displaying the bytes instead under the default ISO encoding. Try adding this html:html locale=true head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head If that doesn't work, can you post the html that is generated. Balasubramaniam, Sezhiyan wrote: Hi, We use STRUTS 1.0.2 in one of our extranet application and we need to support CHINESE locale as part of the scope. I used the following steps as Laurie pointed out in the earlier mail, but somehow the character set is getting corrupted and we are not getting the right result. Can Laurie, Frank or someone else can point me, where the problem could be? Thanks in advance, Bala Created dummy.properties in dreamweaver(UTF-8 supported) as bala1=亲爱的 bala2=非常高兴的通知您被升职为 Ran native2ascii dummy.properties ApplicationResources_zh.properties and the output is, bala1=\u00e4\u00ba\u00b2\u00e7\u02c6\u00b1\u00e7\u0161\u201e bala2=\u00e9\ufffd\u017e\u00e5\u00b8\u00b8\u00e9\u00ab\u02dc\u00e5\u2026\u00b4\u00e7\u0161\u201e\u00e9\u20ac\u0161\u00e7\u0178\u00a5\u00e6\u201a\u00a8\u00e8\u00a2\u00ab\u00e5\ufffd\u2021\u00e8\ufffd\u0152\u00e4\u00b8\u00ba JSP is, %@ page contentType=text/html; charset=UTF-8 % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ page import=java.util.* % %@ page import=java.text.* % %@ page import=org.apache.struts.action.* % % Locale locale=new Locale(zh, CN); session.setAttribute(org.apache.struts.action.LOCALE,locale); % html:html locale=true head /head body bean:message key=bala1/ /BODY /HTML Result is, 亲爱的 -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n and same value for 2 different locale
I DON'T USE THIS Locale.setDefault(Locale.FRENCH); I USE THIS session.setAttribute(Globals.LOCALE_KEY, locale); Me too I'm using the session to store the user's default locale! The first one I'm using is to set a default locale for the JVM! This hasn't the same behaviour as the second one so I'm using both... Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n and same value for 2 different locale
We have a similar issue that only appears sometimes to our webapp when its deployed to a websphere server. Our other environments that run tomcat have never exhibited this problem. Humm weird because I use Tomcat (5.5) here... Anyway I'll let you know If I find anything useful! Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n and same value for 2 different locale
I'd be very interested if you find out what is wrong.. We have a similar issue that only appears sometimes to our webapp when its deployed to a websphere server. Our other environments that run tomcat have never exhibited this problem. Jurn At 07:52 AM 22/10/2005, Christian Bourque wrote: Hi! I got a weird problem with my application (only in production), the problem is intermittent and I wasn't able to reproduce it yet. Sometimes the messages returned by bean:message aren't correct (english when it should be french and vice versa). I did a test in a jsp for a specific key and the value returned was in english for a french locale ??? What is weird is that it doesn't apply to all messages on the page, some messages are in french and the others in english ??? It's like at some point the Struts messages cache got corrupted... I have two properties file : - application.properties (default french) - application_en.properties (english) A default locale is set in my init servlet : Locale.setDefault(Locale.FRENCH); I never experienced the same behaviour on my development workstation (XP), the production server runs Linux (SUSE)... I reloaded the properties files live on the production with this code in a jsp (ugly hack) : MessageResourcesFactory factory =MessageResourcesFactory.createFactory(); MessageResources resources =factory.createResources(resources.application); application.setAttribute(org.apache.struts.action.MESSAGE, resources); And everything went back to normal (until next time)... I would appreciate any suggestions! Regards, Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i18n and same value for 2 different locale
public final class LocaleAction extends Action { . HttpSession session = request.getSession(); Locale locale = getLocale(request); String language = null; language = (String)PropertyUtils.getSimpleProperty(form, language); if (language != null language.length() 0) { locale = new java.util.Locale(language, ); } I DON'T USE THIS Locale.setDefault(Locale.FRENCH); I USE THIS session.setAttribute(Globals.LOCALE_KEY, locale); return mapping.findForward(success); -Mensaje original- De: Jurn Ho [mailto:[EMAIL PROTECTED] Enviado el: lunes, 24 de octubre de 2005 15:29 Para: Struts Users Mailing List Asunto: Re: i18n and same value for 2 different locale I'd be very interested if you find out what is wrong.. We have a similar issue that only appears sometimes to our webapp when its deployed to a websphere server. Our other environments that run tomcat have never exhibited this problem. Jurn At 07:52 AM 22/10/2005, Christian Bourque wrote: Hi! I got a weird problem with my application (only in production), the problem is intermittent and I wasn't able to reproduce it yet. Sometimes the messages returned by bean:message aren't correct (english when it should be french and vice versa). I did a test in a jsp for a specific key and the value returned was in english for a french locale ??? What is weird is that it doesn't apply to all messages on the page, some messages are in french and the others in english ??? It's like at some point the Struts messages cache got corrupted... I have two properties file : - application.properties (default french) - application_en.properties (english) A default locale is set in my init servlet : Locale.setDefault(Locale.FRENCH); I never experienced the same behaviour on my development workstation (XP), the production server runs Linux (SUSE)... I reloaded the properties files live on the production with this code in a jsp (ugly hack) : MessageResourcesFactory factory =MessageResourcesFactory.createFactory(); MessageResources resources =factory.createResources(resources.application); application.setAttribute(org.apache.struts.action.MESSAGE, resources); And everything went back to normal (until next time)... I would appreciate any suggestions! Regards, Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[FRIDAY] Re: i18n and same value for 2 different locale
Christian Bourque wrote: [...]the value returned was in english for a french locale ??? We know how much the French love speaking English. It's part of our plan for total world domination, one server at a time. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n, localeaction and actions
Im ade a mistake in my previous message the correct code is : System.out.println(request.getLocale()); if(request.getLocale()!=null) System.out.println(request.getLocale().getLanguage()); MessageResources lang=this.getResources(request); //instead of MessageResources lang=(MessageResources)request.getSession().getAttribute(Globals.MESSAGE_KEY); I have a look at struts action code and methods protected MessageResources getResources(HttpServletRequest request) and protected MessageResources getResources( HttpServletRequest request, String key) { are very different : The first one returns : return ((MessageResources) request.getAttribute(Globals.MESSAGES_KEY)); and the second one do : protected MessageResources getResources( HttpServletRequest request, String key) { // Identify the current module ServletContext context = getServlet().getServletContext(); ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, context); // Return the requested message resources instance return (MessageResources) context.getAttribute( key + moduleConfig.getPrefix()); } Xavier Vanderstukken wrote: Hello, All my site supports i18n mechanism correctly, using Struts LocaleAction and bean taglib. However when I try to access messageresource in my action the language of the messageresource is allways the default one (in my case en_us). System.out.println(request.getLocale()); if(request.getLocale()!=null) System.out.println(request.getLocale().getLanguage()); MessageResources lang=(MessageResources)request.getSession().getAttribute(Globals.MESSAGE_KEY); -- Output : en_US en and : System.out.println(lang.getMessage(mail.title)); output english message instead of current locale one. Am I doing something wrong to read the messageresource in the action classes, because i18n works correctly in my jsp pages? Is it due to the use of the Struts LocaleAction? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re: i18n and l10n issue - need help
Thanks a lot Laurie. I have the ApplicationResources_zh.properties in WEB-INF/classes along with other locale property files. The issue is, always I am seeing the default locale, even when I am explicitly changing the browser locale setting to Chinese. The things I did are, I created the ApplicationResources_zh.properties in MS-WORD with UTF-8 encoding (in text editors we could not enter the special language characters) Coded the jsp with response.setContentType(text/html;charset=UTF-8). Restarted the server and see the above behaviour. I doubt, my way of creating the property file is wrong. Please advice. -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Tuesday, September 27, 2005 1.54 PM To: user@struts.apache.org Subject: Re: i18n and l10n issue - need help Balasubramaniam, Sezhiyan wrote: We were giving locale support for English, Spanish, French and German in one of our STRUTS 1.0.1 intranet application. So far, it went smooth as all the resource bundles are ASCII based. Recently we got some requirements on double byte characters (CHINESE and JAPANESE) Even after we added the ApplicationResources_zh.properties and ApplicationResources_ja.properties into the classpath, STRUTS is not picking up the messages. As we are new to this i18n and l10n, we don't have much clue. Are we missing some thing? Is there any set-up needed for supporting the special languages. No, it should work the same way as it does for any other language. What behaviour are you seeing? Do you get missing messages, or messages from one of the other resource bundles? Is your ApplicationResources_zh.properties in the same place your other properties files are? And how are you selecting the locale to use? On the other side I was reading the STRUTS site and it says, Please note that the i18n support in a framework like Struts is limited to the presentation of internationalized text and images to the user. Support for Locale specific input methods (used with languages such as Japanese, Chinese, and Korean) is left up to the client device, which is usually a web browser. This doesn't effect the rendering of messages, just how the user enters text into forms and so on. In other words, that's talking about how the user enters data into your application, not how your application dispalys data to the user. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: i18n and l10n issue - need help
On 9/27/05, Balasubramaniam, Sezhiyan [EMAIL PROTECTED] wrote: Thanks a lot Laurie. I have the ApplicationResources_zh.properties in WEB-INF/classes along with other locale property files. The issue is, always I am seeing the default locale, even when I am explicitly changing the browser locale setting to Chinese. The things I did are, I created the ApplicationResources_zh.properties in MS-WORD with UTF-8 encoding (in text editors we could not enter the special language characters) Coded the jsp with response.setContentType(text/html;charset=UTF-8). Restarted the server and see the above behaviour. I doubt, my way of creating the property file is wrong. Please advice. See Struts MailReader Demonstration Application. In short: 1) Use plain 8-bit ASCII (or whatever western encoding it is) for ApplicationResources_zh.properties. 2) Encode all Unicode stuff with Unicode escapes like this is Russian for Cancel: button.cancel=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c 3) For Struts to pick up your localized properties you have to set locale in the session: locale = new Locale(language, ); session.setAttribute(Globals.LOCALE_KEY, locale); 4) This one is ok: Coded the jsp with response.setContentType(text/html;charset=UTF-8) But it is easier to set it right in the JSP: %@ page contentType=text/html;charset=UTF-8 language=java % 5) Make sure that this setting in struts-config.xml points to proper file: !-- Resources in WEB-INF/classes/ApplicationResources.properties -- message-resources parameter=ApplicationResources null=false/ If your resource file is in different directory, change parameter accordingly. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n and l10n issue - need help
Balasubramaniam, Sezhiyan wrote: Thanks a lot Laurie. I have the ApplicationResources_zh.properties in WEB-INF/classes along with other locale property files. The issue is, always I am seeing the default locale, even when I am explicitly changing the browser locale setting to Chinese. The things I did are, I created the ApplicationResources_zh.properties in MS-WORD with UTF-8 encoding (in text editors we could not enter the special language characters) That wont work properly; Java requires properties files to be in ASCII (or maybe Latin-1?). Use the native2ascii utility bundled with the JDK to convert your UTF-8 encoded file to the correct format. Coded the jsp with response.setContentType(text/html;charset=UTF-8). Restarted the server and see the above behaviour. Is it possible the browser isn't sending the right headers to select language 'zh'? Try setting the locale explicitly in your JSP and see if you can get the right messages that way (that'll confirm Struts is loading the messages correctly). If you can get that working, you can look into why the locale isn't being auto-detected correctly. L. I doubt, my way of creating the property file is wrong. Please advice. -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Tuesday, September 27, 2005 1.54 PM To: user@struts.apache.org Subject: Re: i18n and l10n issue - need help Balasubramaniam, Sezhiyan wrote: We were giving locale support for English, Spanish, French and German in one of our STRUTS 1.0.1 intranet application. So far, it went smooth as all the resource bundles are ASCII based. Recently we got some requirements on double byte characters (CHINESE and JAPANESE) Even after we added the ApplicationResources_zh.properties and ApplicationResources_ja.properties into the classpath, STRUTS is not picking up the messages. As we are new to this i18n and l10n, we don't have much clue. Are we missing some thing? Is there any set-up needed for supporting the special languages. No, it should work the same way as it does for any other language. What behaviour are you seeing? Do you get missing messages, or messages from one of the other resource bundles? Is your ApplicationResources_zh.properties in the same place your other properties files are? And how are you selecting the locale to use? On the other side I was reading the STRUTS site and it says, Please note that the i18n support in a framework like Struts is limited to the presentation of internationalized text and images to the user. Support for Locale specific input methods (used with languages such as Japanese, Chinese, and Korean) is left up to the client device, which is usually a web browser. This doesn't effect the rendering of messages, just how the user enters text into forms and so on. In other words, that's talking about how the user enters data into your application, not how your application dispalys data to the user. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n recommendation
What I use: First I store the ArrayList in the application context, with the locale identifies concatenated. And other useful localized strings that are constants. context.setAttribute(lang + _ + Constants.YEAR_MONTHS, ym); And in the action where there is a forward that will display that data, I pass the arraylist stored at context to the request scope. ServletContext sctx = servlet.getServletContext(); ArrayList countriesList = new ArrayList(); countriesList = (ArrayList) sctx.getAttribute(getLanguage(request) + _ + Constants.COUNTRIES); request.setAttribute(Constants.COUNTRIES, countriesList); This is what I do. But I wanna know too, if people are using other methods. Thanks Jadeler escribió: Im using a struts plugin to populate application wide data such list of values, etc from the database and then stored in a session. I also use the application resources bundles for text messages, labels, etc on my jsp pages. For displaying data pertaining to the locale the user has selected (data Im tring to display is a drop down of products), I've built a list of products from the db and stored it in 2 sessions (one for french and one for english). Im planning to use the logic struts tags to display these based on the locale. Is this recommended or are there other solutions? Thanks. Jadeler __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n recommendation
Jadeler wrote: Im using a struts plugin to populate application wide data such list of values, etc from the database and then stored in a session. I also use the application resources bundles for text messages, labels, etc on my jsp pages. For displaying data pertaining to the locale the user has selected (data Im tring to display is a drop down of products), I've built a list of products from the db and stored it in 2 sessions (one for french and one for english). Im planning to use the logic struts tags to display these based on the locale. Is this recommended or are there other solutions? If the data is application wide, why store it repeatedly in each session? Just store it once, in application context. For application wide data that's localized, put it in a map keyed by locale and put the map in application context. Storing it in sessions just means that every session using a particular locale will have a redundant copy of the same data. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n recommendation
Thanks Laurie. Btw, I actually meant the application context, not the session. --- Laurie Harper [EMAIL PROTECTED] wrote: Jadeler wrote: Im using a struts plugin to populate application wide data such list of values, etc from the database and then stored in a session. I also use the application resources bundles for text messages, labels, etc on my jsp pages. For displaying data pertaining to the locale the user has selected (data Im tring to display is a drop down of products), I've built a list of products from the db and stored it in 2 sessions (one for french and one for english). Im planning to use the logic struts tags to display these based on the locale. Is this recommended or are there other solutions? If the data is application wide, why store it repeatedly in each session? Just store it once, in application context. For application wide data that's localized, put it in a map keyed by locale and put the map in application context. Storing it in sessions just means that every session using a particular locale will have a redundant copy of the same data. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Find your next car at http://autos.yahoo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N by pages
Hello, Maybe another idea if I understand well what you want. So you want to include a file, specific to the current locale definition. I need about the same feature, and was looking for a better way than mine to solve this. The only think is that I include a i18n _file_ in a general template, and i do not redirect the user direclty to this i18n file. You have only one tiles-def.xml, one struts-config.xml, one properties file per locale. The idea is to have the file name locale-specific (so stored in properties file), and to call the file via the properties file, so the correct, locale-specific, name is called. It gives : In the main file, where i include, i have, in state of simple tiles:insert attribute=.../ : jsp:include flush=false jsp:attribute name=page tiles:getAsString ignore=true jsp:attribute name=name i18n:message bundleRef=help key=help/ /jsp:attribute /tiles:getAsString /jsp:attribute /jsp:include Than, I have somewhere in my tiles_def.xml something like : put name=help value=custom.help/ And in my properties file (locale specific) something like custom.help=../help/customHelp_en.jsp and for another language, I have custom.help=../help/customHelp_fr.jsp Than, i need to modify the last line, and to specify it differently in my properties files, for all my locales. But i can have a different file per locale. Maybe this can be adapt at your specific needs. On the other way, maybe there's a better way to do this that mine ... ? Of course, something great would the use of tiles:insert baseName=... locale=... / ! Hope this can help someone ... On 29/06/05, Yaroslav Novytskyy [EMAIL PROTECTED] wrote: Hello! Jeff Beal wrote: ... Have you considered locale-specific CSS files to give a different presentation to the same JSP page? ... I have no idea of this. Can you, please, comment? Yaroslav Novytskyy. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Marc Demlenne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N by pages
Just a small mistake while copying my code here ... I've swapped to things. Sorry It is : jsp:include flush=false jsp:attribute name=page i18n:message bundleRef=help jsp:attribute name=key tiles:getAsString ignore=true name=help/ /jsp:attribute /i18n:message /jsp:attribute /jsp:include On 11/07/05, Marc Demlenne [EMAIL PROTECTED] wrote: Hello, Maybe another idea if I understand well what you want. So you want to include a file, specific to the current locale definition. I need about the same feature, and was looking for a better way than mine to solve this. The only think is that I include a i18n _file_ in a general template, and i do not redirect the user direclty to this i18n file. You have only one tiles-def.xml, one struts-config.xml, one properties file per locale. The idea is to have the file name locale-specific (so stored in properties file), and to call the file via the properties file, so the correct, locale-specific, name is called. It gives : In the main file, where i include, i have, in state of simple tiles:insert attribute=.../ : jsp:include flush=false jsp:attribute name=page tiles:getAsString ignore=true jsp:attribute name=name i18n:message bundleRef=help key=help/ /jsp:attribute /tiles:getAsString /jsp:attribute /jsp:include Than, I have somewhere in my tiles_def.xml something like : put name=help value=custom.help/ And in my properties file (locale specific) something like custom.help=../help/customHelp_en.jsp and for another language, I have custom.help=../help/customHelp_fr.jsp Than, i need to modify the last line, and to specify it differently in my properties files, for all my locales. But i can have a different file per locale. Maybe this can be adapt at your specific needs. On the other way, maybe there's a better way to do this that mine ... ? Of course, something great would the use of tiles:insert baseName=... locale=... / ! Hope this can help someone ... On 29/06/05, Yaroslav Novytskyy [EMAIL PROTECTED] wrote: Hello! Jeff Beal wrote: ... Have you considered locale-specific CSS files to give a different presentation to the same JSP page? ... I have no idea of this. Can you, please, comment? Yaroslav Novytskyy. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Marc Demlenne -- Marc Demlenne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N by pages
Hello! Jeff Beal wrote: ... Have you considered locale-specific CSS files to give a different presentation to the same JSP page? ... I have no idea of this. Can you, please, comment? Yaroslav Novytskyy. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N by pages
This is just an idea, depending on what sort of differences you have on your JSP pages, it may or not work. As a trite and unrealistic example, let's say that your design team has told you that blue text will work better for your English-speaking audience, but purple text will work better for your French-speaking audience. Simply create two stylesheets: lang_EN.css: body { color: blue; } lang_FR.css: body { color: purple; } Then, in your JSP page, you'd just include the appropriate locale-specific CSS stylesheet to achieve the look you want. (sounds like a really quick custom tag.) I'm sure that color is not the extent of the differences between what you would want in your French-specific JSP's and your English-specific JSP's, but with all of the positioning and other capabilities in CSS, you could probably do a lot with this approach. On 6/29/05, Yaroslav Novytskyy [EMAIL PROTECTED] wrote: Hello! Jeff Beal wrote: ... Have you considered locale-specific CSS files to give a different presentation to the same JSP page? ... I have no idea of this. Can you, please, comment? Yaroslav Novytskyy. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N by pages
On 6/24/05, Yaroslav Novytskyy [EMAIL PROTECTED] wrote: Wow! meanwhile I've had the same idea. Posted simultaniosly :) But I doubt, that this solution will be compatible with tiles :( What do you think about that? Don't use tiles. :-) I'm serious. I used tiles for several years quite successfully. For my most recent project I switched to using the SiteMesh decoration via response filter approach. I can imagine there are some complex page layout webapps where Tiles might work better. For a standard webapp with a header/navArea/content/footer breakdown, SiteMesh is more than sufficient and *way* simpler to configure than the tiles approach. Unless you have a huge investment already in using Tiles, I recommend checking out SiteMesh as an alternative that would be compatible with the custom ActionMapping approach suggested by Jeff. You can see an example of SiteMesh in the Equinox simple webapp starter project put together by Matt Raible. Google Equinox Raible to look it up on the web. . -Van -- - Mike Van Riper [EMAIL PROTECTED] Best regards Yaroslav Novytskyy Jeff Beal wrote: Probably your best bet would be to use a custom ActionMapping and override the findForward() method to return a Locale-specific JSP page. On 6/24/05, Yaroslav Novytskyy [EMAIL PROTECTED] wrote: Hi! This is exactli what I'd like to avoid and use l10n on pages level not level of defined strings in message bundles for different languages. I don't want to use the english (html) design and to translate english phrases to french, which will be included into english design. I want to use french _page_. That meens french design with includes french text - standalone french jsp. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N by pages
What you can do is have a jsp for each locale language such as page_fr.jsp and page_en.jsp. Your application can store the locale in the user's session object. Your application can update the session locale when the user switches between en fr. You can have the following forwards for the action in the struts-config.xml: forward name=en path=/WEB-INF/page_en.jsp /forward forward name=fr path=/WEB-INF/page_fr.jsp /forward In your ActionForm you can: return mapping.findForward(get the locale language from the session); HTH, Glenn On 6/24/05, Yaroslav Novytskyy [EMAIL PROTECTED] wrote: Hello, all! I just wonder if there is an existing (tested, prooved) way (a kind of development pattern) for Struts to make internationalization not by message resources but by pages (JSPs, templates)? The point is that using message resources deleloper can only define a string value for different locales. For example for en welcome=aaa for fr welcome=bbb, and you include it like titleout welcome/title. This produces titleaaa/title for en and titlebbb/title for fr. That makes you limited to localizing only strings, but not the format. E.G. I would like to output titleaaa/title for en and h1bbb/h1 for fr. And this not the matter of defining this strings (h1bbb/h1) in message bundles, but I would like to use separate JSPs for en and fr and that is the point. I would like have two jsp files: page1.en.jsp with content of titleaaa/title and page1.fr.jsp with h1bbb/h1. (P.S. this reduces much (maybe even terminates) the mess with message bundles). Please write all your suggestions and thoughts. Best regards Yaroslav Novytskyy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I18N by pages
Glenn et al Another option for Struts localisation is to embed your language specific strings typically with key=string defined within your ApplicationResources_language_country.Properties file struts-config.xml will reference message-resources for key-based tag or param-value (initialisation param) for your servlet for ApplicationResources (properties) file When these elements are configured properly in struts-config.xml then your bean-write will work with html-messages Take a look at this excellent tutorial located at http://www.systemmobile.com/articles/strutsMessageResources.html#creating-bundle Bon Chance, Martin- Etats Unis 001-617-852-7822 - Original Message - From: Glenn Deschênes [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Friday, June 24, 2005 9:52 AM Subject: Re: I18N by pages What you can do is have a jsp for each locale language such as page_fr.jsp and page_en.jsp. Your application can store the locale in the user's session object. Your application can update the session locale when the user switches between en fr. You can have the following forwards for the action in the struts-config.xml: forward name=en path=/WEB-INF/page_en.jsp /forward forward name=fr path=/WEB-INF/page_fr.jsp /forward In your ActionForm you can: return mapping.findForward(get the locale language from the session); HTH, Glenn On 6/24/05, Yaroslav Novytskyy [EMAIL PROTECTED] wrote: Hello, all! I just wonder if there is an existing (tested, prooved) way (a kind of development pattern) for Struts to make internationalization not by message resources but by pages (JSPs, templates)? The point is that using message resources deleloper can only define a string value for different locales. For example for en welcome=aaa for fr welcome=bbb, and you include it like titleout welcome/title. This produces titleaaa/title for en and titlebbb/title for fr. That makes you limited to localizing only strings, but not the format. E.G. I would like to output titleaaa/title for en and h1bbb/h1 for fr. And this not the matter of defining this strings (h1bbb/h1) in message bundles, but I would like to use separate JSPs for en and fr and that is the point. I would like have two jsp files: page1.en.jsp with content of titleaaa/title and page1.fr.jsp with h1bbb/h1. (P.S. this reduces much (maybe even terminates) the mess with message bundles). Please write all your suggestions and thoughts. Best regards Yaroslav Novytskyy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]