*
* @return an <code>Enumeration</code> of preferred
* <code>Locale</code> objects for the client
*/
public Enumeration getLocales() {
HttpAcceptLanguage languages[] = request.getAcceptLanguage();
if (languages == null) {
Vector def = new Vector();
def.addElement(Locale.getDefault());
return def.elements();
}
//LinkedList is better, but we must be JDK1.1 compliant
Vector locales = new Vector();
for (int i = 0 ; i < languages.length ; i++) {
HttpAcceptLanguage language = languages[i];
double quality = language.getQuality();
String lang = language.getLanguage();
String country = "";
int idx = lang.indexOf('-');
if (idx > -1) {
country = lang.substring(idx + 1).trim();
lang = lang.substring(0, idx).trim();