public function available($key = 'default')
	{
		static $languages;

		if (empty($languages))
		{
			// Installation uses available languages
			if (\App::get('client')->id == 2)
			{
				$languages[$key] = array();
				$knownLangs = self::getKnownLanguages(PATH_APP . DS . 'bootstrap' . DS . $this->client);
				foreach ($knownLangs as $metadata)
				{
					// Take off 3 letters iso code languages as they can't match browsers' languages and default them to en
					$languages[$key][] = new Object(array('lang_code' => $metadata['tag']));
				}
			}
			else
			{
				$cache = \App::get('cache.store');
				if (!$languages = $cache->get('com_languages.languages'))
				{
					$db = \App::get('db');
					$query = $db->getQuery()
						->select('*')
						->from('#__languages')
						->whereEquals('published', 1)
						->order('ordering', 'asc');
					$db->setQuery($query->toString());

					$languages['default']   = $db->loadObjectList();
					$languages['sef']       = array();
					$languages['lang_code'] = array();

					if (isset($languages['default'][0]))
					{
						foreach ($languages['default'] as $lang)
						{
							$languages['sef'][$lang->sef] = $lang;
							$languages['lang_code'][$lang->lang_code] = $lang;
						}
					}

					$cache->put('com_languages.languages', $languages, \App::get('config')->get('cachetime', 15));
				}
			}
		}

		return $languages[$key];
	}
public function available($key = 'default')
	{
		static $languages;

		if (empty($languages))
		{
			// Installation uses available languages
			if (\App::get('client')->id == 2)
			{
				$languages[$key] = array();
				$knownLangs = self::getKnownLanguages(PATH_APP . DS . 'bootstrap' . DS . $this->client);
				foreach ($knownLangs as $metadata)
				{
					// Take off 3 letters iso code languages as they can't match browsers' languages and default them to en
					$languages[$key][] = new Object(array('lang_code' => $metadata['tag']));
				}
			}
			else
			{
				$cache = \App::get('cache.store');
				if (!$languages = $cache->get('com_languages.languages'))
				{
					$db = \App::get('db');
					$query = $db->getQuery()
						->select('*')
						->from('#__languages')
						->whereEquals('published', 1)
						->order('ordering', 'asc');
					$db->setQuery($query->toString());

					$languages['default']   = $db->loadObjectList();
					$languages['sef']       = array();
					$languages['lang_code'] = array();

					if (isset($languages['default'][0]))
					{
						foreach ($languages['default'] as $lang)
						{
							$languages['sef'][$lang->sef] = $lang;
							$languages['lang_code'][$lang->lang_code] = $lang;
						}
					}

					$cache->put('com_languages.languages', $languages, \App::get('config')->get('cachetime', 15));
				}
			}
		}

		return $languages[$key];
	}
public function available ( $ key = 'default' ) { static $ languages ; if ( empty ( $ languages ) ) { // Installation uses available languages if ( \ App :: get ( 'client' ) -> id == 2 ) { $ languages [ $ key ] = array ( ) ; $ knownLangs = self :: getKnownLanguages ( PATH_APP . DS . 'bootstrap' . DS . $ this -> client ) ; foreach ( $ knownLangs as $ metadata ) { // Take off 3 letters iso code languages as they can't match browsers' languages and default them to en $ languages [ $ key ] [ ] = new Object ( array ( 'lang_code' => $ metadata [ 'tag' ] ) ) ; } } else { $ cache = \ App :: get ( 'cache.store' ) ; if ( ! $ languages = $ cache -> get ( 'com_languages.languages' ) ) { $ db = \ App :: get ( 'db' ) ; $ query = $ db -> getQuery ( ) -> select ( '*' ) -> from ( '#__languages' ) -> whereEquals ( 'published' , 1 ) -> order ( 'ordering' , 'asc' ) ; $ db -> setQuery ( $ query -> toString ( ) ) ; $ languages [ 'default' ] = $ db -> loadObjectList ( ) ; $ languages [ 'sef' ] = array ( ) ; $ languages [ 'lang_code' ] = array ( ) ; if ( isset ( $ languages [ 'default' ] [ 0 ] ) ) { foreach ( $ languages [ 'default' ] as $ lang ) { $ languages [ 'sef' ] [ $ lang -> sef ] = $ lang ; $ languages [ 'lang_code' ] [ $ lang -> lang_code ] = $ lang ; } } $ cache -> put ( 'com_languages.languages' , $ languages , \ App :: get ( 'config' ) -> get ( 'cachetime' , 15 ) ) ; } } } return $ languages [ $ key ] ; }
Get available languages

@param   string  $key  Array key
@return  array   An array of published languages
Get available languages