Answers.Body: <p><strong>Edit:</strong> <a href="https://github.com/vaersaagod/geomate/blob/master/CHANGELOG.md#210---2022-10-04" rel="nofollow noreferrer">GeoMate v. 2.1.0</a> has been released, which should fix the issue described.</p>
  <p><em>Original answer:</em></p>
  <p>This is likely due to GeoMate not finding a valid geolocation database. You can verify that by visiting the GeoMate utility inside the Craft control panel's Utilities section, and fix it by downloading the (free) GeoIP2 databases as per the <a href="https://github.com/vaersaagod/geomate#downloading-the-geolocation-database" rel="nofollow noreferrer">plugin docs</a>.</p>
  <p>Note: As IP lookups are not relevant when redirecting based on browser language, technically there is no reason for GeoMate requiring a geolocation database in such cases. We'll look into changing that for an upcoming GeoMate release: <a href="https://github.com/vaersaagod/geomate/issues/53" rel="nofollow noreferrer">#53</a></p>
  <p>Note 2: The fact that an exception is thrown in this case, instead of GeoMate simply logging the error and failing gracefully, is due to a bug: <a href="https://github.com/vaersaagod/geomate/issues/52" rel="nofollow noreferrer">#52</a></p>
  <p>Note 3: This isn't relevant to the issue, but when you've configured the <code>redirectMapSimpleModeKey</code>, specifying <code>'language'</code> inside the <code>redirectMap</code> as well is technically redundant. So your GeoMate config could be simplified a bit:</p>
  <pre class="lang-php prettyprint-override"><code>
  &lt;?php
  
  return [
      '*' =&gt; [
          'autoRedirectEnabled' =&gt; true,
  
          'redirectMapSimpleModeKey' =&gt; 'language',
          
          'redirectMap' =&gt; [
              'siteHandleDe' =&gt; 'de',
              'siteHandleFr' =&gt; 'fr',
          ]
      ],
  ];
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-04T12:09:10.150Z
Answers.LastActivityDate: 2022-11-04T22:55:34.713Z
Answers.LastEditDate: 2022-11-04T22:55:34.713Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I am using GeoMate to redirect users to their browser language. I built my config/geomate.php according to the doc:</p>
  <pre><code>&lt;?php
  
  return [
      '*' =&gt; [
          'autoRedirectEnabled' =&gt; true,
  
          'redirectMapSimpleModeKey' =&gt; 'language',
          
          'redirectMap' =&gt; [
              'siteHandleDe' =&gt; [
                  'language' =&gt; 'de',
              ],
              'siteHandleFr' =&gt; [
                  'language' =&gt; 'fr',
              ],
          ]
      ],
  ];
  </code></pre>
  <p>With this code i get the following error. I can't seem to figure out where I did something wrong. Since my <code>redirectMapSimpleModeKey</code> is set to <code>language</code> I do not get why the error calls for a country. What am I missing?</p>
  <pre><code>vaersaagod\geomate\services\RedirectService::getSiteFromInfoAndMap(): Argument #1 ($countryInfo) must be of type GeoIp2\Model\City|GeoIp2\Model\Country, null given
  </code></pre>
  
Tags: <localization><language><geo>
Title: GeoMate error when redirecting to browser language
ThreadText: # GeoMate error when redirecting to browser language
  
  (Asked by: username_0 on 2022-11-04)
  
  I am using GeoMate to redirect users to their browser language. I built my config/geomate.php according to the doc:
  
  ```
  <?php
  
  return [
      '*' => [
          'autoRedirectEnabled' => true,
  
          'redirectMapSimpleModeKey' => 'language',
          
          'redirectMap' => [
              'siteHandleDe' => [
                  'language' => 'de',
              ],
              'siteHandleFr' => [
                  'language' => 'fr',
              ],
          ]
      ],
  ];
  
  ```
  
  With this code i get the following error. I can't seem to figure out where I did something wrong. Since my `redirectMapSimpleModeKey` is set to `language` I do not get why the error calls for a country. What am I missing?
  
  ```
  vaersaagod\geomate\services\RedirectService::getSiteFromInfoAndMap(): Argument #1 ($countryInfo) must be of type GeoIp2\Model\City|GeoIp2\Model\Country, null given
  
  ```
  
  **Tags:** localization, language, geo
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-11-04. Score: 1
  
  **Edit:** [GeoMate v. 2.1.0](https://github.com/vaersaagod/geomate/blob/master/CHANGELOG.md#210---2022-10-04) has been released, which should fix the issue described.
  
  *Original answer:*
  
  This is likely due to GeoMate not finding a valid geolocation database. You can verify that by visiting the GeoMate utility inside the Craft control panel's Utilities section, and fix it by downloading the (free) GeoIP2 databases as per the [plugin docs](https://github.com/vaersaagod/geomate#downloading-the-geolocation-database).
  
  Note: As IP lookups are not relevant when redirecting based on browser language, technically there is no reason for GeoMate requiring a geolocation database in such cases. We'll look into changing that for an upcoming GeoMate release: [#53](https://github.com/vaersaagod/geomate/issues/53)
  
  Note 2: The fact that an exception is thrown in this case, instead of GeoMate simply logging the error and failing gracefully, is due to a bug: [#52](https://github.com/vaersaagod/geomate/issues/52)
  
  Note 3: This isn't relevant to the issue, but when you've configured the `redirectMapSimpleModeKey`, specifying `'language'` inside the `redirectMap` as well is technically redundant. So your GeoMate config could be simplified a bit:
  
  ```php
  
  <?php
  
  return [
      '*' => [
          'autoRedirectEnabled' => true,
  
          'redirectMapSimpleModeKey' => 'language',
          
          'redirectMap' => [
              'siteHandleDe' => 'de',
              'siteHandleFr' => 'fr',
          ]
      ],
  ];
  
  ```
  
  
  ---
  
  