Translating strings in JavaScript

Is there a common approach for handling i18n strings in JavaScript?
I have a few dynamic javascript components in a multilang sage theme.

There’s the default wp way, But I can’t see how it translates to sage, beyond updating sage/app/setup.php like this:

wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery', 'wp-i18n'], null, true);

This topic was automatically closed after 42 days. New replies are no longer allowed.