Code example for Locale

Methods: getCountry, getLanguage, toString

0
     * @param locale The locale for which to calculate a character set 
     */ 
    public String getCharset(Locale locale) {
        // Match full language_country_variant first, then language_country,  
        // then language only 
        String charset = map.getProperty(locale.toString());
        if (charset == null) {
            charset = map.getProperty(locale.getLanguage() + "_" 
                    + locale.getCountry());
            if (charset == null) {
                charset = map.getProperty(locale.getLanguage());
            } 
        } 
        return (charset);
    } 
 
     
    /** 
     * The deployment descriptor can have a 
     * locale-encoding-mapping-list element which describes the 
     * webapp's desired mapping from locale to charset.  This method