Right Way for Localization

I use ResourceBundle and *.properties files.

Each property file matched to class.getName() and located next to *.class file.

E.g.

/com/samsol/project1/LoginPanel.class

/com/samsol/project1/LoginPanel.properties

/com/samsol/project1/LoginPanel_ru_RU.properties

1. Is this propper location for *.properties files?

2. How to localize multiline messages? How and when to use "\n", "\r\n", |\n\r" for different platforms.

3. Depended on the default font size in the system I want to display icons in menu and toolbars having suitable size. How to use scalable icons?

4. How to localize the icons? Example. For "login" button somebody like to see the lock, other the key, but some the ID (passport). (This is just example). But how to do it?

5. Is there are any method to change the localization on the fly?

[869 byte] By [SamSola] at [2007-10-3 9:22:09]
# 1

1. Whatever you decide.

2.

3. Start from [1] and see how you can manage to use SVG for this purpose. [2] can you give some additional ideas.

5.

void setLocale(Component component, Locale locale) {

component.setLocale(locale);

if (component instanceof Container) {

Container cont = (Container) component;

for (int i = 0; i < cont.getComponentCount(); i++)

setLocale(cont.getComponent(i), locale);

}

}

Before calling the method above, do

Locale.setDefault(new Locale(this.langCode, this.countryCode));

frame.applyComponentOrientation(ComponentOrientation

.getOrientation(Locale.getDefault()));

where langCode / countryCode specify the locale you wish to set and frame is your main frame (do it for all open frames with Frame.getFrames()). In addition, you'd have to update all the localized showing controls (such as buttons and so on).

4. Change the icons inside the method above.

[1] http://weblogs.java.net/blog/kirillcool/archive/2006/10/svg_and_java_ui_3.html

[2] https://flamingo.dev.java.net/docs/icons.html

kirillga at 2007-7-15 4:35:45 > top of Java-index,Desktop,Core GUI APIs...