/*
 * LocaleAdapter.java
 *
 * Created on March 27, 2006, 8:19 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package it.businesslogic.ireport.util;

import java.util.Locale;

/**
 *
 * @author gtoffoli
 */
/**
         * A simple class to enable locales to be placed in a combo box.
         *
         */
public class LocaleAdapter
{
    Locale l;
    public LocaleAdapter( Locale locale )
    {
        l = locale;
    }

    public Locale getLocale()
    {
        return l;
    }

    // ==> Modified by RL, June 3, 2005, introducing getVariant and Language Papiamentu
    // Getdisplayname is now used to display the name according to the Locale.
    // Possibly in Chinese language parts are combined differently.
    public String toString()
    {
        if ( l.getLanguage().equals("") )
        {
            return " - iReport - " ;
        }
        else if ( l.getLanguage().equals("pap") )
        {
            // Work aournd, as long as LocaleWrapper not active yet.
            // TODO: Get LocaleWrapper active
            String s;
            s= "Papiamentu, " + "(" + l.getCountry() ;

            if (l.getVariant().length() > 0 )
            {
                s = s + ", " + l.getVariant() + ")";
            }
            else
            {
                s = s + ")" ;
            }

            return s;
        }
        else
        {
            return l.getDisplayName();
        }
    }
    // <= End Modification RL, June 3, 2005

    /*
    public String toString()
    {
        if( l.getCountry()==null || l.getCountry().length()==0 )
        {
            return l.getDisplayLanguage();
        }
        else
        {
            return l.getDisplayLanguage() + " - " + l.getDisplayCountry();
        }
    }
     */

}
