code: public Locale getLocale() {
          UI currentUI = UI.getCurrent();
          Locale locale = currentUI == null ? null : currentUI.getLocale();
          if (locale == null) {
              locale = Locale.getDefault();
          }
          return locale;
      }
docs: Gets the locale of the current Vaadin UI. If the locale can not be determinted, the default locale
  is returned instead.
  
  @return the current locale, never {@code null}.
  @see com.vaadin.ui.UI#getLocale()
  @see java.util.Locale#getDefault()