Allow configuration options for the prefix pattern

Created on 8 November 2024, 13 days ago

Problem/Motivation

At the moment this module's language-country-url negotiation method hard-codes an expectation that url prefixes will be of the form /LANGCODE-COUNTRYCODE/. The COUNTRYCODE part takes its value from the country_code base field on the respective lcn_country entity. The LANGCODE part takes its value from the core's language-url negotiation method configuration.

The latter is confusing because, in the admin UI, language-url appears to be an unrelated negotiation method. Moreover, a site builder may wish to use multiple negotiation methods in a fallback arrangement, and LCN currently prevents the possibility of configuring language-url differently to language-country-url, which seems a shame.

Proposed resolution

  1. Duplicate the Path prefix configuration section from language-url to language-country-url so LCM holds the equivalent config for customising the language prefixes but under its own namespace (call it Language path prefix configuration). These should default to the language codes, but are available for customisation.
  2. Add a similar Country path prefix configuration section. These should default to their country codes, but are available for customisation.
  3. Keep the current behaviour of using prefixes of the form /LANGCODE-COUNTRYCODE/ (but honour the above configuration so each part may be customized within the negotiation method). I suppose this format could be exposed as configuration--a simple string with tokens in (e.g. :language-:country), but that feels like overkill--this is a standard format for regional language variations.
  4. Extra fun: introduce configuration to allow a custom prefix to be optionally specified for any language-country pair. Its hard to imagine a use case that isn't covered by this degree of flexibility. Rather than having a textfield for every language-country permutation, could use the same kind of form structure as e.g. core option's "Add another item" table-y interface
Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom jamsilver West Midlands, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024