mmarkdown / mmark

Mmark: a powerful markdown processor in Go geared towards the IETF
https://mmark.miek.nl
Other
480 stars 45 forks source link

Case-insensitive lang lookup for BCP 47 conformance #87

Closed 747 closed 5 years ago

747 commented 5 years ago

Language tags are described to be case-insensitive in BCP 47.

2.1.1. Formatting of Language Tags

At all times, language tags and their subtags, including private use and extensions, are to be treated as case insensitive: there exist conventions for the capitalization of some of the subtags, but these MUST NOT be taken to carry meaning.

Thus, the tag "mn-Cyrl-MN" is not distinct from "MN-cYRL-mn" or "mN- cYrL-Mn" (or any other combination), and each of these variations conveys the same meaning: Mongolian written in the Cyrillic script as used in Mongolia.

So we have to normalize the casing in order to be conformant to BCP 47. One of the easiest ways is to convert the input to the lower case, I believe.