1

I'm trying to figure out how to set the default language for new users and user activation emails. I have found the defaultCPLanguage config setting which does indeed change the default language of new accounts created through the backend. However, the activation email doesn't use that default language. Based on testing I have determined that the account activation email will be sent in the language that the user creating the new account has set in their account preferences. So if I create a new user account with my admin account, which is set to English, the activation email will be in English as well. If I set my language preference to German, the activation mail will be in German.

Is there a way to change this? The CP doesn't provide a way to change the language preference of a new account. I would prefer it if the activation mail always used the language set as defaultCpLanguage.

Edit: The following is a confirmed bug and will be fixed in the next release!

As a sidenote, the templates for account emails are editable from Utilities -> System Messages. However, I can only edit those templates for my current language preference. To edit the messages in a different language, I have to set my account preference to that language first. This is weird and unintuitive. Is there a better way to edit System Messages across different languages? Or at least have the System Messages tab always display the messages in the defaultCpLanguage?

2

When using a frontend form to create a new user it is actually straight forward, because you can easily send a preferredLanguage attribute with the request that sets the language on creation (see this line in the user controller). However, if you want to use the CP form to create a user, there doesn't seem to be an out of the box solution for your problem. Here is what you could try:

There is a template hook in the user edit template. You could use this to inject an input that sets the preferred language. You could even show that input for new users only. In the simplest case it could look something like this:

<input type="text" name="preferredLanguage" value="de">

You surely would want to have a select or something with the available languages. To inject the markup into that template you would have to create a module or plugin and then follow the docs for template hooks.

PS: If you wonder where the user language is stored, it has an extra table called userpreferences storing stuff like this in JSON format.

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.