- Status
- Resolved
- Resolved in
- 3.0.3
Overview of the issue
When you have set a bad locale in WPML > Languages for a language (or a custom language that you have added) then you can get a fatal error like this one when visiting the language:
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
Workaround
We are working on fixing this error right now
It is recommended that you fix the locale in WPML > Languages > Edit languages
If you cannot access any admin page, you should temporary disable WPML String Translation – best way is by going by FTP to the /wp-content/plugins/ folder and renaming the folder to something else.
As a temporary patch, edit the file wpml-string-translation/classes/translations-file-scan/translations-file/wpml-st-translations-file-locale.php at line 65 and replace:
throw new RuntimeException( 'Language of ' . $this->filepath. ' cannot be recognized' );
By:
return '';