translation in functions.php
-
Hi, I already asked this question in a plugin forum but it seems that the problem is more of wordpress nature.
You can re-read it here: https://www.ads-software.com/support/topic/no-functionality-in-functionsphp?replies=3#post-6748729
——————————–
I am trying to use _e() or __() for text translations inside the functions.php. For example for the wp_localize_script(). But I am not getting any translated strings. wp_localize_script() returns undefined in my linked script and custom functions return only the source text, not the translated one. When I hardcode strings there, they will be returned correctly.
wp_enqueue_script( 'my-script', get_template_directory_uri() . '/js/script.js', array( 'jquery' ), null, true ); wp_localize_script('my-script', 'translate', array( 'not_required' => __('not required', 'bla') ));
What am I doing wrong?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘translation in functions.php’ is closed to new replies.