Problem/Motivation
The module was written for a site with two languages and encoded them literally: the node redirect was found stripping the literal /uk/ and /ru/ prefixes, and onRedirectToDefaultLanguage() still cuts three characters off the request URI on the assumption that a prefix is two letters plus a slash. The locales block, the alias resolution and the fallback to a legacy language carry the same assumption in different forms. A site with one language, with five, with a prefix that is not two characters, or with language negotiation by domain rather than by path, gets wrong URLs rather than an error.
Proposed resolution
- Ask the language manager and the negotiation configuration for prefixes and for the default language, everywhere, and never compute a prefix by string length.
- Support domain negotiation as well as path prefixes, because a site that uses it currently gets prefixes invented for it.
- A monolingual site returns no
localeskey rather than an array of one entry pointing at itself. - The legacy-language alias fallback becomes a configured option rather than a literal, or goes away — it exists for one site's pre-translation aliases.
- Functional coverage on one, two and three languages, and on a prefix that is not two characters.
Remaining tasks
Everything.
Issue fork myrest-3621333
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sergeydruua commentedComment #6
sergeydruua commented