I’m trying to implode an array of values that are wrapped in a i18n function as shown here:
<?php echo implode( ', ', __($joblanguages, 'my-text-domain') ); ?>
I’m getting the following error message:
Warning: Illegal offset type in isset or empty in /Applications/XAMPP/xamppfiles/htdocs/vemas-2012/wp-includes/pomo/translations.php on line 72
Is there any way to fix this and get the values in the chosen language?
Thanks in advance!
I think the function you need is
array_map().Your problem is that WP’s
__()function wants a single string to translate, whereas you want to translate a whole bunch of strings all at once.array_map()will do this for you. Something like this should do the trick:Hope that helps.