Support

Home Forums Event Espresso Premium calendar filter language

calendar filter language

Posted: July 28, 2018 at 6:06 am


bergwerk

July 28, 2018 at 6:06 am

Hi,
i want to “select a category” and “click to select a category” on the filter tool in the calendar add on. With loco translate in found nothing under event espresso.
thanks,
matthias


Josh

  • Support Staff

July 28, 2018 at 1:38 pm

Hi Matthias,

You’ll actually edit those strings under the Calendar plugin’s entry in Loco Translate, like in this screenshot:

https://slack-files.com/T02SY781D-FBY23U9QQ-152a5509cc

Please note you may need to go into the Advanced tab of Loco translate and change the Text Domain setting for EE4 calendar plugin. Loco translate will set it to ee4-calendar, but it’s actually event_espresso.


bergwerk

July 29, 2018 at 3:02 am

Hi,

thanks, now i can translate it, the only problem i have, after saving the files get overwritten?


Josh

  • Support Staff

July 30, 2018 at 7:25 am

If I understand correctly, it sounds like loco translate would need to be configured to use a custom location for the files.

Another approach you could take that doesn’t involve wrangling the Loco Translate plugin would be to add a translation function. The function is ready to copy and paste from the documentation:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

Your strings array would look like this:

$strings = array(
 'Select a Category' => 'Your custom text here',
 'Click to select a category:' => 'Your other custom text here',
 // Add some more strings here
);

You can add the above to a functions plugin or into your WordPress child theme’s functions.php file.


bergwerk

August 1, 2018 at 8:55 am

Hi,
I installed a functions plugin an edit a php file likes this.
But the translation does not work. Do you have an idea?
thanks,
Matthias

Screenshot Editor


Tony

  • Support Staff

August 1, 2018 at 9:11 am

Hi Matthias,

You need all of the code from here:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

The code Josh added, is how your $strings array from ithin that code would look.

So it should be something like this:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'Select a Category' => 'Your custom text here',
        'Click to select a category:' => 'Your other custom text here',
        // Add some more strings here
    );
 
    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );

Note I’m working on some change we can make to make Loco Translate a little easier to use with EE in the future.

The support post ‘calendar filter language’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 2 months, 2 weeks ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!