How do I fetch translated strings? I have a progressively decoupled Reactjs application running on top of Drupal. Its a multilingual application.

I need to fetch the translated strings from the Drupal itself and handle the translations editor and everything in Drupal itself, rather than maintaining a separate translation system for react.

How is it possible? A simple Drupal.t() doesn't work. I checked.

Any examples I can refer?
Drupal.t() works in this case. Have to to compile the javascript and clear the Drupal cache in order for strings to appear.

For props way:

On get_sample_props():

function getsampleprops() {
  return ['sampleval' =&gt; t('Hello World!!!')];
}


On the controller,

$build = [
  '#theme' =&gt; 'sample_react',
  '#props' =&gt; json_encode($this-&gt;get_sample_props()),
];


On the template, I did:

&lt;div data-component="Sample" data-prop-labels='{{props|raw}}'&gt;&lt;/div&gt;


On the React side, I used

$val = this.props.labels.sampleval;


Volia, its done. Its bit inconvenient, but work gets done.