How to load Javascript translation through Ajax request
-
Hi,
I want to load how can I load JS translation through Ajax request. I am using REST API to fetch post with ajax, and I have manually added load_theme_textdomain() to the request to fetch PHP translation.
I tried to do the same to fetch Javascript translation, but it doesn’t work. Is this possible?
My current code:
function ajax_load_script_textdomain(){ load_script_textdomain('CUSTOM-block-ref-holder', 'custom-blocks', plugin_dir_path(__FILE__) . 'languages'); } add_action('init', 'ajax_load_script_textdomain'); add_action('rest_api_init', 'ajax_load_script_textdomain');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to load Javascript translation through Ajax request’ is closed to new replies.