Reimplementation of locale extraction from URLs

New 100% PHP-based implementation of the extraction of a (valid) locale
from a Quearl URL.