• Kreeger

    (@kreeger)


    Hello,

    Your plugin loads the .mo to display the countries in the right language. But in same cases, this is a problem…

    My client’s website is in English but he wants the WP Admin in his language (French).

    So, with your plugin, the select is displayed in French…

    Is there a way to use a specific language (I need to display the select in English) WITHOUT deleting your .mo/.pot files in your plugin ?

Viewing 1 replies (of 1 total)
  • atonaome

    (@atonaome)

    Hi, Kreeger! I do not know how correct is this way but I use it on my own projects. I hope it will help you, too. Just add the code bellow in your functions.php file

    function yourtheme_wpcf7_listo( $data, $options, $args ) {
        if ( ! function_exists( 'listo' ) ) {
            return $data;
        }
    
        $args = wp_parse_args( $args, array() );
    
        $args['locale'] = get_locale(); //Replace get_locale() by your locale like 'en_GB'
    
        foreach ( (array) $options as $option ) {
            $option = explode( '.', $option );
            $type = $option[0];
            $args['group'] = isset( $option[1] ) ? $option[1] : null;
    
            if ( $list = listo( $type, $args ) ) {
                $data = array_merge( (array) $data, $list );
            }
        }
    
        return $data;
    }
    
    add_filter( 'wpcf7_form_tag_data_option', 'yourtheme_wpcf7_listo', 999, 3 );
Viewing 1 replies (of 1 total)
  • The topic ‘Change the language by default’ is closed to new replies.