Maybe I'm missing something here but I really can't find any answer to my question around the web.

I am creating a new wordpress theme from scratch (literally from scratch) and would like to create languages folder with PO and MO file in it.

I would like to generate this translation MO file from scratch

I was looking for a good tutorial that will get me started and let me understand the whole procedure but all the good tutorials I found all talking about how to translate strings that are already exist.. meaning that a MO file exists already, the strings are already in it and I need to translate them.. that's pretty easy but that's not what I want.

I would like to generate something from scratch using my own custom strings.. + I want to always be able to add more strings and compile it again to update the PO file.

can anyone send a good tutorial of how o do it from scratch? am I missing something here?

Thanks a lot

3 Answers 3


You can use the tool POEdit to translate your theme from scratch or update/add new strings into the .po/.mo files. Here is the tool usage tutorial: Translating_With_Poedit

There is a plugin that can do the job for you: codestyling-localization


1. Load a text domain for the theme.

add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
    load_theme_textdomain('mytheme', get_template_directory() . '/languages');

2. Find the messages that need to be translated and process them with the appropriate WordPress function.

_e(‘Hello user’,’mytheme’);
the_content( __(‘Read more’,’mytheme’) );

3. Create language files. 3.1 The POT file contains a list of all translatable messages in our theme.

3.2 The .po file is created when we translate a POT file to a particular locale.

3.3 The .mo is a binary file that is created automatically by translation software and is not human-readable.

4. Create the POT file with help of a tool called PoEdit

4.1 Open Poedit, and create a new catalog. Fill in the project’s information in the “Project info” tab.

4.2 Provide path to the theme and it will parse all the text those needs to be translated. You need to provide the keywords we used in the theme __( and _e so it can parse and create the POT for you.

4.3 Now add the translated text for each string inside POT file and a .po file is created by setting the language code and country code as the file name.

4.4 Generate .mo file out of it. (When saving a .po file, Poedit will automatically create an .mo file, which is a binary file and is not human-readable.)

4.5 Instruct WordPress to enable the localization and to load the language files. Edit the wp-config.php file and edit this define('WPLANG', 'en_GB');

  • 1
    wp cli is by far the easiest way to generate them instead of poedit
    – Tosh
    Commented Jun 17, 2020 at 11:04
  1. Install wp-cli on your development machine.
  2. Run wp i18n make-pot . languages/my-theme.pot in your plugin/theme folder (wp-cli i18n)
  3. Choose a unique identifier, I chose my-theme as an example, wrap your strings using the __() function:

__('Something', 'my-theme');

  1. Run step 2 every time you add a new translatable string
  2. (Optional) Translate it locally with Loco Translate or similar to test everything is working as expected
  3. Publish your plugin/theme and translate it with https://translate.wordpress.org/

I'm using eazypo to generate MO files for wordpress themes and plugins.

Nice and free software. check their website, they have a guide.

  • Windows-only, last updated in 2014. Commented Apr 6, 2021 at 13:05
  • this answer was in 2017 and the main question did not mention the required OS.
    – Abouasy
    Commented Apr 11, 2021 at 5:38
  • That's still dated 3 years. Hardly actively developed. Commented Apr 12, 2021 at 11:37
  • I'm still using it and it is working fine with windows 7 & 10.
    – Abouasy
    Commented Apr 18, 2021 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.