- 状态
- 已解决
- 解决于
- 3.0.3
问题概述
当您在 WPML > 语言中为某种语言(或您添加的自定义语言)设置了错误的区域设置时,访问该语言时可能会遇到类似以下的致命错误:
Fatal error: Uncaught RuntimeException: Language of .../wp-content/languages/plugins/sitepress-ar3.mo cannot be recognized in ...wp-contentpluginswpml-string-translationclassestranslations-file-scantranslations-filewpml-st-translations-file-locale.php on line 65
( ! ) RuntimeException: Language of .../wp-content/languages/plugins/sitepress-ar3.mo cannot be recognized in ...wp-contentpluginswpml-string-translationclassestranslations-file-scantranslations-filewpml-st-translations-file-locale.php on line 65
Call Stack
# Time Memory Function Location
1 0.4015 410016 {main}( ) ...index.php:0
2 0.4017 410296 require( '...wp-blog-header.php' ) ...index.php:17
3 0.4017 410840 require_once( ...wp-load.php' ) ...wp-blog-header.php:13
4 0.4019 411368 require_once( '...wp-config.php' ) ...wp-load.php:37
5 0.4019 416200 require_once( '...wp-settings.php' ) ...wp-config.php:97
6 0.4676 3677216 do_action( ) ...wp-settings.php:394
7 0.4676 3677592 WP_Hook->do_action( ) ...plugin.php:465
8 0.4676 3677592 WP_Hook->apply_filters( ) ...class-wp-hook.php:310
9 0.4923 3975520 SitePress->plugin_localization( ) ...class-wp-hook.php:286
10 0.4923 3975584 load_plugin_textdomain( ) ...sitepress.class.php:3350
11 0.4923 3975728 load_textdomain( ) ...l10n.php:791
12 0.4923 3975728 apply_filters( ) ...l10n.php:621
13 0.4923 3976128 WP_Hook->apply_filters( ) ...plugin.php:208
14 0.4923 3977632 WPMLSTMOHooksLoadTextDomain->overrideLoadTextDomain( ) ...class-wp-hook.php:286
15 0.4923 3978112 WPML_ST_Translations_File_Locale->get( ) ...LoadTextDomain.php:59
临时解决方法
我们目前正在努力修复此错误
建议您在 WPML > 语言 > 编辑语言中修复区域设置
如果您无法访问任何管理后台页面,您应该暂时禁用 WPML 字符串翻译——最好的方法是通过 FTP 进入 /wp-content/plugins/ 文件夹,并将该文件夹重命名为其他名称。
作为临时补丁,请编辑文件wpml-string-translation/classes/translations-file-scan/translations-file/wpml-st-translations-file-locale.php的第 65 行,并将:
throw new RuntimeException( 'Language of ' . $this->filepath. ' cannot be recognized' );
替换为:
return '';