Thread: Miscellaneous Hacks - NoSpam! - an alternative to CAPTCHA images
View Single Post
  #362  
Old 02-14-2007, 09:14 PM
derfelix derfelix is offline
 
Join Date: Nov 2001
Posts: 204
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok i looked a little into the multilingual support.. as I was not satisfied with the solution above. I am using the hack https://vborg.vbsupport.ru/showthread.php?t=98904 by JoergZ for translating customfields and i thought that i could use a few lines of code here. (actually it is a code snippet I posted in that thread to adapt his hack)

The basic idea is: You only need the question translated, you can define the answers in different languages.. so you give the answers in all installed languages.

3 steps to make it work multilanguage with phrases.

Step one:
Modify the product xml:
find:
PHP Code:
$nospamquestion $qanda[0]; 
below add:
PHP Code:
// ########### Lang hack  ---start ########  
      
$questionphrase ''
      
$testforphrase substr(trim($nospamquestion), 01);  
      if (
$testforphrase == '$')  
      {  
            
$questionphrase substr(trim($nospamquestion), 1);  
            
$nospamquestion $vbphrase[$questionphrase];  
      } 
// ########### Lang hack  ---end ######## 
Now reinstall the product.xml (with overwrite of course)

Step two:
Go to your phrase manager in the ACP and add a new phrase:

Phrase Type: GLOBAL
Product: vBulletin
Varname: nospam_question_01
Text: How much is 2+2

Then insert the translation for all istalled languages (in my case english, german and french)

German: Wieviel ist 2+2
Fran?ais: Combien font 2+2

Now save the phrase.

Repeat for all your questions using the variables:

Varname: nospam_question_02
Varname: nospam_question_03
Varname: nospam_question_04
Varname: nospam_question_05
............. and so on

IMPORTANT!!!: Write down the question number and the question on a piece of paper !!!! (happened to me.. i didnt remember which variable number was which question)

Now comes step three:

go to your nospam settings and define the questions the following way:
(in our example: How much is 2+2)

$nospam_question_01:4:four:vier:quatre

IMPORTANT: in your nospam setting you MUST set a $ sign in front of the varname you used in the phrases
other example: in your phrases you use the varname nospam_question_04 in your nospam settings you use $nospam_question_04

I hope it is clear.

I tested it on 3.64 and it works for me... THANK YOU for the great hack!!

Felix

Forgot to say, that if you dont use the $ in the nospam settings for the question, the question will appear as you entered it. (Like in the original hack)

Hope this helps someone
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01432 seconds
  • Memory Usage 1,782KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete