• Resolved net

    (@krstarica)


    It would be nice to be able to override language detection using [hcaptcha] shortcode parameter, to able to present captcha in appropriate language on multiple language pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Yes, plz, this would be great

    Plugin Contributor kaggdesign

    (@kaggdesign)

    Thank you for the idea.

    Unfortunately, we cannot set language via shortcode parameter, as the language is specified in the hCaptcha script only. There could be several shortcodes (and several hCaptcha widgets, therefore) on a page, but only one script.

    So, we can change the language for all hCaptcha widgets on the page. To make it programmatically, I have added the hook to the plugin. You can use the following filter:

    
    /**
     * Filters hCaptcha language.
     *
     * @param string $language Language.
     */
    function my_hcap_language( $language ) {
    	// Detect page language and return it.
    	$page_language = 'some lang'; // Detection depends on the multilingual plugin used.
    
    	return $page_language;
    }
    
    add_filter( 'hcap_language', 'my_hcap_language' );
    

    This hook is implemented in v1.14.0 of the plugin, which we plan to release today or tomorrow.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Set language via shortcode param’ is closed to new replies.