[appfuse-user] i18n
Hi,Matt How to display location Language in jsp ,example: Best Regards, --Cody.Zhang
Re: [appfuse-user] I18N Problem
Marc; Thanks ! I have tried it on the header jsp and it worked just fine ! The link you have provided is amazing .. it went directly to my Delicious ! On Mon, Aug 25, 2008 at 1:39 PM, Marc Siramy <[EMAIL PROTECTED]> wrote: > You need the following line at the top of your jsps: > <%@ page language="java" pageEncoding="utf-8" > contentType="text/html;charset=utf-8" %> . > > .. and .. you can see here if you didn't miss a step (it helped mysel > recently): > http://blogs.warwick.ac.uk/kieranshaw/entry/utf-8_internationalisation_with. > > Hope that helps. > > -- > Marc > > 2008/8/25 alibehzadian <[EMAIL PROTECTED]> > > >> In meta.jsp (that is included in every JSP) I have the following line: >> >> >> and my IDE is set to use UTF-8 as its encoding. Even I set encoding >> manually >> to UTF-8 (with some tools) and then rebuild the project and still have the >> problem. >> >> I guess the problem is related to order of filters or is related to >> sitemesh? >> >> Thanks, >> Ali Behzadian Nejad. >> >> >> -- >> View this message in context: >> http://www.nabble.com/I18N-Problem-tp19132153s2369p19139967.html >> Sent from the AppFuse - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > -- Regards, Youssef
Re: [appfuse-user] I18N Problem
You need the following line at the top of your jsps: <%@ page language="java" pageEncoding="utf-8" contentType="text/html;charset=utf-8" %> . .. and .. you can see here if you didn't miss a step (it helped mysel recently): http://blogs.warwick.ac.uk/kieranshaw/entry/utf-8_internationalisation_with. Hope that helps. -- Marc 2008/8/25 alibehzadian <[EMAIL PROTECTED]> > > In meta.jsp (that is included in every JSP) I have the following line: > > > and my IDE is set to use UTF-8 as its encoding. Even I set encoding > manually > to UTF-8 (with some tools) and then rebuild the project and still have the > problem. > > I guess the problem is related to order of filters or is related to > sitemesh? > > Thanks, > Ali Behzadian Nejad. > > > -- > View this message in context: > http://www.nabble.com/I18N-Problem-tp19132153s2369p19139967.html > Sent from the AppFuse - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: [appfuse-user] I18N Problem
Dear Youssef, When I put my text in ApplicationResource bundle with a key, I have no problem. This problem arises when I put i18n texts inside JSP. So problem is somewhere else. Ali Behzadian Nejad. -- View this message in context: http://www.nabble.com/I18N-Problem-tp19132153s2369p19140793.html Sent from the AppFuse - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] I18N Problem
It could be so , some suggestions : - check the generated WAR file itself to make sure that your JSPs are indeed utf-8 encoded and not garbaged. - change the default locale in your system, if it works then it has to be in some library that just takes the default locale. The solution would be then to just configure/change it to use utf-8. Regards, Youssef On Mon, Aug 25, 2008 at 11:42 AM, alibehzadian <[EMAIL PROTECTED]>wrote: > > In meta.jsp (that is included in every JSP) I have the following line: > > > and my IDE is set to use UTF-8 as its encoding. Even I set encoding > manually > to UTF-8 (with some tools) and then rebuild the project and still have the > problem. > > I guess the problem is related to order of filters or is related to > sitemesh? > > Thanks, > Ali Behzadian Nejad. > > > -- > View this message in context: > http://www.nabble.com/I18N-Problem-tp19132153s2369p19139967.html > Sent from the AppFuse - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Regards, Youssef
Re: [appfuse-user] I18N Problem
In meta.jsp (that is included in every JSP) I have the following line: and my IDE is set to use UTF-8 as its encoding. Even I set encoding manually to UTF-8 (with some tools) and then rebuild the project and still have the problem. I guess the problem is related to order of filters or is related to sitemesh? Thanks, Ali Behzadian Nejad. -- View this message in context: http://www.nabble.com/I18N-Problem-tp19132153s2369p19139967.html Sent from the AppFuse - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] I18N Problem
Look into your IDEs settings whether it saves the file in UTF. I had similar problems on Windows XP with Eclipse. By default, it took a different encoding. Martin alibehzadian wrote: > > Hi, > > I used Persian text right inside JSP. I saved JSP file with UTF-8 encoding > and then I build the project. > After visiting the JSP, all texts garble. I guess the problem is related > to sitemesh decorator but I have > no idea how to solve this problem. Any idea? > > Ali Behzadian Nejad. > -- View this message in context: http://www.nabble.com/I18N-Problem-tp19132153s2369p19138652.html Sent from the AppFuse - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] I18N Problem
On Sun, Aug 24, 2008 at 7:41 PM, alibehzadian <[EMAIL PROTECTED]>wrote: > > Hi, > > I used Persian text right inside JSP. I saved JSP file with UTF-8 encoding You have to make sure also that the pages that are rendered to the client (browser) is identified as UTF-8 encoded (not sure if this is the default in appfuse or not). > > and then I build the project. > After visiting the JSP, all texts garble. I guess the problem is related to > sitemesh decorator but I have > no idea how to solve this problem. Any idea? > > Ali Behzadian Nejad. > -- > View this message in context: > http://www.nabble.com/I18N-Problem-tp19132153s2369p19132153.html > Sent from the AppFuse - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Regards, Youssef
Re: [appfuse-user] I18N Problem
Dear Matt, I did what you said, but the problem still exists. I also disabled the localeFilter but nothing changed. Any idea? Ali Behzadian Nejad. -- View this message in context: http://www.nabble.com/I18N-Problem-tp19132153s2369p19138567.html Sent from the AppFuse - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] I18N Problem
You might try commenting out the filter-mapping for the gzipFilter in web.xml - it's possible this is causing the problem. Matt On Sun, Aug 24, 2008 at 10:41 AM, alibehzadian <[EMAIL PROTECTED]> wrote: > > Hi, > > I used Persian text right inside JSP. I saved JSP file with UTF-8 encoding > and then I build the project. > After visiting the JSP, all texts garble. I guess the problem is related to > sitemesh decorator but I have > no idea how to solve this problem. Any idea? > > Ali Behzadian Nejad. > -- > View this message in context: > http://www.nabble.com/I18N-Problem-tp19132153s2369p19132153.html > Sent from the AppFuse - User mailing list archive at Nabble.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]
[appfuse-user] I18N Problem
Hi, I used Persian text right inside JSP. I saved JSP file with UTF-8 encoding and then I build the project. After visiting the JSP, all texts garble. I guess the problem is related to sitemesh decorator but I have no idea how to solve this problem. Any idea? Ali Behzadian Nejad. -- View this message in context: http://www.nabble.com/I18N-Problem-tp19132153s2369p19132153.html Sent from the AppFuse - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] i18n with struts 2 : a bug?
These steps should reproduce the issue: 1. There needs to be ApplicationResources localization files that contain the key used for this test for at least two languages, one of which is the default VM locale. 2.Put the following snippet into a jsp, action naturally has to extend ActionSupport: 3. Using 'locale' GET parameter, change the application language into a language that is not the default. 4. Go to jsp page. The two tags should print out different localizations. The one using getText will print out the one in default language. On Tue, May 27, 2008 at 5:09 PM, Matt Raible <[EMAIL PROTECTED]> wrote: > Can you please provide the steps necessary to reproduce this issue? > > Thanks, > > Matt > > On Tue, May 27, 2008 at 2:01 AM, Jukka Välimaa <[EMAIL PROTECTED]> > wrote: > > Hi all, > > > > I'm using Appfuse 1.01, with most of the changes of 1.02 included. The > > archetype is Struts 2 modular. > > > > My problem is that using getText() method in the jsp doesn't work > properly; > > it doesn't get the correct localization. All other methods, including > using > > getText() before result is rendered, work perfectly fine. But getText(), > > when used in jsp, returns a locale that is different from the one > selected > > in the application. It seems to select the locale based on the locale of > > server environment. When I removed the following lines from web.xml, > getText > > method used in jsps continued to work, despite all other localizations > being > > out: > > > >> > >> > >> > >> > >> javax.servlet.jsp.jstl.fmt.localizationContext > >> ApplicationResources > >> > >> > >> > >> > >> > javax.servlet.jsp.jstl.fmt.fallbackLocale > >> en > >> > > > > According to a friend, the same problem exists in Appfuse showcase. Any > idea > > what might be causing this and how to fix it? >
Re: [appfuse-user] i18n in action
you have a point there. i thought about it. if like the settings for date is business knowledge or view. at the end i like my jsp to be simple so i moved it into my model. tibi sarat.pediredla wrote: I can't see how i18n is a model/business layer technology? i18n purely relates to presentation and the view layer technology and hence should be dealt with in the view. If the data is international, using UTF-8 charsets on your DB makes it i18n enabled by default. The very fact that a application can have one core model and controller but be represented in many international formats deems it is a presentation/view layer responsibility. tibi-3 wrote: have now: not thread safe etc just a start import java.util.ResourceBundle; import org.apache.log4j.Logger; import org.appfuse.Constants; import org.appfuse.model.BaseObject; import org.springframework.context.i18n.LocaleContextHolder; public abstract class MyBaseObject extends BaseObject { static Logger logger = Logger.getLogger(MyBaseObject.class); ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); public String getText(String key) { try { return messages.getString(key); } catch (RuntimeException e) { logger.info("Could not find the key: '" + key + "'"); return "??" + key + "??"; } } } tibi wrote: yes works great: ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); logger.debug(messages.getString("company.url")); and make sure you import: import org.appfuse.Constants; i will make a myBaseObject with a getText method in it.. than it will be nice and equal to my action ;) tibi Matt Raible wrote: On 4/26/07, Jonathan Tse <[EMAIL PROTECTED]> wrote: I see your point. And I agree that Model can reach MessageSourceAccessor. Currently in Spring MVC, i18n is not supported very well too (or i miss something?). I duplicated BaseFormController to a BaseController so that all controllers which implements org.springframework.web.servlet.mvc.Controller are changed to extend this class. So, is there anyway that we can provide a MessageSourceAcceessor to BaseObject? Why not use a regular ol' ResourceBundle. You should be able to do this in your model object: ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); The user's locale is stored in a ThreadLocale from the LocaleFilter. I don't know how thread-safe this is, but it should work. Of course, you might have to manipulate your DAO tests so ApplicationResources.properties is on your classpath - but this should work. I don't know how thread safe it is or how it'll work if you transport your model objects as DTOs over web services. Matt Jonathan tibi wrote: there are more situations where it could be handy to have i18n if you want to keep your jsp clean. like get fullname class user{ string getFullname(){ return super.getText("fullname",first, last);// en: matt raible - hu: raible, matt } } offcoure this could be done in the jsp but i like java in model and tags in jsp ;) tibi tibi wrote: and the model can't be i18n? if i would put the i18n into the database that would be realy a lot of overhead. than i rather do iets the strange why ;) tibi Matt Raible wrote: On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? Because it's part of the model/dao layer. You might want to use something like the following to 1i8n-ize your data tier. http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational Matt tibi tibi wrote: mmm its business knowledge i like it to be in the model. and i like to simplify my jsp as much as possible. i could push my action into my model and use the getText method. a bit wierd but seems logical. there are more examples where a getText comes in handy. like if you want the date.format tibi Matt Raible wrote: I would do some checking in your view - i.e. test="${empty locations}">, otherwise show city. Matt On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: pseudo code: class Event list locations String getSimpleLocation(){ if(locations.size()==1){ return location.get(0).getCity(); } return 'traveling'; } someting like this? tibi Matt Raible wrote: I don't understand what you're trying to do - can you post code? On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: i have an e
Re: [appfuse-user] i18n in action
I can't see how i18n is a model/business layer technology? i18n purely relates to presentation and the view layer technology and hence should be dealt with in the view. If the data is international, using UTF-8 charsets on your DB makes it i18n enabled by default. The very fact that a application can have one core model and controller but be represented in many international formats deems it is a presentation/view layer responsibility. tibi-3 wrote: > > have now: > not thread safe etc just a start > > import java.util.ResourceBundle; > > import org.apache.log4j.Logger; > import org.appfuse.Constants; > import org.appfuse.model.BaseObject; > import org.springframework.context.i18n.LocaleContextHolder; > > public abstract class MyBaseObject extends BaseObject { > > static Logger logger = Logger.getLogger(MyBaseObject.class); > ResourceBundle messages = > ResourceBundle.getBundle(Constants.BUNDLE_KEY, > LocaleContextHolder.getLocale()); > > public String getText(String key) { > try { > return messages.getString(key); > } catch (RuntimeException e) { > logger.info("Could not find the key: '" + key + "'"); > return "??" + key + "??"; > } > > } > } > > > tibi wrote: >> yes works great: >> >>ResourceBundle messages = >>ResourceBundle.getBundle(Constants.BUNDLE_KEY, >>LocaleContextHolder.getLocale()); >>logger.debug(messages.getString("company.url")); >> >> and make sure you import: >> import org.appfuse.Constants; >> >> i will make a myBaseObject with a getText method in it.. than it will >> be nice and equal to my action ;) >> >> tibi >> >> Matt Raible wrote: >>> On 4/26/07, Jonathan Tse <[EMAIL PROTECTED]> wrote: I see your point. And I agree that Model can reach MessageSourceAccessor. Currently in Spring MVC, i18n is not supported very well too (or i miss something?). I duplicated BaseFormController to a BaseController so that all controllers which implements org.springframework.web.servlet.mvc.Controller are changed to extend this class. So, is there anyway that we can provide a MessageSourceAcceessor to BaseObject? >>> >>> Why not use a regular ol' ResourceBundle. You should be able to do >>> this in your model object: >>> >>> ResourceBundle messages = >>> ResourceBundle.getBundle(Constants.BUNDLE_KEY, >>> LocaleContextHolder.getLocale()); >>> >>> The user's locale is stored in a ThreadLocale from the LocaleFilter. >>> I don't know how thread-safe this is, but it should work. Of course, >>> you might have to manipulate your DAO tests so >>> ApplicationResources.properties is on your classpath - but this should >>> work. I don't know how thread safe it is or how it'll work if you >>> transport your model objects as DTOs over web services. >>> >>> Matt >>> Jonathan tibi wrote: > there are more situations where it could be handy to have i18n if you > want to keep your jsp clean. > like get fullname > > class user{ > > string getFullname(){ > return super.getText("fullname",first, last);// en: matt raible - hu: > raible, matt > } > > } > > offcoure this could be done in the jsp but i like java in model and > tags in jsp ;) > > > tibi > > > > tibi wrote: >> and the model can't be i18n? >> >> if i would put the i18n into the database that would be realy a lot >> of overhead. than i rather do iets the strange why ;) >> >> tibi >> >> Matt Raible wrote: >>> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? >>> >>> Because it's part of the model/dao layer. You might want to use >>> something like the following to 1i8n-ize your data tier. >>> >>> http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational >>> >>> >>> Matt >>> tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. >>> test="${empty >> locations}">, otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations
Re: [appfuse-user] i18n in action
have now: not thread safe etc just a start import java.util.ResourceBundle; import org.apache.log4j.Logger; import org.appfuse.Constants; import org.appfuse.model.BaseObject; import org.springframework.context.i18n.LocaleContextHolder; public abstract class MyBaseObject extends BaseObject { static Logger logger = Logger.getLogger(MyBaseObject.class); ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); public String getText(String key) { try { return messages.getString(key); } catch (RuntimeException e) { logger.info("Could not find the key: '" + key + "'"); return "??" + key + "??"; } } } tibi wrote: yes works great: ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); logger.debug(messages.getString("company.url")); and make sure you import: import org.appfuse.Constants; i will make a myBaseObject with a getText method in it.. than it will be nice and equal to my action ;) tibi Matt Raible wrote: On 4/26/07, Jonathan Tse <[EMAIL PROTECTED]> wrote: I see your point. And I agree that Model can reach MessageSourceAccessor. Currently in Spring MVC, i18n is not supported very well too (or i miss something?). I duplicated BaseFormController to a BaseController so that all controllers which implements org.springframework.web.servlet.mvc.Controller are changed to extend this class. So, is there anyway that we can provide a MessageSourceAcceessor to BaseObject? Why not use a regular ol' ResourceBundle. You should be able to do this in your model object: ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); The user's locale is stored in a ThreadLocale from the LocaleFilter. I don't know how thread-safe this is, but it should work. Of course, you might have to manipulate your DAO tests so ApplicationResources.properties is on your classpath - but this should work. I don't know how thread safe it is or how it'll work if you transport your model objects as DTOs over web services. Matt Jonathan tibi wrote: > there are more situations where it could be handy to have i18n if you > want to keep your jsp clean. > like get fullname > > class user{ > > string getFullname(){ > return super.getText("fullname",first, last);// en: matt raible - hu: > raible, matt > } > > } > > offcoure this could be done in the jsp but i like java in model and > tags in jsp ;) > > > tibi > > > > tibi wrote: >> and the model can't be i18n? >> >> if i would put the i18n into the database that would be realy a lot >> of overhead. than i rather do iets the strange why ;) >> >> tibi >> >> Matt Raible wrote: >>> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? >>> >>> Because it's part of the model/dao layer. You might want to use >>> something like the following to 1i8n-ize your data tier. >>> >>> http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational >>> >>> >>> Matt >>> tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. test="${empty >> locations}">, otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations >>> >>> String getSimpleLocation(){ >>> if(locations.size()==1){ >>> return location.get(0).getCity(); >>> } >>> return 'traveling'; >>> } >>> >>> someting like this? >>> >>> tibi >>> >>> >>> Matt Raible wrote: >>> > I don't understand what you're trying to do - can you post code? >>> > >>> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> i have an event with a getSimpleLocation in it. >>> >> my object can have multiple location >>> >> if there is 1 location return the location >>> >> if there are multple return 'traveling' >>> >> >>> >> tibi >>> >> >>> >> Matt Raible wrote: >>> >> > How do you want to use i18n in your models? >>> >> > >>> >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> >> ok it works in actions but how can i use it in my models? >>> >> >> should i pass my action into the moddel to use her getText >>> method? >>> >> >> >>> >> >> tibi >>> >> >> >>> >> >> tibi wrote: >>> >> >
Re: [appfuse-user] i18n in action
yes works great: ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); logger.debug(messages.getString("company.url")); and make sure you import: import org.appfuse.Constants; i will make a myBaseObject with a getText method in it.. than it will be nice and equal to my action ;) tibi Matt Raible wrote: On 4/26/07, Jonathan Tse <[EMAIL PROTECTED]> wrote: I see your point. And I agree that Model can reach MessageSourceAccessor. Currently in Spring MVC, i18n is not supported very well too (or i miss something?). I duplicated BaseFormController to a BaseController so that all controllers which implements org.springframework.web.servlet.mvc.Controller are changed to extend this class. So, is there anyway that we can provide a MessageSourceAcceessor to BaseObject? Why not use a regular ol' ResourceBundle. You should be able to do this in your model object: ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); The user's locale is stored in a ThreadLocale from the LocaleFilter. I don't know how thread-safe this is, but it should work. Of course, you might have to manipulate your DAO tests so ApplicationResources.properties is on your classpath - but this should work. I don't know how thread safe it is or how it'll work if you transport your model objects as DTOs over web services. Matt Jonathan tibi wrote: > there are more situations where it could be handy to have i18n if you > want to keep your jsp clean. > like get fullname > > class user{ > > string getFullname(){ > return super.getText("fullname",first, last);// en: matt raible - hu: > raible, matt > } > > } > > offcoure this could be done in the jsp but i like java in model and > tags in jsp ;) > > > tibi > > > > tibi wrote: >> and the model can't be i18n? >> >> if i would put the i18n into the database that would be realy a lot >> of overhead. than i rather do iets the strange why ;) >> >> tibi >> >> Matt Raible wrote: >>> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? >>> >>> Because it's part of the model/dao layer. You might want to use >>> something like the following to 1i8n-ize your data tier. >>> >>> http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational >>> >>> >>> Matt >>> tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. , otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations >>> >>> String getSimpleLocation(){ >>> if(locations.size()==1){ >>> return location.get(0).getCity(); >>> } >>> return 'traveling'; >>> } >>> >>> someting like this? >>> >>> tibi >>> >>> >>> Matt Raible wrote: >>> > I don't understand what you're trying to do - can you post code? >>> > >>> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> i have an event with a getSimpleLocation in it. >>> >> my object can have multiple location >>> >> if there is 1 location return the location >>> >> if there are multple return 'traveling' >>> >> >>> >> tibi >>> >> >>> >> Matt Raible wrote: >>> >> > How do you want to use i18n in your models? >>> >> > >>> >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> >> ok it works in actions but how can i use it in my models? >>> >> >> should i pass my action into the moddel to use her getText >>> method? >>> >> >> >>> >> >> tibi >>> >> >> >>> >> >> tibi wrote: >>> >> >> > ahhh it must be the super.getText("") method ;) >>> >> >> > >>> >> >> > tibi >>> >> >> > >>> >> >> > tibi wrote: >>> >> >> >> hi, >>> >> >> >> >>> >> >> >> i can't find an example of how to use i18n from within my >>> actions. >>> >> >> >> in struts it used to something like this: >>> >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >>> >> >> >> ActionError("key.order.no.item")); >>> >> >> >> >>> >> >> >> but in struts2 this will not work. >>> >> >> >> >>> >> >> >> anyone? >>> >> >> >> >>> >> >> >> thanks >>> >> >> >> >>> >> >> >> tibi >>> >> >> >> >>> >> >> >> >>> >> >>> - >>>
Re: [appfuse-user] i18n in action
On 4/26/07, Jonathan Tse <[EMAIL PROTECTED]> wrote: I see your point. And I agree that Model can reach MessageSourceAccessor. Currently in Spring MVC, i18n is not supported very well too (or i miss something?). I duplicated BaseFormController to a BaseController so that all controllers which implements org.springframework.web.servlet.mvc.Controller are changed to extend this class. So, is there anyway that we can provide a MessageSourceAcceessor to BaseObject? Why not use a regular ol' ResourceBundle. You should be able to do this in your model object: ResourceBundle messages = ResourceBundle.getBundle(Constants.BUNDLE_KEY, LocaleContextHolder.getLocale()); The user's locale is stored in a ThreadLocale from the LocaleFilter. I don't know how thread-safe this is, but it should work. Of course, you might have to manipulate your DAO tests so ApplicationResources.properties is on your classpath - but this should work. I don't know how thread safe it is or how it'll work if you transport your model objects as DTOs over web services. Matt Jonathan tibi wrote: > there are more situations where it could be handy to have i18n if you > want to keep your jsp clean. > like get fullname > > class user{ > > string getFullname(){ > return super.getText("fullname",first, last);// en: matt raible - hu: > raible, matt > } > > } > > offcoure this could be done in the jsp but i like java in model and > tags in jsp ;) > > > tibi > > > > tibi wrote: >> and the model can't be i18n? >> >> if i would put the i18n into the database that would be realy a lot >> of overhead. than i rather do iets the strange why ;) >> >> tibi >> >> Matt Raible wrote: >>> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? >>> >>> Because it's part of the model/dao layer. You might want to use >>> something like the following to 1i8n-ize your data tier. >>> >>> http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational >>> >>> >>> Matt >>> tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. , otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations >>> >>> String getSimpleLocation(){ >>> if(locations.size()==1){ >>> return location.get(0).getCity(); >>> } >>> return 'traveling'; >>> } >>> >>> someting like this? >>> >>> tibi >>> >>> >>> Matt Raible wrote: >>> > I don't understand what you're trying to do - can you post code? >>> > >>> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> i have an event with a getSimpleLocation in it. >>> >> my object can have multiple location >>> >> if there is 1 location return the location >>> >> if there are multple return 'traveling' >>> >> >>> >> tibi >>> >> >>> >> Matt Raible wrote: >>> >> > How do you want to use i18n in your models? >>> >> > >>> >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> >> ok it works in actions but how can i use it in my models? >>> >> >> should i pass my action into the moddel to use her getText >>> method? >>> >> >> >>> >> >> tibi >>> >> >> >>> >> >> tibi wrote: >>> >> >> > ahhh it must be the super.getText("") method ;) >>> >> >> > >>> >> >> > tibi >>> >> >> > >>> >> >> > tibi wrote: >>> >> >> >> hi, >>> >> >> >> >>> >> >> >> i can't find an example of how to use i18n from within my >>> actions. >>> >> >> >> in struts it used to something like this: >>> >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >>> >> >> >> ActionError("key.order.no.item")); >>> >> >> >> >>> >> >> >> but in struts2 this will not work. >>> >> >> >> >>> >> >> >> anyone? >>> >> >> >> >>> >> >> >> thanks >>> >> >> >> >>> >> >> >> tibi >>> >> >> >> >>> >> >> >> >>> >> >>> - >>> >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> >> >> >> For additional commands, e-mail: >>> [EMAIL PROTECTED] >>> >> >> >> >>> >> >> >> >>> >> >> > >>> >> >> > >>> >> >>> - >>> >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >>> >> >> > For additional commands, e-mail:
Re: [appfuse-user] i18n in action
I see your point. And I agree that Model can reach MessageSourceAccessor. Currently in Spring MVC, i18n is not supported very well too (or i miss something?). I duplicated BaseFormController to a BaseController so that all controllers which implements org.springframework.web.servlet.mvc.Controller are changed to extend this class. So, is there anyway that we can provide a MessageSourceAcceessor to BaseObject? Jonathan tibi wrote: there are more situations where it could be handy to have i18n if you want to keep your jsp clean. like get fullname class user{ string getFullname(){ return super.getText("fullname",first, last);// en: matt raible - hu: raible, matt } } offcoure this could be done in the jsp but i like java in model and tags in jsp ;) tibi tibi wrote: and the model can't be i18n? if i would put the i18n into the database that would be realy a lot of overhead. than i rather do iets the strange why ;) tibi Matt Raible wrote: On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? Because it's part of the model/dao layer. You might want to use something like the following to 1i8n-ize your data tier. http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational Matt tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. , otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations >>> >>> String getSimpleLocation(){ >>> if(locations.size()==1){ >>> return location.get(0).getCity(); >>> } >>> return 'traveling'; >>> } >>> >>> someting like this? >>> >>> tibi >>> >>> >>> Matt Raible wrote: >>> > I don't understand what you're trying to do - can you post code? >>> > >>> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> i have an event with a getSimpleLocation in it. >>> >> my object can have multiple location >>> >> if there is 1 location return the location >>> >> if there are multple return 'traveling' >>> >> >>> >> tibi >>> >> >>> >> Matt Raible wrote: >>> >> > How do you want to use i18n in your models? >>> >> > >>> >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> >> ok it works in actions but how can i use it in my models? >>> >> >> should i pass my action into the moddel to use her getText >>> method? >>> >> >> >>> >> >> tibi >>> >> >> >>> >> >> tibi wrote: >>> >> >> > ahhh it must be the super.getText("") method ;) >>> >> >> > >>> >> >> > tibi >>> >> >> > >>> >> >> > tibi wrote: >>> >> >> >> hi, >>> >> >> >> >>> >> >> >> i can't find an example of how to use i18n from within my >>> actions. >>> >> >> >> in struts it used to something like this: >>> >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >>> >> >> >> ActionError("key.order.no.item")); >>> >> >> >> >>> >> >> >> but in struts2 this will not work. >>> >> >> >> >>> >> >> >> anyone? >>> >> >> >> >>> >> >> >> thanks >>> >> >> >> >>> >> >> >> tibi >>> >> >> >> >>> >> >> >> >>> >> >>> - >>> >> >> >> 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] >>> >> >> >>> >> >> >>> >> > >>> >> > >>> >> >>> >> >>> - >>> >> 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] > > - 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 PROT
Re: [appfuse-user] i18n in action
there are more situations where it could be handy to have i18n if you want to keep your jsp clean. like get fullname class user{ string getFullname(){ return super.getText("fullname",first, last);// en: matt raible - hu: raible, matt } } offcoure this could be done in the jsp but i like java in model and tags in jsp ;) tibi tibi wrote: and the model can't be i18n? if i would put the i18n into the database that would be realy a lot of overhead. than i rather do iets the strange why ;) tibi Matt Raible wrote: On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? Because it's part of the model/dao layer. You might want to use something like the following to 1i8n-ize your data tier. http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational Matt tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. , otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations >>> >>> String getSimpleLocation(){ >>> if(locations.size()==1){ >>> return location.get(0).getCity(); >>> } >>> return 'traveling'; >>> } >>> >>> someting like this? >>> >>> tibi >>> >>> >>> Matt Raible wrote: >>> > I don't understand what you're trying to do - can you post code? >>> > >>> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> i have an event with a getSimpleLocation in it. >>> >> my object can have multiple location >>> >> if there is 1 location return the location >>> >> if there are multple return 'traveling' >>> >> >>> >> tibi >>> >> >>> >> Matt Raible wrote: >>> >> > How do you want to use i18n in your models? >>> >> > >>> >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> >> ok it works in actions but how can i use it in my models? >>> >> >> should i pass my action into the moddel to use her getText >>> method? >>> >> >> >>> >> >> tibi >>> >> >> >>> >> >> tibi wrote: >>> >> >> > ahhh it must be the super.getText("") method ;) >>> >> >> > >>> >> >> > tibi >>> >> >> > >>> >> >> > tibi wrote: >>> >> >> >> hi, >>> >> >> >> >>> >> >> >> i can't find an example of how to use i18n from within my >>> actions. >>> >> >> >> in struts it used to something like this: >>> >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >>> >> >> >> ActionError("key.order.no.item")); >>> >> >> >> >>> >> >> >> but in struts2 this will not work. >>> >> >> >> >>> >> >> >> anyone? >>> >> >> >> >>> >> >> >> thanks >>> >> >> >> >>> >> >> >> tibi >>> >> >> >> >>> >> >> >> >>> >> >>> - >>> >> >> >> 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] >>> >> >> >>> >> >> >>> >> > >>> >> > >>> >> >>> >> >>> - >>> >> 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] > > - 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]
Re: [appfuse-user] i18n in action
and the model can't be i18n? if i would put the i18n into the database that would be realy a lot of overhead. than i rather do iets the strange why ;) tibi Matt Raible wrote: On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? Because it's part of the model/dao layer. You might want to use something like the following to 1i8n-ize your data tier. http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational Matt tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. , otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations >>> >>> String getSimpleLocation(){ >>> if(locations.size()==1){ >>> return location.get(0).getCity(); >>> } >>> return 'traveling'; >>> } >>> >>> someting like this? >>> >>> tibi >>> >>> >>> Matt Raible wrote: >>> > I don't understand what you're trying to do - can you post code? >>> > >>> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> i have an event with a getSimpleLocation in it. >>> >> my object can have multiple location >>> >> if there is 1 location return the location >>> >> if there are multple return 'traveling' >>> >> >>> >> tibi >>> >> >>> >> Matt Raible wrote: >>> >> > How do you want to use i18n in your models? >>> >> > >>> >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> >> ok it works in actions but how can i use it in my models? >>> >> >> should i pass my action into the moddel to use her getText >>> method? >>> >> >> >>> >> >> tibi >>> >> >> >>> >> >> tibi wrote: >>> >> >> > ahhh it must be the super.getText("") method ;) >>> >> >> > >>> >> >> > tibi >>> >> >> > >>> >> >> > tibi wrote: >>> >> >> >> hi, >>> >> >> >> >>> >> >> >> i can't find an example of how to use i18n from within my >>> actions. >>> >> >> >> in struts it used to something like this: >>> >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >>> >> >> >> ActionError("key.order.no.item")); >>> >> >> >> >>> >> >> >> but in struts2 this will not work. >>> >> >> >> >>> >> >> >> anyone? >>> >> >> >> >>> >> >> >> thanks >>> >> >> >> >>> >> >> >> tibi >>> >> >> >> >>> >> >> >> >>> >> >>> - >>> >> >> >> 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] >>> >> >> >>> >> >> >>> >> > >>> >> > >>> >> >>> >> >>> - >>> >> 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] > > - 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: [appfuse-user] i18n in action
On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: why does the BaseObject not have a getText method? Because it's part of the model/dao layer. You might want to use something like the following to 1i8n-ize your data tier. http://www.theserverside.com/tt/blogs/showblog.tss?id=HibernateInternational Matt tibi tibi wrote: > mmm its business knowledge i like it to be in the model. > and i like to simplify my jsp as much as possible. > i could push my action into my model and use the getText method. > > a bit wierd but seems logical. > > there are more examples where a getText comes in handy. like if you > want the date.format > > tibi > > Matt Raible wrote: >> I would do some checking in your view - i.e. , otherwise show >> city. >> >> Matt >> >> On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> pseudo code: >>> >>> class Event >>> >>> list locations >>> >>> String getSimpleLocation(){ >>> if(locations.size()==1){ >>> return location.get(0).getCity(); >>> } >>> return 'traveling'; >>> } >>> >>> someting like this? >>> >>> tibi >>> >>> >>> Matt Raible wrote: >>> > I don't understand what you're trying to do - can you post code? >>> > >>> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> i have an event with a getSimpleLocation in it. >>> >> my object can have multiple location >>> >> if there is 1 location return the location >>> >> if there are multple return 'traveling' >>> >> >>> >> tibi >>> >> >>> >> Matt Raible wrote: >>> >> > How do you want to use i18n in your models? >>> >> > >>> >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >>> >> >> ok it works in actions but how can i use it in my models? >>> >> >> should i pass my action into the moddel to use her getText >>> method? >>> >> >> >>> >> >> tibi >>> >> >> >>> >> >> tibi wrote: >>> >> >> > ahhh it must be the super.getText("") method ;) >>> >> >> > >>> >> >> > tibi >>> >> >> > >>> >> >> > tibi wrote: >>> >> >> >> hi, >>> >> >> >> >>> >> >> >> i can't find an example of how to use i18n from within my >>> actions. >>> >> >> >> in struts it used to something like this: >>> >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >>> >> >> >> ActionError("key.order.no.item")); >>> >> >> >> >>> >> >> >> but in struts2 this will not work. >>> >> >> >> >>> >> >> >> anyone? >>> >> >> >> >>> >> >> >> thanks >>> >> >> >> >>> >> >> >> tibi >>> >> >> >> >>> >> >> >> >>> >> >>> - >>> >> >> >> 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] >>> >> >> >>> >> >> >>> >> > >>> >> > >>> >> >>> >> >>> - >>> >> 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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- http://raibledesigns.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] i18n in action
why does the BaseObject not have a getText method? tibi tibi wrote: mmm its business knowledge i like it to be in the model. and i like to simplify my jsp as much as possible. i could push my action into my model and use the getText method. a bit wierd but seems logical. there are more examples where a getText comes in handy. like if you want the date.format tibi Matt Raible wrote: I would do some checking in your view - i.e. , otherwise show city. Matt On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: pseudo code: class Event list locations String getSimpleLocation(){ if(locations.size()==1){ return location.get(0).getCity(); } return 'traveling'; } someting like this? tibi Matt Raible wrote: > I don't understand what you're trying to do - can you post code? > > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> i have an event with a getSimpleLocation in it. >> my object can have multiple location >> if there is 1 location return the location >> if there are multple return 'traveling' >> >> tibi >> >> Matt Raible wrote: >> > How do you want to use i18n in your models? >> > >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> >> ok it works in actions but how can i use it in my models? >> >> should i pass my action into the moddel to use her getText method? >> >> >> >> tibi >> >> >> >> tibi wrote: >> >> > ahhh it must be the super.getText("") method ;) >> >> > >> >> > tibi >> >> > >> >> > tibi wrote: >> >> >> hi, >> >> >> >> >> >> i can't find an example of how to use i18n from within my actions. >> >> >> in struts it used to something like this: >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >> >> >> ActionError("key.order.no.item")); >> >> >> >> >> >> but in struts2 this will not work. >> >> >> >> >> >> anyone? >> >> >> >> >> >> thanks >> >> >> >> >> >> tibi >> >> >> >> >> >> >> - >> >> >> 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] >> >> >> >> >> > >> > >> >> - >> 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] i18n in action
mmm its business knowledge i like it to be in the model. and i like to simplify my jsp as much as possible. i could push my action into my model and use the getText method. a bit wierd but seems logical. there are more examples where a getText comes in handy. like if you want the date.format tibi Matt Raible wrote: I would do some checking in your view - i.e. , otherwise show city. Matt On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: pseudo code: class Event list locations String getSimpleLocation(){ if(locations.size()==1){ return location.get(0).getCity(); } return 'traveling'; } someting like this? tibi Matt Raible wrote: > I don't understand what you're trying to do - can you post code? > > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> i have an event with a getSimpleLocation in it. >> my object can have multiple location >> if there is 1 location return the location >> if there are multple return 'traveling' >> >> tibi >> >> Matt Raible wrote: >> > How do you want to use i18n in your models? >> > >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> >> ok it works in actions but how can i use it in my models? >> >> should i pass my action into the moddel to use her getText method? >> >> >> >> tibi >> >> >> >> tibi wrote: >> >> > ahhh it must be the super.getText("") method ;) >> >> > >> >> > tibi >> >> > >> >> > tibi wrote: >> >> >> hi, >> >> >> >> >> >> i can't find an example of how to use i18n from within my actions. >> >> >> in struts it used to something like this: >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >> >> >> ActionError("key.order.no.item")); >> >> >> >> >> >> but in struts2 this will not work. >> >> >> >> >> >> anyone? >> >> >> >> >> >> thanks >> >> >> >> >> >> tibi >> >> >> >> >> >> >> - >> >> >> 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] >> >> >> >> >> > >> > >> >> - >> 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]
Re: [appfuse-user] i18n in action
I would do some checking in your view - i.e. , otherwise show city. Matt On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: pseudo code: class Event list locations String getSimpleLocation(){ if(locations.size()==1){ return location.get(0).getCity(); } return 'traveling'; } someting like this? tibi Matt Raible wrote: > I don't understand what you're trying to do - can you post code? > > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> i have an event with a getSimpleLocation in it. >> my object can have multiple location >> if there is 1 location return the location >> if there are multple return 'traveling' >> >> tibi >> >> Matt Raible wrote: >> > How do you want to use i18n in your models? >> > >> > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> >> ok it works in actions but how can i use it in my models? >> >> should i pass my action into the moddel to use her getText method? >> >> >> >> tibi >> >> >> >> tibi wrote: >> >> > ahhh it must be the super.getText("") method ;) >> >> > >> >> > tibi >> >> > >> >> > tibi wrote: >> >> >> hi, >> >> >> >> >> >> i can't find an example of how to use i18n from within my actions. >> >> >> in struts it used to something like this: >> >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >> >> >> ActionError("key.order.no.item")); >> >> >> >> >> >> but in struts2 this will not work. >> >> >> >> >> >> anyone? >> >> >> >> >> >> thanks >> >> >> >> >> >> tibi >> >> >> >> >> >> >> - >> >> >> 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] >> >> >> >> >> > >> > >> >> - >> 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] -- http://raibledesigns.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] i18n in action
pseudo code: class Event list locations String getSimpleLocation(){ if(locations.size()==1){ return location.get(0).getCity(); } return 'traveling'; } someting like this? tibi Matt Raible wrote: I don't understand what you're trying to do - can you post code? On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: i have an event with a getSimpleLocation in it. my object can have multiple location if there is 1 location return the location if there are multple return 'traveling' tibi Matt Raible wrote: > How do you want to use i18n in your models? > > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> ok it works in actions but how can i use it in my models? >> should i pass my action into the moddel to use her getText method? >> >> tibi >> >> tibi wrote: >> > ahhh it must be the super.getText("") method ;) >> > >> > tibi >> > >> > tibi wrote: >> >> hi, >> >> >> >> i can't find an example of how to use i18n from within my actions. >> >> in struts it used to something like this: >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >> >> ActionError("key.order.no.item")); >> >> >> >> but in struts2 this will not work. >> >> >> >> anyone? >> >> >> >> thanks >> >> >> >> tibi >> >> >> >> - >> >> 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] >> >> > > - 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: [appfuse-user] i18n in action
I don't understand what you're trying to do - can you post code? On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: i have an event with a getSimpleLocation in it. my object can have multiple location if there is 1 location return the location if there are multple return 'traveling' tibi Matt Raible wrote: > How do you want to use i18n in your models? > > On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: >> ok it works in actions but how can i use it in my models? >> should i pass my action into the moddel to use her getText method? >> >> tibi >> >> tibi wrote: >> > ahhh it must be the super.getText("") method ;) >> > >> > tibi >> > >> > tibi wrote: >> >> hi, >> >> >> >> i can't find an example of how to use i18n from within my actions. >> >> in struts it used to something like this: >> >> errors.add(ActionErrors.GLOBAL_ERROR, new >> >> ActionError("key.order.no.item")); >> >> >> >> but in struts2 this will not work. >> >> >> >> anyone? >> >> >> >> thanks >> >> >> >> tibi >> >> >> >> - >> >> 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] >> >> > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- http://raibledesigns.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] i18n in action
i have an event with a getSimpleLocation in it. my object can have multiple location if there is 1 location return the location if there are multple return 'traveling' tibi Matt Raible wrote: How do you want to use i18n in your models? On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: ok it works in actions but how can i use it in my models? should i pass my action into the moddel to use her getText method? tibi tibi wrote: > ahhh it must be the super.getText("") method ;) > > tibi > > tibi wrote: >> hi, >> >> i can't find an example of how to use i18n from within my actions. >> in struts it used to something like this: >> errors.add(ActionErrors.GLOBAL_ERROR, new >> ActionError("key.order.no.item")); >> >> but in struts2 this will not work. >> >> anyone? >> >> thanks >> >> tibi >> >> - >> 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] i18n in action
How do you want to use i18n in your models? On 4/26/07, tibi <[EMAIL PROTECTED]> wrote: ok it works in actions but how can i use it in my models? should i pass my action into the moddel to use her getText method? tibi tibi wrote: > ahhh it must be the super.getText("") method ;) > > tibi > > tibi wrote: >> hi, >> >> i can't find an example of how to use i18n from within my actions. >> in struts it used to something like this: >> errors.add(ActionErrors.GLOBAL_ERROR, new >> ActionError("key.order.no.item")); >> >> but in struts2 this will not work. >> >> anyone? >> >> thanks >> >> tibi >> >> - >> 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] -- http://raibledesigns.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] i18n in action
ok it works in actions but how can i use it in my models? should i pass my action into the moddel to use her getText method? tibi tibi wrote: ahhh it must be the super.getText("") method ;) tibi tibi wrote: hi, i can't find an example of how to use i18n from within my actions. in struts it used to something like this: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("key.order.no.item")); but in struts2 this will not work. anyone? thanks tibi - 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]
Re: [appfuse-user] i18n in action
ahhh it must be the super.getText("") method ;) tibi tibi wrote: hi, i can't find an example of how to use i18n from within my actions. in struts it used to something like this: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("key.order.no.item")); but in struts2 this will not work. anyone? thanks tibi - 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]
[appfuse-user] i18n in action
hi, i can't find an example of how to use i18n from within my actions. in struts it used to something like this: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("key.order.no.item")); but in struts2 this will not work. anyone? thanks tibi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [appfuse-user] I18N error in tutorial - Using Struts 2
Fixed - thanks! On 3/7/07, wnqq <[EMAIL PROTECTED]> wrote: In the tutorial of "Using Struts 2": http://appfuse.org/display/APF/Using+Struts+2 The following line of code: should be fixed as: Otherwise, the test will fail in I18N environment. -- View this message in context: http://www.nabble.com/I18N-error-in-tutorial---Using-Struts-2-tf3361250s2369.html#a9350284 Sent from the AppFuse - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- http://raibledesigns.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[appfuse-user] I18N error in tutorial - Using Struts 2
In the tutorial of "Using Struts 2": http://appfuse.org/display/APF/Using+Struts+2 The following line of code: should be fixed as: Otherwise, the test will fail in I18N environment. -- View this message in context: http://www.nabble.com/I18N-error-in-tutorial---Using-Struts-2-tf3361250s2369.html#a9350284 Sent from the AppFuse - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]