Parse variant in locale string only if necessary

Before this change logic for parsing locale string would look for
variant even when it's clear that local string doesn't have variant
part.

With this patch locale string parsing is improved so that variant
processing gets skipped when not necessary.

Issue: SPR-10364