@Override
  public String getLanguageId(HttpServletRequest request) {
    String languageId = ParamUtil.getString(request, "languageId");

    if (Validator.isNotNull(languageId)) {
      CompanyLocalesBag companyLocalesBag = _getCompanyLocalesBag();

      if (companyLocalesBag.containsLanguageCode(languageId)
          || companyLocalesBag.containsLanguageId(languageId)) {

        return languageId;
      }
    }

    Locale locale = PortalUtil.getLocale(request);

    return getLanguageId(locale);
  }
  @Override
  public boolean isAvailableLocale(String languageId) {
    CompanyLocalesBag companyLocalesBag = _getCompanyLocalesBag();

    return companyLocalesBag.containsLanguageId(languageId);
  }