vertx/src/main/java/eu/internetofus/common/vertx/ServiceRequests.java
/**
   * Obtain the accepted language defined on the header.
   *
   * @param defaultLanguage   the language to return if it can not obtain the
   *                          accepted language.
   * @param request           to get the information.
   * @param poosibleLanguages the possible languages that can be used.
   *
   * @return the
   *
   * @see HttpHeaders#ACCEPT_LANGUAGE
   */
Obtain the accepted language defined on the header.
@param defaultLanguage   the language to return if it can not obtain the
accepted language.
@param request           to get the information.
@param poosibleLanguages the possible languages that can be used.

@return the


Obtain the accepted language defined on the header . @param defaultLanguage the language to return if it can not obtain the accepted language . @param request to get the information . @param poosibleLanguages the possible languages that can be used . @return the
static String acceptedLanguageIn(final ServiceRequest request, final String defaultLanguage,
      final String... poosibleLanguages) {
    try {
      final String acceptLanguages = request.getHeaders().get(HttpHeaders.ACCEPT_LANGUAGE);
      final var range = Locale.LanguageRange.parse(acceptLanguages);
      final var lang = Locale.lookupTag(range, Arrays.asList(poosibleLanguages));
      if (lang == null) {
        return defaultLanguage;
      } else {
        return lang;
      }
    } catch (final Throwable badLanguage) {
      return defaultLanguage;
    }
  }
static String acceptedLanguageIn ( final ServiceRequest request , final String defaultLanguage , final String ... poosibleLanguages ) { try { final String acceptLanguages = request . getHeaders ( ) . get ( HttpHeaders . ACCEPT_LANGUAGE ) ; final var range = Locale . LanguageRange . parse ( acceptLanguages ) ; final var lang = Locale . lookupTag ( range , Arrays . asList ( poosibleLanguages ) ) ; if ( lang == null ) { return defaultLanguage ; } else { return lang ; } } catch ( final Throwable badLanguage ) { return defaultLanguage ; } }
Obtain the accepted language defined on the header.
Obtain the accepted language defined on the header .