Forums

WP jQuery Lightbox
[resolved] How to translate WP jQuery Lightbox? (4 posts)

  1. Spale
    Member
    Posted 6 months ago #

    OK, I'm totally confused...

    Can somebody tell my how to translate this plugin?
    Not the admin area, only things that users are seeing on the site.

    http://wordpress.org/extend/plugins/wp-jquery-lightbox/

  2. Spale
    Member
    Posted 5 months ago #

    I have found the solution.

    Open the wp-jquery-lightbox.php and find the following code:

    function jqlb_js() {
    	if(is_admin() || is_feed()){return;}
    	wp_enqueue_script('jquery', '', array(), false, true);
    	wp_enqueue_script('wp-jquery-lightbox', JQLB_SCRIPT_URL,  Array('jquery'), '1.3.3', true);
    	wp_localize_script('wp-jquery-lightbox', 'JQLBSettings', array(
    		'fitToScreen' => get_option('jqlb_resize_on_demand'),
    		'resizeSpeed' => get_option('jqlb_resize_speed'),
    		'displayDownloadLink' => get_option('jqlb_show_download'),
    		'navbarOnTop' => get_option('jqlb_navbarOnTop'),
    		'loopImages' => get_option('jqlb_loopImages'),
    		'resizeCenter' => get_option('jqlb_resizeCenter'),
    		'marginSize' => get_option('jqlb_margin_size'),
    		'linkTarget' => get_option('jqlb_link_target'),
    		//'followScroll' => get_option('jqlb_follow_scroll'),
    		/* translation */
    		'help' => __(get_option('jqlb_help_text'), 'jqlb'),
    		'prevLinkTitle' => __('previous image', 'jqlb'),
    		'nextLinkTitle' => __('next image', 'jqlb'),
    		'prevLinkText' =>  __('« Previous', 'jqlb'),
    		'nextLinkText' => __('Next »', 'jqlb'),
    		'closeTitle' => __('close image gallery', 'jqlb'),
    		'image' => __('Image ', 'jqlb'),
    		'of' => __(' of ', 'jqlb'),
    		'download' => __('Download', 'jqlb')
    	));
    }

    Replace the:

    'previous image'
    'next image'
    '« Previous'
    'Next »'
    'close image gallery'
    'Image '
    ' of '
    'Download'

    with words on your language, save the file and upload it back to the host.

    Edit image wp-jquery-lightbox/styles/images/closelabel.gif and change the text with the word on your language, save it and upload to the server.

    You are done, user part of the plugin is translated now.

  3. jacek606
    Member
    Posted 5 months ago #

    Plugin is translation ready.
    But I couldn't get translation to work (wordpress 3.3) until I changed:
    load_plugin_textdomain('jqlb', false, plugin_dir_path(__FILE__).'languages/');
    to:
    load_plugin_textdomain( 'jqlb', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );

  4. ulfben
    Member
    Posted 5 months ago #

    Maybe I misunderstood the dirname when replacing it with plugin_dir_path for 1.3.4?

    I've reverted the change now. If anyone else runs into the same problem you should re-download the plugin.

    I'll have to remember to try this again for next release but test it more. :)

Reply

You must log in to post.

About this Plugin

About this Topic