while (st.hasMoreTokens()) {
String code = st.nextToken();
// get the locales and associated resources one by one
Locale l = new Locale(code);
CustomizedLocale.set(l);
ResourceBundle r = ResourceFinder.get(Installer.class);
// put default locale first, all other after, in order
if ((defaultLocale.getVariant().equals("") && defaultLocale.getCountry().equals("") && defaultLocale.getLanguage().equals(l.getLanguage()))
|| (defaultLocale.getVariant().equals("") && (!defaultLocale.getCountry().equals("")) && defaultLocale.getLanguage().equals(l.getLanguage()) && defaultLocale.getCountry().equals(l.getCountry()))
|| defaultLocale.equals(l)) {
locList.add(0,l);
resList.add(0,r);
} else {
locList.add(l);
resList.add(r);
}
numLocales++;
}
// reset to default locale, just in case
CustomizedLocale.set(defaultLocale);
ButtonGroup bg = new ButtonGroup();
Box vbox = Box.createVerticalBox();
vbox.add(Box.createVerticalGlue());
// Add UI elements in localisation order
for (int i=0; i<numLocales; ++i) {
final ResourceBundle res = (ResourceBundle)resList.get(i);
final int counter = i;
// first one is true as this is the default locale
ActionRadioButton arb = new ActionRadioButton(res.getString("chooseThisLanguage"),i==0) {
public void stateChanged(ChangeEvent e) {
if (isSelected()) {
Installer.resources = res;
Locale l = (Locale)locList.get(counter);
CustomizedLocale.set(l);