Ignore:
Timestamp:
2015-07-22T20:27:19+12:00 (9 years ago)
Author:
ak19
Message:

Installer language selection now uses a dropdown in place of radio buttons to accomodate additional language translations submitted for the gsinstaller module. To get the dropdown <large-select> to work like the radio buttons <select>, Dr Bainbridge figured out that Oran had made some code changes to <select> in AntInstaller's LoadConfigFilter.java. Added the same change in for the <large-select> and then needed to port Oran's additional changes to SelectInput.java into LargeSelectInput.java (didn't put the changes in the superclass InputField.java since a lot of other AntInstaller classes inherit from that).

Location:
main/trunk/release-kits/shared/core/ant-installer/src/org/tp23/antinstaller
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/release-kits/shared/core/ant-installer/src/org/tp23/antinstaller/input/LargeSelectInput.java

    r17514 r30052  
    1919import java.util.MissingResourceException;
    2020import java.util.ResourceBundle;
     21import java.util.Locale;
    2122
    2223import org.tp23.antinstaller.InstallerContext;
     
    4142    private LargeSelectInput.Option[] options;
    4243
     44    private boolean useAsLocale = false;
     45   
    4346    public LargeSelectInput() {
    4447    }
    4548
    46 
     49    public void setUseAsLocale(boolean ual) {
     50        this.useAsLocale = ual;
     51    }
     52   
    4753    public LargeSelectInput.Option[] getOptions() {
    4854        return options;
     
    6672        public String getText() {
    6773            if( org.tp23.antinstaller.Installer.langPack != null ) {
    68                 return org.tp23.antinstaller.Installer.langPack.getString(getProperty() + "." + idx +".displayText");
     74                return org.tp23.antinstaller.Installer.langPack.getString(getProperty() + "." + idx +".displayText");               
    6975            }
    7076            return text;
     
    7278    }
    7379   
    74     public void setValue(String dir){
    75         setInputResult(dir);
     80    public void setValue(String value){ //param name used to be "dir" not "value", but bringing in line with SelectInput.java
     81        setInputResult(value);
     82        if ( useAsLocale ) {
     83            //expect something like 'en' or or something like 'en_US'
     84            Locale newLocale = null;
     85            if ( value.length() == 2 ) {
     86                newLocale = new Locale(value);
     87                Locale.setDefault( newLocale );
     88            } else if ( value.length() == 5 ) {
     89                newLocale = new Locale(value.substring(0,2), value.substring(3,5));
     90                Locale.setDefault( newLocale );
     91            } //else { you're out of luck }
     92            org.tp23.antinstaller.Installer.langPack = ResourceBundle.getBundle("resources.LanguagePack", newLocale );
     93        }
    7694    }
    7795    /**
  • main/trunk/release-kits/shared/core/ant-installer/src/org/tp23/antinstaller/input/SelectInput.java

    r17517 r30052  
    7474                    String r = org.tp23.antinstaller.Installer.langPack.getString( getProperty() + "." + idx + ".displayText" );
    7575                    return r;
    76                 } catch ( java.util.MissingResourceException mre ) {}
     76                } catch ( java.util.MissingResourceException mre ) {} // restoring original comment: ignore, signifies no language packs installed
    7777            }
    7878            return text;
  • main/trunk/release-kits/shared/core/ant-installer/src/org/tp23/antinstaller/runtime/exe/LoadConfigFilter.java

    r17514 r30052  
    345345
    346346            String s = field.getAttribute("useAsLocale");
    347             if ( s != null || !s.equals("") ) {
     347            if ( s != null && s.equals("true") ) {
    348348                sInput.setUseAsLocale(true);
    349349            }
     
    383383            sInput.setOptions(optionArr);
    384384
     385            String s = field.getAttribute("useAsLocale");
     386            if ( s != null && s.equals("true") ) {
     387                sInput.setUseAsLocale(true);
     388            }
    385389            return sInput;
    386390        }
Note: See TracChangeset for help on using the changeset viewer.