Skip to main content
deleted 20 characters in body
Source Link
johanpw
  • 13.3k
  • 6
  • 40
  • 76

down vote favorite

i tryI'm trying to get the current selected language.

Here is the part of my code:

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
    define('JPATH_BASE', dirname(__FILE__));
    require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';

$lang =& JFactory::getLanguage()->getTag();

and...

echo $lang;

allways returns en-GB.

The website has the posibilitypossibility of Ger and Eng. It also changes languages for different articles. I don't understand how I did not get the current selected language within php.

down vote favorite

i try to get the current selected language.

Here is the part of my code:

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
    define('JPATH_BASE', dirname(__FILE__));
    require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';

$lang =& JFactory::getLanguage()->getTag();

and...

echo $lang;

allways returns en-GB.

The website has the posibility of Ger and Eng. It also changes languages for different articles. I don't understand how I did not get the current selected language within php.

I'm trying to get the current selected language.

Here is the part of my code:

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
    define('JPATH_BASE', dirname(__FILE__));
    require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';

$lang =& JFactory::getLanguage()->getTag();

and...

echo $lang;

allways returns en-GB.

The website has the possibility of Ger and Eng. It also changes languages for different articles. I don't understand how I did not get the current selected language within php.

Source Link

Function getLanguage() does not return current language?

down vote favorite

i try to get the current selected language.

Here is the part of my code:

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
    define('JPATH_BASE', dirname(__FILE__));
    require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';

$lang =& JFactory::getLanguage()->getTag();

and...

echo $lang;

allways returns en-GB.

The website has the posibility of Ger and Eng. It also changes languages for different articles. I don't understand how I did not get the current selected language within php.