从WordPress删除.po和.mo文件?
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.
我有几个包含.mo和.po文件的主题用于翻译。 p> 代码中对这些文件的唯一引用类似于: p>
load_theme_textdomain('ThemeName',$ template_dir。'/ lang');
code > pre>
如果我不需要因任何原因翻译主题,从这些主题中删除 lang code>目录是否安全? 有英语的语言文件(en_US),但看起来它们实际上并没有被主题使用,因为文本直接在PHP文件中... p>
对不起,如果这样 是一个愚蠢的问题,我只是不确定这些文件如何与WordPress一起使用。 p>
div>
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.
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.