I've designed a custom 'Account Creation' script to ensure that customers can login from the phone application.

Things I want would be to have the ability to alter the reactions in the server based on their locale. Then when I request a webpage I'd add lang=en or lang=zh etc.

This works

http://mysite.com/phone/my_custom_account_creation.php?lang=en

Response:

<resource classification="error" code="Error (Code: 500)"> 
<message>Please enter your name:</message> 
</resource>

This doesn't work:

http://mysite.com/phone/my_custom_account_creation.php?lang=zh

Response:

<resource classification="error" code="Error (Code: 500)"> 
<message>Please enter your name:</message> 
</resource>

Basically get into Joomla at set the default language to chinese, it really works.

<resource classification="error" code="Error (Code: 500)"> 
<message>请输入您的姓名。</message> 
</resource>

but

http://mysite.com/phone/my_custom_account_creation.php?lang=en doesn't work, rather it is constantly on the show china version.

What might I have the ability to do here?

this is actually the code I'm using for registration:

<?php
header ("content-type: text/xml");

/*
 * Register a user from a phone interface using JAVA
 */

define( '_JEXEC', 1 ); 
//define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the root
define('JPATH_BASE', dirname(__FILE__)."/../.." );//this is when we are in the root
define( 'DS', DIRECTORY_SEPARATOR );  

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

//My functions
require_once('../shared_functions.php');

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

//Don't use tokens for registration
//JRequest::checkToken() or jexit( 'Invalid Token' );

$user         = clone(JFactory::getUser());
$pathway          = & $mainframe->getPathway();
$config       = & JFactory::getConfig();
$authorize        = & JFactory::getACL();
$document       = & JFactory::getDocument();

$usersConfig = &JComponentHelper::getParams( 'com_users' );
if ($usersConfig->get('allowUserRegistration') == '0')
    {
        xmlError("Access Forbidden (Code 403)","Registration has been temporarily disabled");
        //JError::raiseError( 403, JText::_( 'Access Forbidden' ));
        return;
    }

$newUsertype = $usersConfig->get( 'new_usertype' );
if (!$newUsertype)
    {
        $newUsertype = 'Registered';
    }

if (!$user->bind( JRequest::get('post'), 'usertype' ))
    {
        xmlError("Error (Code: 500)",$user->getError());
        return;
        //JError::raiseError( 500, $user->getError());
    }

$user->set('id', 0);
$user->set('usertype', '');
$user->set('gid', $authorize->get_group_id( '', $newUsertype, 'ARO' ));

$date =& JFactory::getDate();
$user->set('registerDate', $date->toMySQL());


$useractivation = $usersConfig->get( 'useractivation' );
if ($useractivation == '1')
    {
        jimport('joomla.user.helper');
        $user->set('activation', md5( JUserHelper::genRandomPassword()) );
        $user->set('block', '1');
    }

if (!$user->save()) { // if the user is NOT saved...
    xmlError("Error (Code: 500)",$user->getError());
    //JError::raiseWarning('', JText::_( $user->getError())); // ...raise an Warning
    //return false; // if you're in a method/function return false
}


xmlMessage("ok",CODE_ACCOUNT_CREATED,"Success");

?>

I first got it working

$lang =& JFactory::getLanguage();
$lang->setLanguage( $_GET['lang'] );
$lang->load();

I discovered the language needed to maintain full format though en-GB or zh-CN