FileDocCategorySizeDatePackage
ConfigSectionInterfaceLanguage.javaAPI DocAzureus 3.0.3.44381Tue Jun 05 00:22:44 BST 2007org.gudy.azureus2.ui.swt.views.configsections

ConfigSectionInterfaceLanguage

public class ConfigSectionInterfaceLanguage extends Object implements org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection

Fields Summary
Constructors Summary
Methods Summary
public org.eclipse.swt.widgets.CompositeconfigSectionCreate(org.eclipse.swt.widgets.Composite parent)

    Label label;
    GridLayout layout;
    GridData gridData;
    Composite cMain = new Composite( parent,  SWT.NULL );
    cMain.setLayoutData( new GridData( GridData.FILL_BOTH ) );
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cMain.setLayout( layout );
    
    label = new Label( cMain, SWT.NULL );
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    label.setLayoutData(gridData);
    Messages.setLanguageText( label, "MainWindow.menu.language" );  //old name path, but already translated

    Locale[] locales = MessageText.getLocales();
    
    String[] drop_labels = new String[ locales.length ];
    String[] drop_values = new String[ locales.length ];
    int iUsingLocale = -1;
    for( int i=0; i < locales.length; i++ ) {
      Locale locale = locales[ i ];
      String sName = locale.getDisplayName(locale);
      String sName2 = locale.getDisplayName();
      if (!sName.equals(sName2)) {
      	sName += " - " + sName2;
      }
      drop_labels[ i ] = sName + " - " + locale;
      drop_values[ i ] = locale.toString();
      if (MessageText.isCurrentLocale(locale))
      	iUsingLocale = i;
    }
    
    StringListParameter locale_param = new StringListParameter(cMain, "locale",
				drop_labels, drop_values, false);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.minimumHeight = 50;
    locale_param.setLayoutData(gridData);
    // There may be no "locale" setting stored in config, so set it to
    // what we are using now.  Don't automatically write it to config, because
    // the user may switch languages (or a new language file may become avail
    // in the future that matches closer to their locale)
    if (iUsingLocale >= 0)
    	((List)locale_param.getControl()).select(iUsingLocale);
    
    locale_param.addChangeListener( new ParameterChangeAdapter() {
      public void parameterChanged( Parameter p, boolean caused_internally ) {
				MessageText.loadBundle();
        DisplayFormatters.setUnits();
        DisplayFormatters.loadMessages();
        UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
        if (uiFunctions != null) {
        	uiFunctions.refreshLanguage();    
        }
      }
    });
    
    return cMain;
  
public voidconfigSectionDelete()

  
public java.lang.StringconfigSectionGetName()

    return "language";
  
public java.lang.StringconfigSectionGetParentSection()

    return ConfigSection.SECTION_INTERFACE;
  
public voidconfigSectionSave()