All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.reactive.common.util.LocaleHelper Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package org.jboss.resteasy.reactive.common.util;

import java.util.Locale;

/**
 * @author Bill Burke
 */
public class LocaleHelper {
    public static Locale extractLocale(String lang) {
        int q = lang.indexOf(';');
        if (q > -1) {
            lang = lang.substring(0, q);
        }
        return Locale.forLanguageTag(lang);
    }

    /**
     * HTTP 1.1 has different String format for language than what java.util.Locale does '-' instead of '_'
     * as a separator
     *
     * @param value locale
     * @return converted language format string
     */
    public static String toLanguageString(Locale value) {
        return value.toLanguageTag();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy