Are you working on a custom template and you want to use the same translated event terms we do in your new template?

Do you have a site that only deals in a specific type of event? Would you rather use that word instead of event/events throughout the site?

Or maybe you feel like the translation of the word is incorrect for your use and you want to provide your own translated term?

Well, we’ve got ways for you to do just that!

First, to get the existing terms we have four functions in The Events Calendar:

  • tribe_get_event_label_singular
  • tribe_get_event_label_singular_lowercase
  • tribe_get_event_label_plural and
  • tribe_get_event_label_plural_lowercase

Notice we have separate ones for plurals (“events” vs. “event”) and for lowercase (“Event” vs “event”). This makes it easier for folks to use them in correct context – for example, in a title we’d use tribe_get_event_label_singular or tribe_get_event_label_plural as titles (in English and other languages) are typically capitalized, whereas in a content block we’d use tribe_get_event_label_singular_lowercase or tribe_get_event_label_plural_lowercase.

Knowing that context helps translators (and folks like you!) choose the correct word, and in some instances alter the capitalization (in German for example, “Event” as a noun is always capitalized).

But what if you don’t want to use “event” – what if you want to use “concert”?

Well, each of those functions has a filter in it. WordPress filters allow you to change data before it is used – in this case, the strings for the event terms. As you might expect, since there are four functions, there are four filters. We tried to make them easy to remember – they are the functions’ names, without the “get”:

  • tribe_event_label_singular
  • tribe_event_label_singular_lowercase
  • tribe_event_label_plural and
  • tribe_event_label_plural_lowercase

Remember we mentioned translation patching above? One caveat of these filters is they are applied after the word has been translated – so if you have a non-English site, using them will override the translation.

As an example, (our site is in German) here’s our calendar search bar:

changing the term events

Now we filter the “event” terms to use “concert” instead (specifically, we’re filtering tribe_event_label_plural to use “Concerts”):

changing the term events

The term is applied after the translations, so “Finde” (“Find”, in English) stays translated, but “Concerts” does not get translated. This could be an issue on some sites, so test it carefully, but that also means you can tweak the translation of the word if you feel it’s incorrect!

To utilize one of these filters is fairly easy. You’ll want to add some code to your theme’s functions.php file.

So, continuing our “concerts” example, to change all instances of the words from event/events to concert/concerts we’d put the following in our file:

add_filter( 'tribe_event_label_singular', function() { return 'Concert'; } );
add_filter( 'tribe_event_label_singular_lowercase', function() { return 'concert'; } );
add_filter( 'tribe_event_label_plural', function() { return 'Concerts'; } );
add_filter( 'tribe_event_label_plural_lowercase', function() { return 'concerts'; } );

And then we’ll see this:

changing the term events

It’s also worth mentioning that all of our other plugins respect these filters, so if you are using Filter Bar you’ll see this:

changing the term events affects filter bar as well

You can also manually change the names of Filter Bar filters by going to Events > Settings > Filters and then opening the one you want to change in the Active Filters list.

Changing the language of your calendar’s URL slugs

The event slugs for your calendar’s URLs are controlled via settings at Events > Settings > General > Viewing. The URLs will always use the slugs defined there, even if you are using a different language for your site. The default slugs are in English. If you switch your site to another language, you probably also want to change the slugs to be in that language.