简体   繁体   English

将Wordpress翻译文件复制到wp语言文件夹

[英]Wordpress translation files copied to wp language folder

I have a weird problem with one of my wordpress sites. 我的一个wordpress网站存在一个奇怪的问题。 I have a custom cookie notice plugin with translation files in its own directory. 我有一个自定义Cookie通知插件,在其自己的目录中带有翻译文件。 And this works fine. 这很好。 But after a day or two the translation files are copied to /wp-content/languages/plugins folder and then the translations don't work anymore. 但是,在一两天后,翻译文件被复制到/wp-content/languages/plugins文件夹,然后翻译不再起作用。 When I delete these files the translations work again. 当我删除这些文件时,翻译将再次起作用。 I disabled all the plugins I could (SEO, W3 Cache, Security plugins,..) But this keeps happening. 我禁用了所有可能的插件(SEO,W3 Cache,安全性插件等等),但是这种情况一直在发生。 The translations don't work if the files are only in the /wp-content/languages/plugins folder. 如果文件仅位于/wp-content/languages/plugins文件夹中,则翻译不起作用。 Does anyone have an idea what could be copying these files? 有谁知道可以复制这些文件吗?

UPDATE: So the problem reappeared. 更新:问题再次出现。 I deleted all the plugins and the additional tables that i think could cause the problem (W3 cache, Wordfence, All in one security plugin). 我删除了所有可能引起问题的插件和其他表(W3缓存,Wordfence,多合一安全插件)。 I cleared the .htaccess file so only the default wordpress rules remain. 我清除了.htaccess文件,因此仅保留默认的wordpress规则。 I removed my plugin and installed it again. 我删除了插件,然后再次安装。 So this works for a while. 所以这工作了一段时间。 Then - I guess a request - triggers a file copy. 然后-我猜一个请求-触发文件复制。 The mo and po files get copied from my-plugin/language folder to /wp-content/languages/plugins folder and the translations no longer work. mo和po文件从my-plugin/language文件夹复制到/wp-content/languages/plugins文件夹,翻译不再起作用。 If I overwrite the two new files it works again until "something" overwrites the files again. 如果我覆盖了这两个新文件,它将再次起作用,直到“某物”再次覆盖这些文件。 I've been searching through functions.php and through the plugin files but could not find anything that could be causing this. 我一直在搜索functions.php和插件文件,但找不到任何可能导致此问题的东西。 I even tried loading files again from a different custom folder. 我什至尝试从另一个自定义文件夹再次加载文件。 It works until the files are written/overwritten in the /wp-content/languages/plugins folder. /wp-content/languages/plugins文件夹中写入/覆盖文件之前,它一直有效。 I tried setting the file permissions to read only but I only have access through ftp so it has no effect. 我尝试将文件权限设置为只读,但是我只能通过ftp访问,所以它没有任何作用。 Does anybody have an idea where to look for the problem. 是否有人知道在哪里寻找问题。 BTW I have 3 more websites on the same server (same theme, same plugins, different domain, different language) and those sites work correctly. 顺便说一句,我在同一台服务器上还有3个网站(相同的主题,相同的插件,不同的域,不同的语言),这些网站可以正常工作。

I think I solved it with load text domain for the plugin. 我想我用插件的加载文本域解决了它。 Now it works when the translation files are in /wp-content/languages/plugins folder. 现在,当翻译文件位于/wp-content/languages/plugins文件夹中时,它可以工作。 I still don't know why other plugins translate even if there is no load text domain in the functions.php.. 我仍然不知道为什么即使在functions.php中没有加载文本域的情况下,其他插件也会翻译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM