Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The best way to use language files?

 
Dror Astricher
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

What is the best way to use language files?

1. Should I put it all in the database and then take it once into a Hashtable that will be saved in Session? Then I can use JSTL to get the variable very easy all over the application.
When the language change, the Hashtable will be loaded with the new language from the database.

2.Should I use text files to store the language variable? and then again once puting it into a hashtable and so on.

3.Can I use a properties file like the ApplicationResource in Struts to store the language variables?

4.Should I just hardcode the variable in different language Hashtables, and then assign the right Hashtable to the Hashtable I use in my Jsp?

Many thanks in advance and have a great day

Dror
[ May 25, 2006: Message edited by: Dror Astricher ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dror,

We have a forum dedicated to Struts.
You should have better luck with this question there.
I'll move it for you.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Re-opened at the request of the original poster.
 
Dror Astricher
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben
 
Manesh Kumar
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are worrying about i18n and using Struts, then it is better to for application resource property files.

You can also easily change the language using

Action.setLocale(HttpServletRequest, Locale)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit confused. Are you using Struts or not?

If not, investigate the use of property files and the JSTL I18N tags.
[ May 25, 2006: Message edited by: Bear Bibeault ]
 
Dror Astricher
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys

I wasn't sure if to use Struts or not. I will use it and implement it's i18n.

Thanks,
Dror
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not to be a wet blanket, but in my opinion adopting Struts just to use the I18N stuff is way overkill. Personally, I'd use the standardized JSTL mechanisms over a proprietary one.

If you're already using Struts, that's a different story...
[ May 25, 2006: Message edited by: Bear Bibeault ]
 
Dror Astricher
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice Bear

I'm not planing on using Struts just because of the i18n
I was wondering what are the benefits of Struts that everyone is using it. It looks like I can do everything that Struts do with JSTL-servlets-model and easier.
I also think it's clearer.
The only thing I find special is that when you come back after validation, the form fields are still full with what you typed before.

Maybe, as I read in one of the forums, I should just try to get used to Struts and then see its true benefits. That's why I was thinking of using it.

I would be very happy to get your opinion.

And don't worry, I'm not going to make it a Struts discussion


Thanks again
Dror
[ May 25, 2006: Message edited by: Dror Astricher ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dror Astricher:

I'm not planing on using Struts just because of the i18n
I was wondering what are the benefits of Struts that everyone is using it. It looks like I can do everything that Struts do with JSTL-servlets-model and easier.
I also think it's clearer.


At the risk of turning this into a Struts discussion, that is exactly my opinion. I'm not a fan of Struts -- I think you can do much better with much simpler mechanisms. I think a lot of people use Struts because they think that it's the only way to create a Model 2 web app, or because someone "higher up" says that they have to.


The only thing I find special is that when you come back after validation, the form fields are still full with what you typed before.


That's also pretty easy to instrument on your own.


Maybe, as I read in one of the forums, I should just try to get used to Struts and then see its true benefits. That's why I was thinking of using it.


To me that reeks of "everyone else is jumping off the bridge, why don't I?"

I would be very happy to get your opinion.


I have 2: (1) learning a bit about Struts so that it helps boost your resume is never a bad thing (heck, learning almost anything new is hardly ever a bad thing), and (2) actually use it only if you see a clear benefit that's more compelling than "everybody else is doing it".
[ May 25, 2006: Message edited by: Bear Bibeault ]
 
Dror Astricher
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear

I liked your answer

Dror
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome. But just to emphasize... this is my opinion based on my own evaluation of studying Struts and other large frameworks. While I receommend that you not adopt something like Struts just to implement one feature (like I18N), in general I enourage people to look into things and determine for themselves whether they might get value out of something.

Btw, I consider asking for informed opinions, as you are doing, part of "looking into things".
 
Dror Astricher
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, have a great day
[ May 25, 2006: Message edited by: Dror Astricher ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic