Story 1.4.2 Region & Language Auto-Detection (v2)

General info

This functionality defines which regional/language version of the SACLAB website should be shown to a user on their first visit. The system automatically detects the user’s country, browser language, forms the location and version, and may display a popup offering the user to switch to the recommended version.

When a user visits the website for the first time, the system automatically detects the country by IP, the browser language, determines the location, and calculates the site version. After that, the system forms a new URL based on these values. If the version changes, a popup may be shown offering the user to switch to the recommended version.

Location rules:

  • If country = “US” or “HK” → location = “US” or “HK”

  • If country is part of the EU → location = “EU”

  • If country is not part of the EU → location = “Global”

Version rules:

  • If country = “US” or “HK” → version = “US” or “HK”

  • If language = “en”, “de”, or “fr” → version = “en”, “de”, or “fr”

  • Else → version = “en”

URL rules:

User story

As a first-time visitor of the website

I want the system to automatically determine my location and preferred language and form the recommended version of the site

So that I can access the most relevant regional and language version of SACLAB.

Acceptance Criteria

Acceptance criteria

01

Scenario: Detect country and language
Given the user visits the site for the first time
When the system loads
Then the system must detect the user’s country by IP and browser language

02

Scenario: Determine location for US/HK
Given the detected country
When the country is “US” or “HK”
Then the location must be “US” or “HK” accordingly

03

Scenario: Determine EU location
Given the detected country
When the country is part of the EU
Then the location must be “EU”

04

Scenario: Determine Global location
Given the detected country
When the country is not in the EU and not US/HK
Then the location must be “Global”

05

Scenario: Determine version by country
Given the detected country,
When the country is “US” or “HK”
Then the version must be “US” or “HK”

06

Scenario: Determine version by language
Given the detected language
When the language is “en”, “de”, or “fr”
Then the version must match the detected language

07

Scenario: Default version
Given the user’s language is not supported
When the version is determined
Then the version must be set to “en”

08

Scenario: Form new URL
Given the current URL has no version prefix
When the system determines the version
Then the new URL must be formed as old URL + version

09

Scenario: Do not show popup for US/HK
Given the existing version is “US” or “HK”
When the system compares the old and new versions
Then the popup must not be shown

10

Scenario: Do not show popup if URL unchanged
Given the old URL equals the new URL
When the comparison is done
Then the popup must not be shown

11

Scenario: Show popup when version changes
Given the old URL differs from the new URL
When the system forms a new version
Then a popup must appear offering the user to switch to the recommended version

12

Given: User is accessing saclab.com/de/ (or EN or FR)
When: User’s IP address is US
Then: the system prompts the user to go to saclab.com/us/
A popup in German is shown

Scenario: Version Mismatch Based on Location and Language

Given:

  • The user is accessing a site version that does not match the version recommended for their detected location
    (for example, accessing any regional or language version different from the one mapped to their IP location)

  • And the user’s IP address maps to a specific region (e.g., US, HK)

When:

  • The system evaluates the user’s browser language

Then:

  • If the browser language matches a supported language version (e.g., German → /de/, French → /fr/),
    the popup must appear in that language, suggesting a switch to the version appropriate for the user’s location

  • Otherwise (if the browser language does not match or cannot be detected),
    the popup must appear in English, suggesting a switch to the version appropriate for the user’s location

image-20251110-091730.png

12.1

Example to scenario 12:

Given: User is accessing http://saclab.com/de/
When: User’s IP address is US

If User’s language is detected as German
Then: the system shows a popup in German prompting the user to go to http://saclab.com/us/

Else if user’s language is NOT german

Then: the system shows a popup in English prompting the user to go to http://saclab.com/us/

Given: User is accessing http://saclab.com/fr/
When: User’s IP address is HK

If User’s language is detected as French
Then: the system shows a popup in French prompting the user to go to http://saclab.com/hk/

Else if user’s language is NOT French

Then: the system shows a popup in English prompting the user to go to http://saclab.com/hk/

13

Given: User is accessing saclab.com/de/
When: The user’s IP address is HK
Then: the system prompts the user to go to saclab.com/hk/
A popup in German is shown

If User’s language is detected as German
Then: the system shows a popup in German prompting the user to go to http://saclab.com/hk/

Else if user’s language is NOT german

Then: the system shows a popup in English prompting the user to go to saclab.com/hk/

image-20251110-091855.png

14

Given: User is accessing saclab.com/us/ (or HK)
When: site version is the same US (or HK)
Then: the system does not suggest a redirect

15

Scenario: User Accessing a Different Language Version Than Their Browser Language

Given: User is accessing saclab.com/fr/ (or EN or DE)
When: The user’s IP address belongs to a EU and browser language DE
Then: the system prompts the user to go to saclab.com/de/ (EU location)
A popup in German is shown

Given:

  • The user is accessing a site version that does not match their detected browser language
    (for example, they are on saclab.com/fr/ while their browser’s language is German)

  • And the user’s browser language is one of the supported language (e.g English, french or German)

When:

  • The system detects the user’s browser language

Then:

  • The system must prompt the user to switch to the version that matches their browser language

  • The popup must be displayed in the user’s detected browser language

image-20251110-092828.png

15.1

Example Scenario 15

Given: User is accessing http://saclab.com/fr/
When: The user’s IP address belongs to a EU and browser language GERMAN
Then: the system shows a pop-up in GERMAN prompts the user to go to http://saclab.com/de/

Given: User is accessing http://saclab.com/fr/
When: The user’s IP address belongs to a EU and browser language is english
Then: the system shows a pop-up in ENGLISH prompts the user to go to http://saclab.com/

Given: User is accessing http://saclab.com/fr/
When: The user’s IP address belongs to a EU and browser language is French
Then: continues to saclab.com/fr/ without any popup

Given: User is accessing http://saclab.com/fr/
When: The user’s IP address belongs to a EU and browser language is none of the supported language, for example Dutch
Then: the system shows a pop-up in ENGLISH prompts the user to go to http://saclab.com/

Given: User is accessing http://saclab.com/fr/
When: The user’s IP address belongs to a non-EU and browser language is none of the supported language, for example Dutch
Then: the system shows a pop-up in ENGLISH prompts the user to go to http://saclab.com/

Given: User is accessing http://saclab.com/fr/
When: The user’s IP address belongs to a non-EU and browser language is German
Then: the system shows a pop-up in German prompts the user to go to http://saclab.com/de/

Given: User is accessing http://saclab.com/fr/
When: The user’s IP address belongs to a non-EU and browser language is FRENCH
Then: continues to http://saclab.com/fr / without any popup

16

Given: User is accessing saclab.com/ (or FR or DE)
When: The user’s IP address belongs to a non EU and browser language FR

Then: the system prompts the user to go to saclab.com/fr/ (Global location)
A popup in English is shown
Title: “We’ve detected a better version for you”
Subtitle: “We’ve found a version of our site that may be more relevant to your location or language.
Would you like to switch to this version?”
Redirect button: “Yes, take me there”
Cancel button: “Stay here“
The text is edited in the admin panel.

image-20251110-093057.png

Comments

Leave a Reply