.. versionadded:: 1.0

    Get the currently active languages of an parent object.

    Note: if there is no content at the page, the language won't be returned.
496339
def get_parent_active_language_choices(parent_object, exclude_current=False):
    
    assert parent_object is not None, "Missing parent_object!"

    from .db import ContentItem
    qs = ContentItem.objects \
        .parent(parent_object, limit_parent_language=False) \
        .values_list('language_code', flat=True).distinct()

    languages = set(qs)

    if exclude_current:
        parent_lang = get_parent_language_code(parent_object)
        languages.discard(parent_lang)

    if parler_appsettings.PARLER_LANGUAGES and not parler_appsettings.PARLER_SHOW_EXCLUDED_LANGUAGE_TABS:
        site_id = get_parent_site_id(parent_object)
        try:
            lang_dict = parler_appsettings.PARLER_LANGUAGES[site_id]
        except KeyError:
            lang_dict = ()

        allowed_languages = set(item['code'] for item in lang_dict)
        languages &= allowed_languages

    # No multithreading issue here, object is instantiated for this user only.
    choices = [(lang, str(get_language_title(lang))) for lang in languages if lang]
    choices.sort(key=lambda tup: tup[1])
    return choices
1221638
def active?(current_page)
      if current_page
        if id == current_page.id
          true
        elsif parent_of?(current_page)
          true
        else
          false
        end
      end
    end
771876
def get_parent_tags(self, rev=None):
		
		try:
			parent_rev = one(self.get_parent_revs(rev))
		except Exception:
			return None
		return self.get_tags(parent_rev)
771428
def get_languages(self, abbreviations=False):
        
        data = []

        for lang in self.user_data.languages:
            if lang['learning']:
                if abbreviations:
                    data.append(lang['language'])
                else:
                    data.append(lang['language_string'])

        return data
725053
public function getActiveLocales()
	{
		$activeLocales = array();
		
		$locales = $this->getLocales();

		foreach ($locales as $id => $locale) {
			if ($locale->isActive()) {
				$activeLocales[$id] = $locale;
			}
		}

		return $activeLocales;
	}
1048486
public function getLanguages()
    {
        if ($this->_languages === null) {
            $this->_languages = Lang::getQuery();
        }
    
        return $this->_languages;
    }
1338897
def all_languages_column(self, object):
        
        all_languages = [code for code, __ in settings.LANGUAGES]
        return mark_safe(
            self._languages_column(
                object, all_languages, span_classes='all-languages'
            )
        )
1055880
def getLanguage(self, body, ):
        

        resourcePath = '/text/detect_language'
        method = 'POST'

        queryParams = {}
        headerParams = {'Accept': 'Application/json', 'Content-Type': 'application/json'}
        postData = None

        postData = body
        response = self.apiClient._callAPI(resourcePath, method, queryParams, postData, headerParams)
        return language_rest.LanguageRest(**response.json())
476357
def get_language():
    
    lang = _get_language()
    if lang is None:  # Django >= 1.8
        return settings.DEFAULT_LANGUAGE
    if lang not in settings.AVAILABLE_LANGUAGES and '-' in lang:
        lang = lang.split('-')[0]
    if lang in settings.AVAILABLE_LANGUAGES:
        return lang
    return settings.DEFAULT_LANGUAGE
1003564
function getCurrentActiveType (version) {
  let typelist = TypeList
  for (let i = 0; i < typelist.length; i++) {
    if (semver[typelist[i]](version)) {
      return typelist[i]
    }
  }
}
968180
def get_fallback_languages(self, language_code=None, site_id=None):
        
        choices = self.get_active_choices(language_code, site_id=site_id)
        return choices[1:]
1144377
def content_by_language(self, language):
        
        placeholders = get_placeholders(self.get_template())
        content_list = []
        for ctype in [p.name for p in placeholders]:
            try:
                content = Content.objects.get_content_object(self,
                    language, ctype)
                content_list.append(content)
            except Content.DoesNotExist:
                pass
        return content_list
866908
public static function getCurrentLanguage(){
		if(!self::$current_language){
			$language = CSession::get(self::CURRENT_LANGUAGE);
			if(!$language){
				$language = 'en_US';
			}
			self::$current_language = $language;
		}
		return self::$current_language;
	}
1372681
def check_lato_blog_post_parent
      post_parent = LatoBlog::PostParent.find_by(id: lato_blog_post_parent_id)
      if !post_parent
        errors.add('Post parent', 'not exist for the post')
        throw :abort
        return
      end

      same_language_post = post_parent.posts.find_by(meta_language: meta_language)
      if same_language_post && same_language_post.id != id
        errors.add('Post parent', 'has another post for the same language')
        throw :abort
        return
      end
    end
1163592
public function get_current_language( $args = array() ) {

		$args = wp_parse_args(
			$args, array(
				'refresh' => false,
			)
		);

		if ( ! $args['refresh'] && ! empty( self::$current_language ) ) {
			return self::$current_language;
		}

		$this->get_current_language_data( $args );

		return self::$current_language;
	}
609042
def get_cached_translation(instance, language_code=None, related_name=None, use_fallback=False):
    
    if language_code is None:
        language_code = instance.get_current_language()

    translated_model = instance._parler_meta.get_model_by_related_name(related_name)
    values = _get_cached_values(instance, translated_model, language_code, use_fallback)
    if not values:
        return None

    try:
        translation = translated_model(**values)
    except TypeError:
        # Some model field was removed, cache entry is no longer working.
        return None

    translation._state.adding = False
    return translation
95000
def languages_column(self, obj):
        
        languages = self.get_available_languages(obj)
        return '<span class="available-languages">{0}</span>'.format(
            " ".join(languages)
        )