0

I have a custom module, already running for a longer while, but I did not take into account that the configuration would have to support translation. I have had no config/schema/module_name.schema.yml file at the time of installation.

I created the schema file, looked into implementing hook_update(). I was just about to start implementing it, but I checked the output of \Drupal::service('config.typed')->getDefinition(DrupalHooks::CONFIG_KEY); just in case. The schema file was automagically absorbed by either drush cr, or loaded by the code snippet itself.

I don't find my module listed on the admin/config/regional/config-translation page. Also, the other modules shown in that list seem to always have a Translate tab on their configuration page. My module doesn't get that either.

What am I supposed to do to make it translatable? Is there any hook I should implement, or am I missing something else?

  • 3
    This is my experience too, a new schema file is discovered by clearing the cache. Are you sure this is really the issue? What happens if you re-install the module or install it on a fresh site, is it working then? – 4k4 Oct 3 at 13:49
1

To have the "Translate" tab listed on your module's configuration page you additionally need to provide a module_name.config_translation.yml in your module's root.

module_name.settings:
  title: 'Module Name'
  base_route_name: module_name.admin_settings
  names:
    - module_name.settings

Look for existing module_name.config_translation.yml file in core and contrib and you'll get the pattern no problem.

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.