Locale Switcher Element ❺πŸ§ͺ

Goals

  • Provide for attributes-based locale-switching

  • Information access for scripts

  • ? Conditional-vis based on locale

Tech

  • Use the locale switcher element, which can be hidden

  • Use it to inventory locales, and to switch the locale

    • Useful as it already contains the alt pages for localized links

API

  • Get Locales List, e.g. en, es, zh, ar

  • Get Locales URL's

  • Identify current Locale

  • Switch Locale

Note

  • Likely the Locale Switcher does not need to be tagged, but it must exist on the page. It's already easily identified, and any intact Locale Switcher will work fine as the controller target.

Usage Notes

This would be built into Element Actions

wfu-action = switchLocale

wfu-action-item = ( locale code )

e.g. en

wfu-action-trigger = click, always

wfu-action-target = unnecessary

Command Line Interface ( CLI )

CONCEPTUAL. We're experimenting with CLI for config support and debugging.

In the console;

sa5.locales

Controller

Target

The locale switcher

Does not need to be tagged

On elements which

wfu-action = ( method )

Required. I want my button or link to perform the following action on the targeted deck element.

Method is one of;

  • first - select the first item

  • prev - select the previous item

    • prevLoop - select the previous item or loop if we're on the first item ( considering )

  • next - select the next item

    • nextLoop - select the next item or loop if we're on the last item ( considering )

  • last - select the last item

  • goto - select the specified item, as specified by wfu-deck-action-item

wfu-action-target = LOCALE-SWITCHER

Optional. Specifies the wfu-tabs, wfu-slider or wfu-accordion name you want your action to target.

If unspecified, it will look for the nearest parent deck element as the target.

wfu-deck-action-item = ( item number | name )

Required for the goto action only. Specifies the tab / slide you want to navigate to.

  • a number - indicates the item number, 1, 2, 3...

  • a string - activates the item with the specified name

Last updated