In this article, we’re going to look at the basics of translations. In the end, you should know the different types of translation files, how they’re used, and where to locate them.

Our plugins, like many other WordPress plugins, include translation files that help translate it for other languages. We rely heavily on folks from the community to provide us with translations because, frankly, we don’t speak every language here on The Events Calendar team.

While the files are helpful, they may not always be complete. Perhaps the person who started the translation file didn’t complete all of it for one reason or another. In these cases, the translation files are more of a starting point than they are a final solution.

Types of translation files

Translations usually consist of three types of files.

The .pot file

This file is the foundation for all of the translations in a plugin. It contains translatable strings, which is a fancy way of saying it contains words and phrases that can be translated. This file isn’t needed for the translations themselves to work. It merely serves as a blueprint for the translations.

The .po file

A .po file is based on the .pot file. It takes all of translatable strings that are defined in the .pot file and allows us to provide translations for each string.

In fact, there’s a free app called Poedit that makes this process pretty painless. Open up the .po file and start entering translations.

Screenshot of the Poedit interface which is two columns, where the left side is the English transition string and the right contains the Canadian translations.

Notice something in there? The file is named in a way that identifies the type of translation that not contains, which in this case, is French Canadian.

the-events-calendar-fr_CA.po

There’s a .po for each translated language. The more files included in the plugin, the more translations that are available to use. The more complete the files are, the more coverage you get with the translation.

The .mo file

An .mo file is not as reader-friendly as the .po file. That’s because it’s what WordPress uses to convert the translated strings in the .po file into the text that is displayed on the screen.

Locating translation files

By default the translation files are located in the plugin folders. For example, the translation files for The Events Calendar can be found in /wp-content/the-events-calendar/lang.

Will translations always be located in a /lang folder? No. It might be /language, /translations or whatever — it’s totally up to the developer. That’s great for flexibility, but means locating the files can be inconsistent between plugins.

Editing translation files

You can edit the .po file for a translation right there in the plugin. That’s legit and works. However, it also means that you’ll lose your work the next time the plugin updates and you install it.

A better place to keep your edited translation files is /wp-content/languages/plugins. That way, your translations not only override the ones in the plugin, but they’ll be left intact if the plugin happens to update later.

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.