phpwordpresspomo

Deleting .po and .mo files from WordPress?


I have several themes that contain .mo and .po files for translations.

The only reference to these files in the code is similar to this:

load_theme_textdomain('ThemeName',$template_dir.'/lang');

Would it be safe to delete the lang directory from these themes if I don't need to translate the theme for any reason? There are language files for English (en_US), but it doesn't look like they are actually used by the themes since the text is directly in the PHP files...

Sorry if this is a dumb question, I'm just not really sure how these files work with WordPress.


Solution

  • In your code you will see commands like

    __('Some text','Themename');
    _e('Some text','Themename');
    

    If you set WP_LANG to "de_DE" in case you are in Germany, your WordPress installation will look for the file Themename-de_DE.mo in the /lang folder to find a translation.

    If you remove the files/folder I would also remove the load_theme_textdomain('ThemeName',$template_dir.'/lang'); command. The files can all be removed but as mentioned in the comments, they will return on update.