Home > widget-integration > FilterRender > buildUrlWithLocalization

FilterRender.buildUrlWithLocalization() method

Builds a URL with a localization prefix when necessary.

Detects a 2-letter ISO locale code (e.g., fr, de) from the current pathname and prepends it to the given path. English (en) is excluded because Shopify typically omits it from URLs.

Signature:

protected buildUrlWithLocalization(path: string): string;

Parameters

Parameter

Type

Description

path

string

The path to prefix (e.g., "collections/new-arrivals")

Returns:

string

The full path with optional locale prefix (e.g., "/fr/collections/new-arrivals")