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:

Read More
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.

Related posts

2 comments

  1. 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.

  2. The text is in fact in the PHP files, but it should appear in special functions like _e() for example: these functions translates the given strings thanks to the *.mo files. For example, if you configured your WordPress installation to use it in French, WordPress will search for french *.mo files and will use them if they exist (if it is not the case, it does not translate anything).

    If you don’t need any translation, you can in fact remove the lang directory without any problem.

Comments are closed.