• 99w

    (@ninetyninew)


    Hi,

    For custom JS files we enqueue we usually include const { __, _x, _n, _nx } = wp.i18n; and add in translatable strings in the JS.

    We’ve since found the wp_set_script_translations function but there isn’t much information around on when it should be used, we only came across the use of this while looking at some example code for server side implementation of a WooCommerce Checkout block payment method, and most information online using wp_set_script_translations seems to be coming from block related functionality, rather than enqueuing of non-block based JS.

    Should this function be used when you have a JS file that enqueues wp-i18n and uses const { __, _x, _n, _nx } = wp.i18n; ?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘When to use wp_set_script_translations?’ is closed to new replies.