{"id":1948932,"date":"2021-01-25T15:20:22","date_gmt":"2021-01-25T20:20:22","guid":{"rendered":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/?post_type=tribe-knowledgebase&#038;p=1948932"},"modified":"2024-08-02T17:18:30","modified_gmt":"2024-08-02T21:18:30","slug":"translation-basics","status":"publish","type":"post","link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/translation-basics\/","title":{"rendered":"Translation Basics"},"content":{"rendered":"\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/ied51jkVxpk?si=AR9fycZrPGGlrH7U\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n\n\n\n<p>In this article, we&#8217;re going to look at the basics of translations. In the end, you should know the different types of translation files, how they&#8217;re used, and where to locate them.<\/p>\n\n\n\n<p>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 <a href=\"https:\/\/staging.theeventscalendar.com\/knowledgebase\/k\/how-to-override-plugin-language-files\/\">provide us with translations<\/a> because, frankly, we don&#8217;t speak every language here on The Events Calendar team.<\/p>\n\n\n\n<p>While the files are <em>helpful<\/em>, they may not always be <em>complete<\/em>. Perhaps the person who started the translation file didn&#8217;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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-types-of-translation-files\">Types of translation files<\/h2>\n\n\n\n<p>Translations usually consist of three types of files.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-pot-file\">The .pot file<\/h3>\n\n\n\n<p>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&#8217;t needed for the translations themselves to work. It merely serves as a blueprint for the translations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-po-file\">The .po file<\/h3>\n\n\n\n<p>A <code>.po<\/code> file is based on the <code>.pot<\/code> file. It takes all of translatable strings that are defined in the <code>.pot<\/code> file and allows us to provide translations for each string.<\/p>\n\n\n\n<p>In fact, there&#8217;s a free app called Poedit that makes this process pretty painless. Open up the <code>.po<\/code> file and start entering translations.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"\/knowledgebase\/wp-content\/uploads\/2021\/01\/poedit-po.png\" alt=\"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.\" class=\"wp-image-1948947\"\/><\/figure>\n\n\n\n<p>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.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nthe-events-calendar-fr_CA.po\n<\/pre><\/div>\n\n\n<p>There&#8217;s a <code>.po<\/code> 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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-mo-file\">The .mo file<\/h3>\n\n\n\n<p>An <code>.mo<\/code> file is not as reader-friendly as the <code>.po<\/code> file. That&#8217;s because it&#8217;s what WordPress uses to convert the translated strings in the <code>.po<\/code> file into the text that is displayed on the screen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-locating-translation-files\">Locating translation files<\/h2>\n\n\n\n<p>By default the translation files are located in the plugin folders. For example, the translation files for The Events Calendar can be found in <code>\/wp-content\/the-events-calendar\/lang<\/code>.<\/p>\n\n\n\n<p>Will translations <em>always<\/em> be located in a <code>\/lang<\/code> folder? No. It might be <code>\/language<\/code>, <code>\/translations<\/code> or whatever \u2014 it&#8217;s totally up to the developer. That&#8217;s great for flexibility, but means locating the files can be inconsistent between plugins.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-editing-translation-files\">Editing translation files<\/h2>\n\n\n\n<p>You can edit the <code>.po<\/code> file for a translation right there in the plugin. That&#8217;s legit and works. However, it also means that you&#8217;ll lose your work the next time the plugin updates and you install it.<\/p>\n\n\n\n<p>A better place to keep your edited translation files is <code>\/wp-content\/languages\/plugins<\/code>. That way, your translations not only override the ones in the plugin, but they&#8217;ll be left intact if the plugin happens to update later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-changing-the-language-of-your-calendar-s-url-slugs\">Changing the language of your calendar\u2019s URL slugs<\/h2>\n\n\n\n<p>The event slugs for your calendar\u2019s URLs are controlled via settings at Events &gt; Settings &gt; General &gt; 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we&#8217;re going to look at the basics of translations. In the end, you should know the different types of translation files, how they&#8217;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&#8230;<\/p>\n","protected":false},"author":5,"featured_media":1955565,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[128],"tags":[51,92],"stellar-product-taxonomy":[152,153,155,156,158,159,161,162],"class_list":["post-1948932","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-languages-translations","tag-localization","tag-translations","stellar-product-taxonomy-community-events","stellar-product-taxonomy-community-tickets","stellar-product-taxonomy-event-tickets","stellar-product-taxonomy-event-tickets-plus","stellar-product-taxonomy-events-calendar-pro","stellar-product-taxonomy-filter-bar","stellar-product-taxonomy-the-events-calendar","stellar-product-taxonomy-virtual-events"],"acf":[],"taxonomy_info":{"category":[{"value":128,"label":"Languages &amp; Translations"}],"post_tag":[{"value":51,"label":"Localization"},{"value":92,"label":"Translations"}],"stellar-product-taxonomy":[{"value":152,"label":"Community"},{"value":153,"label":"Community Tickets"},{"value":155,"label":"Event Tickets"},{"value":156,"label":"Event Tickets Plus"},{"value":158,"label":"Events Calendar Pro"},{"value":159,"label":"Filter Bar"},{"value":161,"label":"The Events Calendar"},{"value":162,"label":"Virtual Events"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Leah","author_link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/author\/leahk\/"},"comment_info":0,"category_info":[{"term_id":128,"name":"Languages &amp; Translations","slug":"languages-translations","term_group":0,"term_taxonomy_id":128,"taxonomy":"category","description":"","parent":61,"count":8,"filter":"raw","term_order":"0","cat_ID":128,"category_count":8,"category_description":"","cat_name":"Languages &amp; Translations","category_nicename":"languages-translations","category_parent":61}],"tag_info":[{"term_id":51,"name":"Localization","slug":"localization","term_group":0,"term_taxonomy_id":51,"taxonomy":"post_tag","description":"","parent":0,"count":5,"filter":"raw","term_order":"0"},{"term_id":92,"name":"Translations","slug":"translations","term_group":0,"term_taxonomy_id":92,"taxonomy":"post_tag","description":"","parent":0,"count":16,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1948932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1948932"}],"version-history":[{"count":2,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1948932\/revisions"}],"predecessor-version":[{"id":1958211,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1948932\/revisions\/1958211"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1948932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1948932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1948932"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1948932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}