I have looked and could not find a library that would deal with problem of licalizating the swing component data.
Thus, I decided to create my own and make it public...
Only problem is that I don't really know where the language strings are contained...
If anyone would be so nice to tell me where to look in src folder, I'd be more than happy to create a library that would work something like this:
libraryClassName.JFileChooser.setJFileChooserStringValue(string);
Swing is mentioned in com/sun/java folder, and it's in javax folder too. There are many classes that include the names of swing components per component (JFileChooser.java, FileChooserUI.java, BasicFileChooserUI.java, MetalFileChooserUI.java, MultiFileChooserUI.java, FileChooserPainter.java, etc) and many more general classes that may or may not contain string vaules needed for localization.
I guess, when string values for one component are found, all the others should be in corresponding location.
So, if you help me with this, I'll make a library that will ease the sufferings of so many programmers that are trying to translate their programs...
IMPORTANT EDIT: Is the JFileChooser the only swing component that has predefined strings in it?
OK, I will try not to be lazy and help you with this one:
The file /src/javax/swing/plaf/basic/BasicFileChooserUI.java has nice method called installStrings (line 282), which contains what you are after:
protected void installStrings(JFileChooser fc) {
Locale l = fc.getLocale();
newFolderErrorText = UIManager.getString("FileChooser.newFolderErrorText",l);
newFolderErrorSeparator = UIManager.getString("FileChooser.newFolderErrorSeparator",l);
newFolderParentDoesntExistTitleText = UIManager.getString("FileChooser.newFolderParentDoesntExistTitleText", l);
newFolderParentDoesntExistText = UIManager.getString("FileChooser.newFolderParentDoesntExistText", l);
// ...
}
It seems that what you actually need to find is a call to UIManager.getString(String, Locale), which seems to contain the key you are looking for. The actual method definition might reveal even more secrets, but I am too lazy to check it out ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With