How do I translate my theme from a child theme?

All official Easy Digital Downloads themes are translation-ready. Each theme includes a /languages directory in the root and a .pot that includes all strings that are ready for translation.

The typical way to translate a WordPress theme requires that you use .po and .mo files in the /languages directory of the theme. However, if you make any edits to a parent theme, including adding translation files to the theme, your edits will be overwritten (and completely lost) once the theme is updated. So this is not a good method.

Instead, it is best to upload your translation files directly to your child theme /languages folder. Follow the steps below.

1. Use Poedit (or similar tool) to create translation files.

Find the needed .pot file in the /languages directory, which is located in the root of the parent theme folder. Use that .pot file in a translation tool like Poedit to create your .po and .mo translation files.

2. Edit child theme functions.php file.

Depending on your child theme, you may or may not have a functions.php file. If you do not, create it in the root of your child theme.

Add the following code to the functions.php file:

3. Add your translation files.

Upload your .po and .mo files to the /wp-content/themes/child-theme/languages directory. If you do not have a /languages folder in your child theme, create it. The file names should follow this format: es_ES.po & es_ES.mo (example for Spanish translation). Your file names should not include the theme slug.

Your file names will use the text domain of the parent theme you are translating. So if you are translating Vendd to Spanish, your file paths would be /wp-content/themes/child-theme/languages/es_ES.po and /wp-content/themes/child-theme/languages/es_ES.mo.