Pro portfolio filter (All) translation help

Hi,

At the top of Pro theme portfolio page, there is a filter with portfolio categories. I’m trying to translate the “All” text and I cannot find that inside theme files.

Can you please help me where can I find the source text to replace it with the localized version?

Thank you,
Gabriel

Hi Gabriel,

Thanks for reaching out.
Yes, they’re not in the pot file. You need to translate them by other means including filtering gettext. Please add the following code into the functions.php of your child theme.

add_filter('gettext', 'translate_all_text');
add_filter('ngettext', 'translate_all_text');
function translate_all_text($translated_text, $untranslated_text, $domain) 
{
    if ( $untranslated_text == 'All' ) 
    {
        $translated_text = __( 'Translated Text of ALL','text_domain' );
    }
    return $translated_text;
}

Please remember that the above code will work if copied as it is and don’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes that means we can’t fix it in case it conflicts with something in your site nor will we enhance it.

Thanks

Hi,

Thanks for the code, although it didn’t work out of the box, but it was a good hint where to start. I managed to make it work by adding the arguments to the end and it works now.

add_filter('gettext', 'translate_all_text', 97, 3 );
function translate_all_text($translated_text, $untranslated_text, $domain) 
{
    if ( $untranslated_text == 'All' ) 
    {
        $translated_text = __( 'Newtext', '__x__' );
    }
    return $translated_text;
}

Thank you for your help,
Gabriel

Glad to hear that, Gabriel!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.