Custom module for adding a userrole after registration

Normally I’d do this with Rules, but the Drupal 8 version is not really usable through the UI at the moment; so I decided to try this with a custom module “add_userrole”, consisting of 2 files.

name: Add Userrole
type: module
description: Add the correct userrole after saving a new user
package: Custom
core: 8.x


function add_userrole_user_presave(UserInterface $user) {
  $rol = $user->get('field_userrole')->value;
  if ($user->isNew()) {
    if ($rol == 'model') {
    if ($rol == 'fotograaf') {
    if ($rol == 'stylist') {
    if ($rol == 'modellenbureau') {
    if ($rol == 'videograaf') {

After enabling the module, I get an error about config translations. Although my default language isn’t English, I find this strange because I’ve read that the info.yml file needs to contain the following code in order to take into account config translations, which is not the case in my info.yml file:

interface translation project
interface translation server pattern

Why do I get this error?

Drupal version: