function isStructurallyValidLanguageTag(locale) {
    if (!languageTagRE.test(locale)) {
      return false;
    }
    locale = locale.split(/-x-/)[0];
    return !duplicateSingletonRE.test(locale) && !duplicateVariantRE.test(locale);
  }
Verifies that the given string is a well-formed Unicode BCP 47 Locale Identifier
with no duplicate variant or singleton subtags.

Spec: ECMAScript Internationalization API Specification, draft, 6.2.2.