Overview

Larapen provides several localization settings that control how your website handles multiple languages, visitor language detection, and URL behavior. These settings are found under Settings → General in the Localization section.

Available settings

Remove Default Locale Prefix

LocationSettings → General → Localization
OptionsEnabled / Disabled
DefaultDisabled

Controls whether the default language's code appears in URLs:

  • Enabled (recommended): The default language uses clean URLs without a prefix. Example: /about instead of /en/about. Other languages still use their prefix (e.g., /fr/a-propos).
  • Disabled: All languages, including the default, show their code in URLs. Example: /en/about and /fr/a-propos.
SEO Tip: Enabling this option is recommended for SEO, as it produces cleaner URLs for the primary version of your site. Search engines will see /about as the canonical URL and /fr/a-propos as the French alternate.

Auto-Detect Language

LocationSettings → General → Localization
OptionsDisabled / Browser Language / Country Language
DefaultDisabled

Controls whether Larapen automatically detects and redirects visitors to their preferred language on their first visit:

Disabled

No automatic detection. All visitors see the default language unless they manually switch using the language selector or navigate to a URL with a language prefix.

Browser Language

Detects the visitor's preferred language from their browser settings (the Accept-Language HTTP header). For example, if a visitor's browser is set to French, they will be automatically redirected to the French version of the site.

How it works:

  • Reads the browser's language preferences (sorted by priority).
  • Matches against your active languages.
  • Redirects to the best match on the first visit.
  • The detection runs only once per session: subsequent page views use the session preference.

Country Language

Detects the visitor's geographic location using GeoIP (IP-to-country lookup) and redirects them to the language spoken in their country.

How it works:

  • Determines the visitor's country from their IP address.
  • Looks up the primary language spoken in that country.
  • If the spoken language matches one of your active languages, the visitor is redirected.
  • The country detection is cached in a cookie for 30 days to avoid repeated GeoIP lookups.
Note: The "Country Language" option requires a configured GeoIP driver. Go to Settings → GeoIP to select a provider and enter API credentials if needed. The default ip-api.com driver works without an API key but has rate limits.

Spoken Languages Mode

LocationSettings → General → Localization
OptionsDisabled / Active Only / Active + English / Active + Default
DefaultDisabled

Controls which languages appear in the front-end language switcher. This is useful if you have many active languages but only want to show a subset based on the visitor's country:

Disabled

All active languages are shown in the language switcher. This is the standard behavior.

Active Only

Only shows languages that are spoken in the default country (configured in Settings → General → Localization → Default Country). For example, if your default country is Belgium, only Dutch, French, and German would be shown.

Active + English

Shows languages spoken in the default country plus English (if English is active). Useful for international sites where English is always offered.

Active + Default

Shows languages spoken in the default country plus the default language. Ensures the site's primary language is always accessible in the switcher.

Note: For most websites, leave this setting on "Disabled" to show all active languages. The filtering modes are intended for large multilingual deployments targeting specific geographic regions.

Default Country

LocationSettings → General → Localization
FormatISO 3166-1 alpha-2 country code (e.g., US, FR, BE)
DefaultEmpty

The default country is used by:

  • The Spoken Languages Mode to determine which country's languages to show.
  • The Country Language auto-detection as a fallback when GeoIP detection is unavailable.

GeoIP settings (for Country Language detection)

If you use the "Country Language" auto-detection mode, you need to configure a GeoIP driver to resolve visitor IP addresses to their country. Go to Settings → GeoIP and choose from the available drivers:

DriverAPI Key Required
ip-api.com (default)No
ipapi.coNo
ipinfo.ioYes (token)
DB-IPOptional
ipbase.comYes
IP2LocationYes
ipgeolocation.ioYes
iplocation.netOptional
ipstack.comYes
MaxMind Web ServiceYes
MaxMind Database (offline)License key for updates
Note: For the MaxMind Database (offline) driver, you need to download GeoLite2-City.mmdb (not GeoLite2-Country) and place it at /storage/database/maxmind/GeoLite2-City.mmdb. This driver is recommended for production and high-traffic sites as it does not require external API calls.

Recommended configurations

Simple bilingual site (e.g., English + French)

SettingValue
Remove Default Locale PrefixEnabled
Auto-Detect LanguageBrowser Language
Spoken Languages ModeDisabled

International multi-language site

SettingValue
Remove Default Locale PrefixEnabled
Auto-Detect LanguageBrowser Language
Spoken Languages ModeDisabled

Country-targeted site (e.g., Belgium)

SettingValue
Remove Default Locale PrefixEnabled
Auto-Detect LanguageCountry Language
Spoken Languages ModeActive + English
Default CountryBE

Single language site

SettingValue
Remove Default Locale PrefixEnabled
Auto-Detect LanguageDisabled
Spoken Languages ModeDisabled

With only one active language, no language switcher is displayed and no prefixes are added to URLs.

Was this article helpful?

Thank you for your feedback!

Still need help? Create a support ticket

Create a Ticket