Changeset 17514 for release-kits/shared/ant-installer/src/org/tp23/antinstaller/input/SelectInput.java
- Timestamp:
- 2008-10-10T09:05:07+13:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
release-kits/shared/ant-installer/src/org/tp23/antinstaller/input/SelectInput.java
r14982 r17514 19 19 import java.util.MissingResourceException; 20 20 import java.util.ResourceBundle; 21 21 import java.util.Locale; 22 22 import org.tp23.antinstaller.InstallerContext; 23 23 import org.tp23.antinstaller.ValidationException; 24 24 import org.tp23.antinstaller.Installer; 25 25 26 26 … … 35 35 */ 36 36 public class SelectInput 37 extends InputField {37 extends InputField { 38 38 39 // i18n support40 private static ResourceBundle langPack = null;41 39 private int optionIdx = 0; 42 static{ 43 try { 44 langPack = ResourceBundle.getBundle("resources.LanguagePack"); 45 } catch (MissingResourceException e) { 46 // ignore, signifies no lang packs installed 47 } 40 private SelectInput.Option[] options; 41 private boolean useAsLocale = false; 42 43 public SelectInput() { 48 44 } 49 45 50 private SelectInput.Option[] options; 51 52 public SelectInput() { 46 public void setUseAsLocale(boolean ual) { 47 this.useAsLocale = ual; 53 48 } 54 49 … … 75 70 } 76 71 public String getText() { 77 if( langPack != null){78 return langPack.getString(getProperty() + "." + idx +".displayText");72 if( org.tp23.antinstaller.Installer.langPack != null ){ 73 return org.tp23.antinstaller.Installer.langPack.getString(getProperty() + "." + idx +".displayText"); 79 74 } 80 75 return text; … … 84 79 public void setValue(String value){ 85 80 setInputResult(value); 81 if ( useAsLocale ) { 82 //expect something like 'en' or or something like 'en_US' 83 if ( value.length() == 2 ) { 84 Locale.setDefault( new Locale(value) ); 85 } else if ( value.length() == 5 ) { 86 Locale.setDefault( new Locale(value.substring(0,2), value.substring(3,5)) ); 87 } //else { you're out of luck } 88 org.tp23.antinstaller.Installer.langPack = ResourceBundle.getBundle("resources.LanguagePack"); 89 } 86 90 } 87 91
Note:
See TracChangeset
for help on using the changeset viewer.