Ready to get started?Download WordPress


Captcha Bank
Translation (2 posts)

  1. cksong
    Posted 4 months ago #

    How to translate user message, such as error message etc.?
    I translated all screen display messages in the source but it still shows English only. Please show me the way.


  2. Smidefix
    Posted 3 months ago #

    Hi cksong,
    as soon as you have the .po and .mo files, you only need to get WP to scan for these files. I've put them into a subdirectory named "languages" underneath this plugin's directory.
    Add a function to captcha_bank.php:

    function captcha_bank_init()
    	load_plugin_textdomain( 'captcha-bank', false, CAPTCHA_BK_PLUGIN_DIRNAME . '/languages/' );
    add_action('plugins_loaded', 'captcha_bank_init');

    This makes the textdomain "captcha-bank" available to WP.

    There's a bit more to do, if you want a complete translation, because a number of lib functions is not yet written for i18n. As I was only interested in adding a captcha to the comment form, I've modified this particular function only.
    For example, in captcha_bank_class.php' function function captcha_bank_form() search for the code around "refresh" and modify the lines to

    <a id="Refresh" style="border-style: none;" href="#" title="<?php _e('Refresh Image','captcha-bank');?>" ><img src="<?php echo CAPTCHA_BK_PLUGIN_URL ."/refresh.png"?>" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0" /></a><br />
    			<strong><?php _e('Enter Code*:','captcha-bank');?></strong><br />

    You can then localize 'Refresh image' and 'Enter Code*:' as well.
    I was yet unable to find, where the textdomain variable was set, so I hardcoded it to 'captcha-bank' in the code.

    Feel free to rewrite as many functions as you wish according to your needs. Caution: You'll lose all of this, once you update the plugin, until the developers include such code in the original files (I'm not too familiar with code management systems, yet so I would rely on the guys to add it.)



You must log in to post.

About this Plugin

About this Topic


No tags yet.