Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Set forum-language automatic to browser-language for first-visitors Details »»
Set forum-language automatic to browser-language for first-visitors
Version: 2.00, by JoergZ JoergZ is offline
Developer Last Online: Dec 2012 Show Printable Version Email this Page

Version: 3.5.0 Rating:
Released: 09-30-2005 Last Update: 10-06-2005 Installs: 39
Uses Plugins
 
No support by the author.

Originally I have not planned to bring my Hack "Language Selection for Guests" to vB 3.5, because in 3.5 the language can be selected with the drop-down menu at the bottom.

But I was asked to make the automatic language-detection in 3.5 available. In case others are maybe interested in that too, I bring it here as new hack for vB 3.5


Short-description

This Hack detects the browser-language automatic and shows the board in the language of the user, if the user has never been at your board before or has no cookie for your board.

The automatic-detection of the browser-language was realised by WildChild


Requirements
  • vB 3.5 Gold (Tested up to 3.5.1)
  • Of course more than one installed and selectable language, otherwise this modification makes no sens
Installation-time

about 1 minutes


PLEASE CLICK THE INSTALL BUTTON IF INSTALLED!


Updates

01.10.2005 Thanks to the help of KirbyDE, now a standard-hook is used, so no code-modification is necessary

------------------------------------------------------------------------

If you want to test the hack after installing, do it like this:

- Log out of your forum. Dont klick any of the displayed links after logging out !
- Close your browser-window
- Open a new browser-window
- Set your language preferences in the browser
- Go to your forum homepage

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 10-01-2005, 04:11 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Optimization suggest: get rid of the File edit

Hook init_startup, and use $_REQUEST['langid'] instead of $vbulletin->GPC['langid'] in the Code
Reply With Quote
  #3  
Old 10-01-2005, 09:04 AM
JoergZ JoergZ is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the hint KirbyDE, but what is with $vbulletin->GPC[COOKIE_PREFIX . 'languageid'] ? How to replace that ?

Just replacing the GPC['langid'] is not working.

Jörg
Reply With Quote
  #4  
Old 10-01-2005, 10:01 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$_COOKIE[COOKIE_PREFIX . 'languageid']
Reply With Quote
  #5  
Old 10-01-2005, 10:05 AM
GrendelKhan{TSU's Avatar
GrendelKhan{TSU GrendelKhan{TSU is offline
 
Join Date: Jun 2005
Location: Boston | Seoul, S. Korea
Posts: 1,311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

question...

does the use have the option to change the language after its "autodectected"? or is it "stuck" on the one it detects? (I HATE that.)

aside: Hate when sites do that....can't change it back to english once its detected im in Korea or Japan or whereever). Sorry just had to vent.

sounds cool as long as user can freely change and it only affects first time (non-cookied) visitors.
Reply With Quote
  #6  
Old 10-01-2005, 10:32 AM
JoergZ JoergZ is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, of course the user can change it.

This automatic detected language is only used, as long the user don't select another one or he has a cookie from an earlier vist. So it is really for users, that come the first time to your site, or has logged out, so the cookies were deleted.

When the users select another language, the selected language is taken and is not switched back to the automatic detected, because then there is an entry in the cookie.

Currently I am trying to use the standard-hooks, so no code-changes are needed at all. Maybe this evening there is an update for my hack.


Jörg


EDIT: I have updated the hack, so no more code-modification is necessary. Thanks very much to KirbyDE for his help.
Reply With Quote
  #7  
Old 10-02-2005, 11:27 PM
Fenriz Fenriz is offline
 
Join Date: Aug 2002
Posts: 126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

J?rg, your hack works great, as well as the old version with new hook. You can check it on the my test forum http://temp.ulver.com
Just one thing to do. When you logg-in with one language (for example norwegian) and then change this language to another (for example swedish), after logg-out you lost your norwegian and return to swedish. But could we stay with swedish anyway, even after logg-out?
Reply With Quote
  #8  
Old 10-02-2005, 11:44 PM
JoergZ JoergZ is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Fenriz
When you logg-in with one language (for example norwegian) and then change this language to another (for example swedish), after logg-out you lost your norwegian and return to swedish. But could we stay with swedish anyway, even after logg-out?
Hm.. your description is a little bit mixed up.. isn't it ?

Probably you mean:

- Arriving at the forum, it is Norwegian, log in
- Changing as logged-in-user to Swedish
- Logging out

--> You have again norwegian, but you want to keep Swedish

Unfortunally this is not possible, because the language-information is stored in the cookie. When you log out, the cookie is removed. So coming back to the forum without cookie, will start the auto-detection process again.

The only way to keep the language, is not to log out, so the cookie remains. Then you will have the same language, as you left the forum.

But usually this should not be an issue, because users probably have their preferred language in the IE-Settings. If the language, they have defined in the IE, is not installed in your board, then the default-language of the board is shown.



Best regards and hej d?

J?rg
Reply With Quote
  #9  
Old 10-03-2005, 01:49 PM
berberber berberber is offline
 
Join Date: Aug 2004
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello, wouldnt it here possible to add the possibility to set language depending of forumid ?

(by the way, thanks a lot... that will make more members)
Reply With Quote
  #10  
Old 10-03-2005, 02:32 PM
JoergZ JoergZ is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi berberber,

I don't know if this would make sense... At least the user has one language, he preferes, and that is the language, that is set in the IE. So why the language should change, when I change the forum ?

Moreover, I think this must be hacked at another point of the code, not where my hack is placed.

Jörg
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 06:54 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.04503 seconds
  • Memory Usage 2,297KB
  • Queries Executed 23 (?)
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)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete