qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
550 stars 103 forks source link

Class `IntlDateFormatter` not found #1251

Closed MarkArgent closed 1 year ago

MarkArgent commented 1 year ago

I'm getting the error below when I attempt to edit a field in ACF Pro, this is with ACF Pro 6.0.3, qTranslate-XT 3.12.1, and WordPress 6.1.1. I am seeing this when I click to edit to edit a field group in ACF Pro --- the URL is http://netbsd/angleseyartsforum.org/wp-admin/post.php?post=517&action=edit (that URL goes to an address on my local machine).

Fatal error: Uncaught Error: Class 'IntlDateFormatter' not found in /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php:53 Stack trace: #0 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(192): {closure}(Object(DateTime), '%A') #1 [internal function]: {closure}(Array) #2 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(194): preg_replace_callback('/(?<!%)(%[a-zA-...', Object(Closure), '%A %B %e%q, %Y') #3 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(488): qxtranxf_intl_strftime('%A %B %e%q, %Y', Object(DateTime), 'en_US') #4 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(523): qtranxf_format_date('', '2020-02-10 11:5...', '2020-02-10') #5 /home/mark/angleseyartsforum.org/data/wp-includes/class-wp-hook.php(308): qtranxf_dateFromPostForCurrentLanguage('202 in /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php on line 53

vonsch76 commented 1 year ago

Seems like some problem in your local install. Check this.

herrvigg commented 1 year ago

Thanks for testing the git code on the master branch. You need the ext-intl in PHP, I added that in the composer file for information. See https://www.php.net/manual/en/intl.installation.php

You can check if you have it with phpinfo or with

php -r '$all = get_loaded_extensions(); foreach($all as $i) { $ext = new ReflectionExtension($i); $ver = $ext->getVersion(); echo "$i - $ver" . PHP_EOL;}' | grep intl

I also added a new date/time option to disable any conversion. If you select that, there should be no need for IntlDateFormatter which can be useful until you fix the problem.

MarkArgent commented 1 year ago

Thank you --- I'll try this tomorrow

MarkArgent commented 1 year ago

Thank you. Installing php-intl on my local machine turned out to be rather a pantomine, but has solved the problem.

herrvigg commented 1 year ago

Added a new check and give a more comprehensible error message to the admin to change the option. It will continue to work with the error as if WP date was selected. The error remains until the admin changes the option explicitly or installs the Intl PHP extension.

herrvigg commented 1 year ago

Released in 3.13.0.