<?php
namespace DataContainers;

class LanguagePack
{
		private static $languagePack;

		private static function load()
		{
			global $db;
			$dbConfigCapi = \configLoader::loadConfig('capi');
			$sql = "SELECT  translate_key, translate_text
							FROM  ".DB_WARPIT_MAIN."._languagePack
								WHERE id_programme = 2 AND id_language = ".$dbConfigCapi['default-language']." AND sub_page = 'capi'";
				$res = $db->SQLexecute($sql);
				while ($zad = $db->fetchAssoc($res)) self::$languagePack[$zad['translate_key']] = $zad['translate_text'];

		}

		public static function getTranslation($key = null)
		{
				if(!self::$languagePack) self::load();

        if(is_null($key)) return self::$languagePack;

				return self::$languagePack[$key];
		}
}

 ?>
