controllers/locales/index.php
public function getLanguagesInstance($instance = null)
	{
		$languages = false;
		if ($instance != '')
		{
			$languages = $this->scanFiles(ROOT_PATH . '/instances/' . $instance . '/locale', false);
			if (is_array($languages) && count($languages) > 0)
			{
				$locales = array();
				foreach ($languages as $index => $language)
				{
					require_once ROOT_PATH . '/instances/' . $instance . '/locale/' . $language["id"];
					if (isset($translations))
					{
						$locales[$language["id"]]["translations"] = $translations;
						unset($translations);
					}
					else
					{
						$locales[$language["id"]]["translations"] = null;
					}
				}

				$translation_keys = $this->getUniqueTranslationKeys($locales);
				if (is_array($translation_keys)) natcasesort($translation_keys);
				$this->assign("translation_keys", $translation_keys);
				if (is_array($translation_keys))
				{
					$total_keys = count($translation_keys);
					foreach($locales as $language => $value)
					{
						$locales[$language]["total_keys"]				= $total_keys;
						$locales[$language]["translated_keys"]			= count($locales[$language]["translations"]);
						$locales[$language]["translated_percentage"]	= number_format(($locales[$language]["translated_keys"] / $locales[$language]["total_keys"]) * 100, 2, ",", ".")."%";
					}

				}
			}
		}
		return($locales);
	}
public function getLanguagesInstance($instance = null)
	{
		$languages = false;
		if ($instance != '')
		{
			$languages = $this->scanFiles(ROOT_PATH . '/instances/' . $instance . '/locale', false);
			if (is_array($languages) && count($languages) > 0)
			{
				$locales = array();
				foreach ($languages as $index => $language)
				{
					require_once ROOT_PATH . '/instances/' . $instance . '/locale/' . $language["id"];
					if (isset($translations))
					{
						$locales[$language["id"]]["translations"] = $translations;
						unset($translations);
					}
					else
					{
						$locales[$language["id"]]["translations"] = null;
					}
				}

				$translation_keys = $this->getUniqueTranslationKeys($locales);
				if (is_array($translation_keys)) natcasesort($translation_keys);
				$this->assign("translation_keys", $translation_keys);
				if (is_array($translation_keys))
				{
					$total_keys = count($translation_keys);
					foreach($locales as $language => $value)
					{
						$locales[$language]["total_keys"]				= $total_keys;
						$locales[$language]["translated_keys"]			= count($locales[$language]["translations"]);
						$locales[$language]["translated_percentage"]	= number_format(($locales[$language]["translated_keys"] / $locales[$language]["total_keys"]) * 100, 2, ",", ".")."%";
					}

				}
			}
		}
		return($locales);
	}
public function getLanguagesInstance ( $ instance = null ) { $ languages = false ; if ( $ instance != '' ) { $ languages = $ this -> scanFiles ( ROOT_PATH . '/instances/' . $ instance . '/locale' , false ) ; if ( is_array ( $ languages ) && count ( $ languages ) > 0 ) { $ locales = array ( ) ; foreach ( $ languages as $ index => $ language ) { require_once ROOT_PATH . '/instances/' . $ instance . '/locale/' . $ language [ "id" ] ; if ( isset ( $ translations ) ) { $ locales [ $ language [ "id" ] ] [ "translations" ] = $ translations ; unset ( $ translations ) ; } else { $ locales [ $ language [ "id" ] ] [ "translations" ] = null ; } } $ translation_keys = $ this -> getUniqueTranslationKeys ( $ locales ) ; if ( is_array ( $ translation_keys ) ) natcasesort ( $ translation_keys ) ; $ this -> assign ( "translation_keys" , $ translation_keys ) ; if ( is_array ( $ translation_keys ) ) { $ total_keys = count ( $ translation_keys ) ; foreach ( $ locales as $ language => $ value ) { $ locales [ $ language ] [ "total_keys" ] = $ total_keys ; $ locales [ $ language ] [ "translated_keys" ] = count ( $ locales [ $ language ] [ "translations" ] ) ; $ locales [ $ language ] [ "translated_percentage" ] = number_format ( ( $ locales [ $ language ] [ "translated_keys" ] / $ locales [ $ language ] [ "total_keys" ] ) * 100 , 2 , "," , "." ) . "%" ; } } } } return ( $ locales ) ; }
Build a list with all of the languages of an instance
@return array
Build a list with all of the languages of an instance