<?php
/*

# CloudFW Translate Functions
# Author: Orkun Gürsel - me@orkungursel.com - support@cloudfw.net

*/

/*
 *	Make URLs compatible /w MultiLanguage
 *
 *	@ since 1.0
**/
function __url($url){
	if ( function_exists('qtrans_convertURL') )
		return qtrans_convertURL($url);
	else
		return $url;
}

/*
 *	Translate Function
 *
 *	@ since 1.0
**/
function __translate($data, $context = NULL, $name = NULL){
	if ( function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage') )
		return qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($data);
	elseif ( function_exists('icl_t') && $context && $name )
		return icl_t($context, $name, $data);
	else
		return $data;
}

/*
 *	Make URLs compatible /w MultiLanguage
 *
 *	@ since 1.0
**/

function __home_url($url = NULL){
	return __url(home_url($url));
}

/*
 *	Get Current Language Key
 *
 *	@ since 1.0
**/
function get_current_language(){
	global $q_config;
	return  $q_config["language"];
}