After spending extensive time reading over BCP 47 and the respective RFCs that are related I believe we have a small error in our core grammar that prevents BCP 47 and specifically RFC4647 from working correctly for :lang().
Since :lang() is doing matching against language identifiers the match logic should follow what BCP47 expects for matching. This matching is covered by the RFC4647. The CSS specs assume that matching is covered in these RFCs: RFC5446, RFC4646 or RFC3066, it is not. The :lang() is not identifying languages it is matching language identifiers and thus RFC46474 is relevant.
Here is the specific part of the core grammar that is incorrect:
Appendix G
pseudo
: ':' [ IDENT | FUNCTION S* [IDENT S*]? ')' ]
Needs to be changed to something like this:
pseudo
: ':' [ IDENT | FUNCTION S* [ \*? IDENT S*]? ')' ]
At this point we might not be able to edit in for Selectors Level 3 but we should at least add this to the errata and make the correction in Selectors Level 4. The errata for CSS 2.1 should also get this update as well.
--
Thanks,
Arron Eicholz