Gets the current language, guessed from the system.

@return The locale in use.
332024
protected static String getLang() {
        Locale locale = Locale.getDefault();

        if (null == locale)
            return DEFAULT_LANGUAGE_CODE;

        String language = locale.getLanguage();
        String country = locale.getCountry();
        String localeString = String.format("%s_%s",
                language != null ? language.toLowerCase(Locale.ENGLISH) : "",
                country != null ? country.toUpperCase(Locale.ENGLISH) : "");

        // 1. if no language is specified, return the default language
        if (null == language)
            return DEFAULT_LANGUAGE_CODE;

        // 2. try to match the language or the entire locale string among the
        // list of available language codes
        String matchedLanguageCode = null;
        for (String languageCode : VALID_LANGUAGE_CODES) {
            if (languageCode.equals(localeString)) {
                // return here as this is the most precise match we can get
                return localeString;
            }

            if (languageCode.equals(language)) {
                // set the matched language code, and continue iterating as we
                // may match the localeString in a later iteration.
                matchedLanguageCode = language;
            }
        }

        if (null != matchedLanguageCode)
            return matchedLanguageCode;

        return DEFAULT_LANGUAGE_CODE;
    }
534920
public function getLanguage()
    {
        if ($this->sessionManager) {
            $this->sessionManager->start();
        }
        if (!isset($_SESSION['_fine_I18n_language'])){
            return null;
        }
        return $_SESSION['_fine_I18n_language'];
    }
700832
public java.lang.String getLang() {
        return (java.lang.String) getStateHelper().eval(PropertyKeys.lang);

    }
37259
public function getIntegrationLanguage() {
        // Get and format the user language
        $userLanguage = $this->localeResolver->getLocale();
        $userLanguage = strtoupper(str_replace('_', '-', $userLanguage));

        // Get and format the supported languages
        $supportedLanguages = [];
        foreach (self::getSupportedLanguages() as $arr) {
            $supportedLanguages[] = $arr['value'];
        }

        // Get the fallback language
        $fallbackLanguage = $this->getValue(
            self::KEY_FALLBACK_LANGUAGE,
            $this->storeManager->getStore()
        );

        // Compare user language with supported
        if (in_array($userLanguage, $supportedLanguages)) {
            return $userLanguage;
        }
        else {
            return ($fallbackLanguage) ? $fallbackLanguage : 'EN-EN';
        }
    }
224387
public List<ULocale> getLocales() {
        List<ULocale> result;
        if (locales == null) {
            result = guessLocales();
        } else {
            result = new ArrayList<ULocale>();
            result.addAll(locales);
        }
        return result;
    }
452565
@Nullable
  public Language getLanguage() {
    XComponent xComponent = OfficeTools.getCurrentComponent(xContext);
    Locale charLocale;
    XPropertySet xCursorProps;
    try {
      XModel model = UnoRuntime.queryInterface(XModel.class, xComponent);
      if(model == null) {
        return Languages.getLanguageForShortCode("en-US");
      }
      XTextViewCursorSupplier xViewCursorSupplier =
          UnoRuntime.queryInterface(XTextViewCursorSupplier.class, model.getCurrentController());
      XTextViewCursor xCursor = xViewCursorSupplier.getViewCursor();
      if (xCursor.isCollapsed()) { // no text selection
        xCursorProps = UnoRuntime.queryInterface(XPropertySet.class, xCursor);
      } else { // text is selected, need to create another cursor
        // as multiple languages can occur here - we care only
        // about character under the cursor, which might be wrong
        // but it applies only to the checking dialog to be removed
        xCursorProps = UnoRuntime.queryInterface(
            XPropertySet.class,
            xCursor.getText().createTextCursorByRange(xCursor.getStart()));
      }

      // The CharLocale and CharLocaleComplex properties may both be set, so we still cannot know
      // whether the text is e.g. Khmer or Tamil (the only "complex text layout (CTL)" languages we support so far).
      // Thus we check the text itself:
      if (new KhmerDetector().isThisLanguage(xCursor.getText().getString())) {
        return Languages.getLanguageForShortCode("km");
      }
      if (new TamilDetector().isThisLanguage(xCursor.getText().getString())) {
        return Languages.getLanguageForShortCode("ta");
      }

      Object obj = xCursorProps.getPropertyValue("CharLocale");
      if (obj == null) {
        return Languages.getLanguageForShortCode("en-US");
      }
      charLocale = (Locale) obj;
      boolean langIsSupported = false;
      for (Language element : Languages.get()) {
        if (charLocale.Language.equalsIgnoreCase(LIBREOFFICE_SPECIAL_LANGUAGE_TAG)
            && element.getShortCodeWithCountryAndVariant().equalsIgnoreCase(charLocale.Variant)) {
          langIsSupported = true;
          break;
        }
        if (element.getShortCode().equals(charLocale.Language)) {
          langIsSupported = true;
          break;
        }
      }
      if (!langIsSupported) {
        String message = Tools.i18n(messages, "language_not_supported", charLocale.Language);
        JOptionPane.showMessageDialog(null, message);
        return null;
      }
    } catch (Throwable t) {
      MessageHandler.showError(t);
      return null;
    }
    return getLanguage(charLocale);
  }
