2

I am new to Drupal 8 Custom Translation. I am working on a custom module with a backend form from where user can add some textual inputs.

The Site is multilingual, so I need to have this backend form translatable.

May I know the steps or any links from where I can get an idea where to start for translatable configuration form/page where user can add textual inputs for each languages.

Thanks in advance.

4

You need a schema yaml file in the module folder /config/schema to make configuration forms translatable:

What are schema files used for?

  1. The primary use case schema files were introduced for is multilingual support. We need to have a tool to identify all translatable strings in your shipped configuration so when you ship with your own settings as well as default Views, additional user roles, menu items, etc. we can offer those up for translation as part of your module/theme release on http://localize.drupal.org. The nesting levels and types would be enough for this use case.
  2. We also use schemas to provide actual translation forms for configuration based on your data. This use case is where types gain more importance and labels become crucial. The core Configuration translation module uses schemas to generate translation forms and save translations. The two most important built-in translatable types are 'label' for one-line text input and 'text' for multiline text input.

Source: https://www.drupal.org/node/1905070

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.