user specific language
Categories
Component ID
1589340
Component name
user specific language
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
git clone --recursive --branch 6.x-1.0 lalit774@git.drupal.org:sandbox/lalit774/1589340.git user_specific_language
cd user_specific_language
This module provides a user specific language functionality. There are two checkboxes on settings page in admin panel
- show language option at time of registration
you can choose one language at time of registration or when you modify profile.
- show language option at time of login
you can choose one language at time of login. This will update in your profile at time of successful login.
Add following code in settings.php
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
global $user;
if (function_exists('language_url_rewrite')) {
if (!user_access('access user specific language') || $user->uid==0) {
if (!empty($options['language']->prefix)) {
$options['prefix'] = $options['language']->prefix .'/';
}
}
else {
language_url_rewrite($path, $options);
if($options['language']->language == $user->language){
if (empty($options['language']->prefix)) {//
$options['prefix'] = '';
}elseif(!empty($options['language']->prefix)){
$options['prefix'] = $user->language .'/';
}
}else{
$options['language']->prefix='';
}
}
}
}