1079314
protected function locale()
    {
        if (($member = Member::currentUser()) && $member->Locale) {
            return $member->Locale;
        }
            
        return i18n::get_locale();
    }
648260
public function getLang()
    {
        if ($this->lang === null) {
            $this->lang = $this->getPayPalConfig()->getLang();
        }

        return $this->lang;
    }
264530
public function getLanguage()
    {
        if ($this->language)
            return $this->language;
        if ($this->defaultLanguage)
            return $this->defaultLanguage;
        $prefered = $this->getPreferredLanguage();
        if (in_array($prefered, $this->availableLanguages))
            return $prefered;
        return $this->availableLanguages[0]; // if nothing works return first language from the list
    }
473604
private Locale getLocale(FacesContext context) {

        // PENDING(craigmcc) - JSTL localization context?
        Locale locale = this.locale;
        if (locale == null) {
            locale = context.getViewRoot().getLocale();
        }
        return (locale);

    }
491758
protected Locale currentLocale()
    {
        ServletRequest req = pageContext.getRequest();

        // Create a new session if necessary
        HttpSession session = pageContext.getSession();
        if ((_useLocale) && (session == null))
            session = ((HttpServletRequest) req).getSession();
        if (session == null)
            return null;

        // Return any currently set Locale in our session
        Locale current = (Locale) session.getAttribute(Globals.LOCALE_KEY);
        if (current != null)
            return current;

        // Configure a new current Locale, if requested
        if (!_useLocale)
            return (null);
        current = req.getLocale();
        if (current != null)
            session.setAttribute(Globals.LOCALE_KEY, current);
        return current;
    }
1314610
protected function getCurrentLang(){
        if(!Yii::$app->user->isGuest && !empty(Yii::$app->user->identity->lang)) {
            $lang = Yii::$app->user->identity->lang;
        } else if(Yii::$app->session->get('lang')) {
            $lang = Yii::$app->session->get('lang');
        } else {
            $lang = Yii::$app->getRequest()->getPreferredLanguage();
        }
        
        return $lang;
    }
1228785
public static function getLanguage()
    {
        if (! self::$language) {
            self::$language = Language::findByCode(App::getLocale());
        }

        if (! self::$language) {
            abort(404, 'Language could not be found');
        }

        return self::$language;
    }
739322
public function getLanguage()
    {
        if ($this->project->getEmailMultiLanguage() && $this->language) {
            return $this->language;
        } else {
            return $this->project->getLocaleDefault();
        }
    }
1024019
public String getLanguage() {
    if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_language == null)
      jcasType.jcas.throwFeatMissing("language", "de.julielab.jules.types.Header");
    return jcasType.ll_cas.ll_getStringValue(addr, ((Header_Type)jcasType).casFeatCode_language);}
153212
public function getCurrentLocale()
    {
        if (!$this->currentLocale instanceof Locale
            || $this->currentLocale->getLanguage() === 'mul') {
            return $this->defaultLocale;
        }
        return $this->currentLocale;
    }
512588
public function getLanguage()
    {
        if (!isset($this->_languageCache)) { //cache ist vorallem für bei kwfUnserialize nützlich
            $this->_languageCache = $this->getBaseProperty('language');
        }
        return $this->_languageCache;
    }