1

I have created a configuration object which looks like:

message: 'Here we go!'
langcode: en

And I've created a form which allows me to change that message. However, I am not entirely sure how to work with translations for this message.

Ideally, I would want to display fields for each language in my module settings. And how can I retrieve the translation for that message?

Currently I can grab that message using the following code, but I cannot figure out how it works with language translation, and how I could render a form for each language available.

  $config = \Drupal::config('my_module.settings');
  $message = $config->get('message');

How can I achieve what I am trying to do?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.