LocalizeMenu

Localize menus so that they reflect the user's current region

Source:
Properties:
Name Type Description
localizeLinkSelector string

targets link elements that need to be localized

localizeTextSelector string

targets text elements that need to be localized

highlightSelector string

targets region lists so we can select the current region

currentRegionClass string

the class to apply to the current region in a region list

Methods

(inner) highlightCurrentRegion(regionNAme)

Source:

Scans list for element where text == current region, adds class to highlight

Parameters:
Name Type Description
regionNAme string

parsed region name (e.g. New Brunswick)

(inner) init()

Source:

Parses region value and passes it along to localization functions

Source:

Updates link url of any element with a data-localize-link attribute to region homepage. The data-localize-link attribute must have the homepage url as its value.

Parameters:
Name Type Description
regionSlug string

parsed region slug (e.g. new-brunswick)

(inner) localizeText(regionName)

Source:

Updates text of any element with a data-localize-text attribute to current region

Parameters:
Name Type Description
regionName string

parsed region name (e.g. New Brunswick)