zhoupan / jmesa

Automatically exported from code.google.com/p/jmesa
0 stars 0 forks source link

Locale specific display #315

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use setTitleKey(String x) instead of setKey(x)
2. put in keys in my resource bundle (backed by properties file)
3. run the project

What is the expected output? What do you see instead?
-empty display on the title of the column

What version of the product are you using? On what operating system?
-latest-

Please provide any additional information below.
-i might be missing a step on configuring the resource bundle?
-i find no place that mention on injecting resourcebundle to a tablemodel

Thanks everyone! Please notify me should this is not the place for discussion. 
I am new. Thanks!

Original issue reported on code.google.com by Inventor...@gmail.com on 12 May 2011 at 4:22

GoogleCodeExporter commented 9 years ago

Did you set up your jmesaMessagesLocation in the web.xml?

http://code.google.com/p/jmesa/wiki/Messages

Original comment by jeff.johnston.mn@gmail.com on 12 May 2011 at 7:00

GoogleCodeExporter commented 9 years ago
Yeah, I did followed this guide, and i pointed it to the properties file
What I did, as follows:
<context-param>
  <param-name>jmesaMessagesLocation</param-name>
  <param-value>MyResourceBundle</param-value>
</context-param>

and my directory
-WEB-INF/
|-classes/
 |-MyResourceBundle.properties
 |-MyResourceBundle_en.properties
 |-MyResourceBundle_ms.properties

So the properties file MyResourceBundle.properties and its alliances is at 
WEB-INF/Classes/

However, in the MyResourceBundle.properties, I only defined key-value pair for 
my project-specific wordings. The ones from jmesa is not included. Is this 
another concern?

Is this the correct configuration?

Thanks in advance!

Original comment by Inventor...@gmail.com on 13 May 2011 at 1:32

GoogleCodeExporter commented 9 years ago
That is the correct configuration...do you get any errors? The only thing that 
I see that I did not expect was having a MyResourceBundle.properties file. But 
it should still work.

If you have logging turned on you should see an error message saying that it 
cannot find the resource bundle.

Also, make sure that your IDE is not removing these files. Typically you would 
put these files in your source directory and when you compile they get placed 
in with your classes.

Are you using the tag library or API?  What version of JMesa are you on? Once I 
know that I can show you how to debug this. We will get this!

Original comment by jeff.johnston.mn@gmail.com on 13 May 2011 at 6:30

GoogleCodeExporter commented 9 years ago
Nope, I did not get any errors. I am using log4j, and I had included the 
required libraries for it, as according to 
http://code.google.com/p/jmesa/wiki/SLF4J

I had also double checked the properties file in the server, and am sure that 
it has not been removed by the IDE.

I am using jmesa 3.0.3 though... I am planning to switch to the use of taglib 
in future, but for now, it will be API due to shortage of time :|

I am sure that this should work, an I am just missing somewhere.. Thanks for 
the advice in advance! :)

BR/Nic :)

Original comment by Inventor...@gmail.com on 14 May 2011 at 12:25

GoogleCodeExporter commented 9 years ago
At this point the easiest way to debug this would be to just copy the 
ResourceBundleMessages.java into your project, fix up the package declaration, 
and then run it locally. You can inject it into your TableModel with the 
tableModel.setMessages() method.

http://code.google.com/p/jmesa/source/browse/trunk/jmesa/src/org/jmesa/core/mess
age/ResourceBundleMessages.java

I will be curious to see what you find...the messages has been working really 
well overall.

Original comment by jeff.johnston.mn@gmail.com on 15 May 2011 at 8:04

GoogleCodeExporter commented 9 years ago
Sorry for the late reply. Had been on leave few days ago.

Alright, I will try that in my next step, and let you know the result! :)

Thanks!! 

BR/Nic :)

Original comment by Inventor...@gmail.com on 19 May 2011 at 2:30

GoogleCodeExporter commented 9 years ago
I have the same issue, I have copied the ResourceBundleMessages.java in my 
project, and I have instanciated a WebContext with the request:

HttpServletRequestWebContext WebContext = new 
HttpServletRequestWebContext(request);

after the webContext is used in:

ResourceBundleMessages kk = new ResourceBundleMessages("", WebContext);

and the last thing is:

System.out.println(kk.getMessage("html.statusbar.resultsFound"));

The courious thing is that the request is in English Locale and the message 
appear in spanish, debugging I can see that the propertyResourceBundle is 
caching:

CacheKey[org/jmesa/core/message/resource/jmesaResourceBundle, lc=es_ES, 
ldr=WebappClassLoader

and it not take my new locale

Original comment by Elias.Ma...@gmail.com on 11 Jul 2012 at 11:39