• Resolved pzxyz

    (@pzxyz)


    I’m trying to change “English” to “english” using such code:

    add_filter( 'trp_beautify_language_name', 'trpc_change_language_name', 10, 3 );
    function trpc_change_language_name ($name, $code, $english_or_native ){
    	if ( $code == 'en_US' ){                // replace with the code of the language to change
    		return 'english';     // replace with your desired language name
    	}
    	return $name;
    }

    Instead I get:

    The snippet has been deactivated due to an error on line 9:
    
    Cannot redeclare function trpc_change_language_name.
    

    How to do this smoothly?

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • i would also like to be able to change the default way of how the english language full name is displayed by default : English (UK) to English.

    Edit : looking at your web page link it seems that you made it work. Do you have a solution you can share maybe ? Thank you.

    Edit2 : used your snippet code and edited ‘en_US’ to ‘en_GB’ to display English. Thx!

    Thread Starter pzxyz

    (@pzxyz)

    You have to add second condition to snippet. For example like this:

    add_filter( 'trp_beautify_language_name', 'trpc_change_language_name', 10, 3 );
    function trpc_change_language_name ($name, $code, $english_or_native ){
    	if ( $code == 'pl_PL' ){                // replace with the code of the language to change
    		return 'polski';     // replace with your desired language name
    	}
    	if ( $code == 'en_US' ){                // replace with the code of the language to change
    	return 'english';     // replace with your desired language name
    	}
    		return $name;
    }

    Your first snippet code worked just fine.

    add_filter( 'trp_beautify_language_name', 'trpc_change_language_name', 10, 3 );
    function trpc_change_language_name ($name, $code, $english_or_native ){
    	if ( $code == 'en_GB' ){                // replace with the code of the language to change
    		return 'English';     // replace with your desired language name
    	}
    	return $name;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change default language name’ is closed to new replies.