wordpress-playground icon indicating copy to clipboard operation
wordpress-playground copied to clipboard

PHP intl extension

Open tsp-user opened this issue 1 year ago • 4 comments

Can you include the PHP intl extension in the kitchen-sink phpExtensionBundles for the playground?

tsp-user avatar Apr 23 '24 01:04 tsp-user

Not sure if this is helpful but in our theme we are about to wrap the call to intl to check if the library exists as a workaround to get our theme working in playground.

https://github.com/amnestywebsite/humanity-theme/pull/268/files

https://github.com/amnestywebsite/humanity-blueprint/

Good luck with your blueprint :-)

AmnestyAM avatar Jul 02 '24 10:07 AmnestyAM

Blueprint example to demonstrate calling the missing intl functions

GitHub keeps URI encoding additional characters in the example link, and Playground is not properly consuming it. Here's the link that works. Just copy and paste in the browser.

https://playground.wordpress.net/#{%22preferredVersions%22:{%22php%22:%228.0%22,%22wp%22:%22latest%22},%22phpExtensionBundles%22:[%22kitchen-sink%22],%22features%22:{},%22landingPage%22:%22/%22,%22steps%22:[{%22step%22:%22writeFile%22,%22path%22:%22/wordpress/wp-content/mu-plugins/error.php%22,%22data%22:%22%3C?php%20$coll%20%20=%20collator_create(\%22en_US\%22);%20$result%20=%20collator_compare($coll,%20\%22string#1\%22,%20\%22string#2\%22);%20error_log(print_r($result),%20true);%22}]}

brandonpayton avatar Jul 23 '24 20:07 brandonpayton

Or you can base64 encode the Blueprint in the URL:

https://playground.wordpress.net/#eyJwcmVmZXJyZWRWZXJzaW9ucyI6eyJwaHAiOiI4LjAiLCJ3cCI6ImxhdGVzdCJ9LCJwaHBFeHRlbnNpb25CdW5kbGVzIjpbImtpdGNoZW4tc2luayJdLCJmZWF0dXJlcyI6e30sImxhbmRpbmdQYWdlIjoiLyIsInN0ZXBzIjpbeyJzdGVwIjoid3JpdGVGaWxlIiwicGF0aCI6Ii93b3JkcHJlc3Mvd3AtY29udGVudC9tdS1wbHVnaW5zL2Vycm9yLnBocCIsImRhdGEiOiI8P3BocCAkY29sbCAgPSBjb2xsYXRvcl9jcmVhdGUoXCJlbl9VU1wiKTsgJHJlc3VsdCA9IGNvbGxhdG9yX2NvbXBhcmUoJGNvbGwsIFwic3RyaW5nIzFcIiwgXCJzdHJpbmcjMlwiKTsgZXJyb3JfbG9nKHByaW50X3IoJHJlc3VsdCksIHRydWUpOyJ9XX0=

And then it fits nicely into a markdown link.

adamziel avatar Jul 31 '24 11:07 adamziel