• Resolved TokoDaring.Com

    (@wpjakarta)


    Hello

    i’ve tried to translate some text on my checkout page by following this guidance https://developer.www.ads-software.com/reference/hooks/gettext/ using this code

    add_filter( 'gettext', 'repl_wc_text', 999, 3 );
    function repl_wc_text( $translated_text, $text, $domain ) {
        if ( ! is_admin() && 'woocommerce' === $domain ) {
            switch ( $translated_text ) {
                case 'City' :
                    $translated_text = __( 'Kota', 'storefront' );
                break;
                case 'District' :
                    $translated_text = __( 'Kecamatan', 'storefront' );
                break;
            }
        }
        return $translated_text;
    }

    and i would like to know why the code is not working. is there something wrong with the code ?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘translate some text using gettext’ is closed to new replies.