function xapp_setup_language_wordpress($lang = null)
{
    if (!function_exists('XAPP_TEXT')) {
        $default_locale = 'en-GB';
        $wordpress_locale = get_locale();
        //en_US
        $wordpress_locale = str_replace('_', '-', $wordpress_locale);
        $locale_file_prefix = 'com_xappcommander';
        $localPath = XAPP_BASEDIR . DIRECTORY_SEPARATOR . 'commander' . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
        $testPath = $localPath . $wordpress_locale . '.' . $locale_file_prefix . '.ini';
        if (file_exists($testPath)) {
        } else {
            $testPath = $localPath . $default_locale . '.' . $locale_file_prefix . '.ini';
        }
        if (!file_exists($testPath)) {
        } else {
            require_once XAPP_BASEDIR . '/Config/Config.php';
            require_once XAPP_BASEDIR . '/Config/Ini.php';
            $config = new Xapp_Config_Ini($testPath);
            if ($config) {
                XApp_Service_Entry_Utils::$languageClass = $config;
            }
        }
        function XAPP_TEXT($string, $lang = null, $component = null, $arguments = null)
        {
            $result = '' . $string;
            if (!XApp_Service_Entry_Utils::$languageClass) {
                return $string;
            } else {
                $confValue = XApp_Service_Entry_Utils::$languageClass->get($string);
                if ($confValue) {
                    return $confValue;
                }
            }
            return $string;
        }
        if (!function_exists('XAPP_TEXT_FORMATTED')) {
            function XAPP_TEXT_FORMATTED($string, $args = array())
            {
                $toFormat = XAPP_TEXT($string, null, null, null);
                return vsprintf($toFormat, $args);
            }
        }
    }
}