Link to home
Start Free TrialLog in
Avatar of JorgenAx
JorgenAx

asked on

How to internationalize default texts of a jTable

Dear Experts

I am in the process of internationalizing a Java swing application, which has worked out quite well. Now I just want to internationalize some default values of a jTable. How do I do this? I have managed to internationalize the headers of the columns, but how do I internationalize the default texts placed in the first column?

Best regards
Jorgen
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

That somewhat depends on how you're filling the table. Please tell us more
Avatar of JorgenAx
JorgenAx

ASKER

The table has 12 columns and 13 rows. The first column contains the name of an economic parameter, which is filled in with default values from the Swing user interface through "Properties|Model|Default values". The values of the cells of this first column are for instance "One ton of mango (Price to grower)", "Monthly lorry driver salary", etc. - i.e. the values are text strings. These strings should be internationalized to be shown in French  and in Portuguese. The remaining 12 columns are West African countries which are filled in with doubles.
That could be handled with standard i18n techniques
https://docs.oracle.com/javase/tutorial/i18n/index.html
Thank you for this link.
However, the problem was how to do it when I had made the internationalization by aid of the menu "Tools | Internationalization". The solution was to get hold of the strings to insert into the table by aid of "Tools | Internationalization | Insert internationalized string". I have not defined the appropriate strings in the Bundle.properties file.

Best regards
Jorgen
Well of course the default locale can be used. If you want the user to be able to select something other than the default, you could do something like iterate your installed bundles (properties files) to see what locales you are supporting and then include those as menu possibilities. There could be a best-practice methodology but i don't know it.
ASKER CERTIFIED SOLUTION
Avatar of JorgenAx
JorgenAx

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
?