<p>I built my site switcher like this:</p>

<p><a href="https://www.thebasement.be/language-switcher-for-craft-3/" rel="nofollow noreferrer">https://www.thebasement.be/language-switcher-for-craft-3/</a></p>

<p>You will have to define an array for your site variables in the general.php for each environment:</p>

<pre><code>'siteUrl' =&gt; array(
  'default' =&gt; 'http://yoururl/',
  'english' =&gt; 'http://yoururl/en/',
 ),
</code></pre>

<p>You can also extend the user with a language field and let him save his preferred language with a simple form like the user profile form from the Craft 3 docs.</p>

CC BY-SA 4.0
2020-02-09T21:23:29.693Z
2020-02-10T06:24:39.363Z
2020-02-10T06:24:39.363Z
Rainer
<p>If I'm logged in as a user in user Group A, how can I tell which site I am currently viewing?</p>

<p>I want to be able to create a multilingual site switcher. But my setup is complex.</p>

<p>I have Company A, User A is in  Group A</p>

<p>Company A Russian, User A is in Group A</p>

<p>Company A Hindi, User A is in Group A</p>

<p>I want to be able to let the user choose the Russian version of the current content. Same for Company B User B in Group B, etc. etc.</p>

<users><localization><multi-site><sites>
Identifying users and site permissions when logged in
# Identifying users and site permissions when logged in

(Asked by: username_0 on 2020-02-08)

If I'm logged in as a user in user Group A, how can I tell which site I am currently viewing?

I want to be able to create a multilingual site switcher. But my setup is complex.

I have Company A, User A is in Group A

Company A Russian, User A is in Group A

Company A Hindi, User A is in Group A

I want to be able to let the user choose the Russian version of the current content. Same for Company B User B in Group B, etc. etc.

**Tags:** users, localization, multi-site, sites


---

## 1 answers

### Answer by username_1 on 2020-02-09. Score: 1

I built my site switcher like this:
https://www.thebasement.be/language-switcher-for-craft-3/
You will have to define an array for your site variables in the general.php for each environment:
'siteUrl' => array(
  'default' => 'http://yoururl/',
  'english' => 'http://yoururl/en/',
 ),

You can also extend the user with a language field and let him save his preferred language with a simple form like the user profile form from the Craft 3 docs.


---

