1

We have a site with multiple languages so I created a site for each language. I named these according to the language so, one is named "French", another "English" etc.

Now in the backend this is all fine, when creating entries its clear what the language is you are working in.

I soon noticed these are also used in the front-end and that creates some problems. The site name in a template is easily override by adding something like {% set siteName = getenv('SITE_NAME') %}.

But harder to fix are for example the mails send out when creating a account, they now say something like "Thank you for creating an account on English!"

I tried a fix by setting the same site name in the config/general.php, this works, but now all the sites in the site switcher in the backend are the same. So not really a good fix.

Having to set a different name for each site is kinda weird, in most cases the brand name is the same in every language. Google is Google no matter the language.

Anyone who knows a decent way to handle this?

  • We always handle it a little bit differently. When you are in such a situation use the site group in emails and in our frontend as the identifier of the site. Would that be an option for you? So the site name is just French but we never reveal that in our frontend, we always show the site group name {{ site.group.name }} -> My Awesome Site and {{ site.name }} -> French – Robin Schambach Feb 26 at 8:46
  • Using the group name is a good idea. But how do is use this in auto generated mails like the account activation mail? – dazz Feb 26 at 9:05
  • You can just change the template – Robin Schambach Feb 26 at 9:39
1

I ended up using the suggestion of Robin Schambach, in front-end templates using the {{ site.group.name }}

E-mail contents can be changed in the admin section, using {{currentSite.group.name}}

Craft 2:

settings -> email -> Messages

Craft 3.0:

settings -> email -> Messages

Craft 3.1:

Utilities -> System Messages

  • There is a template for the body of an email. You can change those however you like. Depending on your Craft version those live in tools -> systemmessages or settings -> email -> systemmessages – Robin Schambach Feb 26 at 10:18
  • That's even easier, have been looking for that but never thought to find it under Utilities. – dazz Feb 27 at 12:19

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.