Translate Strings

This topic contains 3 replies, has 2 voices, and was last updated by  Paolo 10 years, 3 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #16525

    jonahcoyote
    Expired Member
    Post count: 89

    Hi there,

    I’m wanting to change some strings throughout the plugin and am unable to do so. For example, I’m trying to change strings this way:

    
    
    
    /*-------------------------------------------------------------------------------
    	Modify Strings
    -------------------------------------------------------------------------------*/
    function filter_translations($translation, $text, $domain) {
        if ($domain ==  GEODIRECTORY_TEXTDOMAIN ) {
            switch ($text) {
                case 'Send Enquiry':
                    $translation = 'Send Inquiry';
                    break;
            }
        }
    
        return $translation;
    }
    add_filter('gettext', 'filter_translations', 20, 3);
    

    Do you guys know what the problem might be or a better way for me to change strings?

    Thanks,
    Jonah

    #16542

    Paolo
    Site Admin
    Post count: 31206

    Hi Jonah,

    not entirely sure of what you are trying to do, but why not simply “translate” it via po file?

    I mean translation allows to change any string in the templates from English to let say Spanish.

    Howeever it can be used in English to simply change wording for any given string, without actually translating.

    http://docs.wpgeodirectory.com/category/translation/

    Let us know,

    Thx

    #16543

    jonahcoyote
    Expired Member
    Post count: 89

    Hey paolo, that works. I guess my solution was to do it without doing the whole po file thing. But that’s not too difficult…

    Thanks,
    Jonah

    #16544

    Paolo
    Site Admin
    Post count: 31206

    You’re welcome.

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount