How to Modify the Divi Translation Files Correctly

by | Last Updated: Dec 6, 2016 | Blog, WordPress Tips

If you are using the Divi theme in a different language than English, you have probably noticed that the quality of the translation is not very good. There are quite a lot of errors, at least in the Slovak translation which I’m using. In this article I’m going to give you an advice on how you can easily correct these errors. Yes, the first thing that may come to your mind is that you just have to edit the .po translation files. However, when a Divi update comes out and you update your Divi theme to a newer version, any changes that you might have made to the translation files will be lost. However, there is a solution for this problem. Read on my article to find out more.

First of all you need to use a child theme (check out my older article on how to create one if you don’t know). Then create a file functions.php in your child theme and place the following code into it:

<?php

function my_lang_function() {

load_child_theme_textdomain( ‘Divi’, get_stylesheet_directory() . ‘/lang’ );

load_child_theme_textdomain( ‘et_builder’, get_stylesheet_directory() . ‘/includes/builder/languages’ );

}

add_action( ‘after_setup_theme’, ‘my_lang_function’ );

?>

I suppose you have edited the translation files for your language already. If not, you will find them in the directory Divi/includes/builder/languages. You need to copy both .po and .mo files of your language into your child theme and also keep the same path in your child theme (includes/builder/languages) – so you will need to create these directories in your child theme. Then to edit the .po file (in my case sk_SK.po) you can use a program called Poedit. It’s free and I’ll also give you a small tip: You don’t have to translate the whole .po file, as that would be a lot of work. Just check your website and translate only the errors that you see on the pages of your website. In my case I always need to edit the text of the submit button on the contact form and the message that’s displayed when a message was sent.

As for the second file .mo, you don’t have to do anything with it (it is edited automatically as you edit the .po file). You just need to keep it together in the same location like your .po file.

Hopefully one day the guys at Elegant Themes will release a Divi update that would fix all the errors in the Divi translations. Until then we will have to use this method to fix it.

Bloom Email Opt In Plugin

Disclosure: This website is not owned by Elegant Themes. Some of the links on this website are affiliate links. That means that I will get paid a commission if you use them. This however does not influence my opinions, as I'm personally using these products and am satisfied with them.
Share This