Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-08-2005, 03:34 PM
Bellinis's Avatar
Bellinis Bellinis is offline
 
Join Date: Aug 2005
Location: Amsterdam, the Netherland
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Switching the forum language by using flags [3.5]

On my board we use two official languages. Registered users can change their preferred language through the CP and guests can use the language drop-down menu on the bottom of the page.

Since the drop-down menu isn't very guest-friendly, I would like to add two (or more) language flags somewhere on my page (probably in the menu). Does such hack already excist ? (@ vbulletin.com they told me a hack probably already excists here, but I couldn't find it :disappointed: )
Can anyone point me in the right direction?

Thanks a lot!
Reply With Quote
  #2  
Old 09-08-2005, 08:54 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can't remember seeing one.
Reply With Quote
  #3  
Old 10-01-2005, 10:05 PM
Bellinis's Avatar
Bellinis Bellinis is offline
 
Join Date: Aug 2005
Location: Amsterdam, the Netherland
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's been some time ago since I did my posting above....

I think it can't be too difficult to replace the drop-down-language-selection-box with a few country flags somewhere on the forum, only I can not do it

Anyone willing to help me out on this one ?

Thanks!
Reply With Quote
  #4  
Old 03-21-2006, 05:02 AM
derfelix derfelix is offline
 
Join Date: Nov 2001
Posts: 204
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well I was looking for the same solution...
What i did
i placed a flag on the page and

linked it with the following code:
PHP Code:
<a href="javascript:switch_lang(1);"><img src="images/flag_english.gif" border=/></a

in switch_lang(1) the 1 is your language id corresponding to the language..
you have to change it for the language corresponding to the flag !!!!!


then open forum/clientscript/vbulletin_global.js
in there find:
PHP Code:
function switch_id(selectobjtype
and ABOVE add:
PHP Code:
function switch_lang(language)
{
    var 
id language;

    if (
id == '')
    {
        return;
    }

    var 
url = new String(window.location);
    var 
fragment = new String('');

    
// get rid of fragment
    
url url.split('#');

    
// deal with the fragment first
    
if (url[1])
    {
        
fragment '#' url[1];
    }

    
// deal with the main url
    
url url[0];

    
// remove id=x& from main bit
    
if (url.indexOf('langid=') != -&& is_regexp)
    {
        
re = new RegExp("langid=\\d+&?");
        
url url.replace(re'');
    }

    
// add the ? to the url if needed
    
if (url.indexOf('?') == -1)
    {
        
url += '?';
    }
    else
    {
        
// make sure that we have a valid character to join our id bit
        
lastchar url.substr(url.length 1);
        if (
lastchar != '&' && lastchar != '?')
        {
            
url += '&';
        }
    }

    
window.location url 'langid=' id fragment;

I hope that helps

Felix
Reply With Quote
  #5  
Old 03-21-2006, 07:09 AM
Ramsesx's Avatar
Ramsesx Ramsesx is offline
 
Join Date: Aug 2005
Location: Southern Germany
Posts: 512
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@ Felix, I only made a link to http://www.mysite.de/index.php?langid=3
What is the advantage to make it with javascript?
Reply With Quote
  #6  
Old 03-21-2006, 04:24 PM
derfelix derfelix is offline
 
Join Date: Nov 2001
Posts: 204
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the advantage is.. that you stay on the page were you were..

example:
you are on https://vborg.vbsupport.ru/showthread.php?p=930702

and you have the flags in the header on every page...

you will after clickin the flag be on:
https://vborg.vbsupport.ru/showthrea...30702&langid=4

with the hard linked method you will be back on the index.php
thats the difference... but in principle both methods work

Felix
Reply With Quote
  #7  
Old 03-21-2006, 05:01 PM
Bellinis's Avatar
Bellinis Bellinis is offline
 
Join Date: Aug 2005
Location: Amsterdam, the Netherland
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you so much derfelix!
I didn't expect a reply anymore, 6 months after I asked my question... hehe

Those subscriptions do work fine
Reply With Quote
  #8  
Old 03-31-2011, 08:14 PM
Ghostt Ghostt is offline
 
Join Date: Oct 2009
Posts: 359
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can this code also be added as plugin?
seems not to work...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04104 seconds
  • Memory Usage 2,249KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete