1

I get access denied for just the translation page of a config form. I can access the configuration form and update it. No problem there. The form lists in config-translation page as well, but when I click on Translate it gives access denied. I'm logged in as Admin. Below is the code as suggested here in my custom module (samplewil.module).

samplewil.links.menu.yml

samplewil.set_admin:
  title: 'sample settings'
  parent: system.admin_config_system
  description: 'Configure sample settings'
  weight: -10
  route_name: samplewil.set_admin

samplewil.routing.yml

samplewil.set_admin:
  path: '/admin/config/sample-settings'
  defaults:
    _form: '\Drupal\samplewil\Form\SampleForm'
    _title: 'Sample'
  requirements:
    _permission: 'administer site configuration'

samplewil.settings.yml

message: 'Hello'
 langcode: 'ar'

samplewil.config_translation.yml

samplewil.set_admin:
  title: 'Example Translatable config'
  base_route_name: samplewil.set_admin
  names:
    - samplewil.config

samplewil.schema.yml

samplewil.config:
  type: config_object
  label: 'Example config'
  mapping:
    message:
      type: text
      label: 'Message'

My default language is Arabic and I've given 'ar' in settings.yml. Any idea why I'm not able to translate?

1

Got it finally working. The 'name' array in config_translation was not matching with the actual file.

samplewil.settings.yml file should be renamed to samplewil.config.yml :)

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.