Support » Plugin: WP jQuery Lightbox » How to translate WP jQuery Lightbox?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Milos Spasic

    (@spale)

    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.

    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/' );

    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. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to translate WP jQuery Lightbox?’ is closed to new replies.