class LanguageIdentifierConverter {

    public static String toLanguageIdentifier(final Locale locale) {
        if (locale == null) {
            return null;
        }
        final StringBuilder str = new StringBuilder();
        str.append(locale.getLanguage());
        final String country = locale.getCountry();
        if (!country.isEmpty()) {
            str.append('-');
            str.append(country);
        }
        return str.toString();
    }

    private  LanguageIdentifierConverter();

}