akoenig/express-lingua — pull request #4 by homme (2011-10-20 15:44:29+00:00)
Title: Make Lingua fully aware of the 'Accept-Language' header

This is a fix for issue #3. It means that Lingua now matches the best
available language tag in the Accept-Language header to a
resource. Previously only the first language tag in the header was
chosen as a locale.

In addition the subtagQvalue option to lingua has been added, with a
value range from 0 to 1 and defaulting to 0.1. If subtagQvalue is
non-zero then the primary subtag in a language tag is also extracted
and matched against a resource. In the language tag 'en-us' the
primary subtag is 'en'.

This change involved:

- creating code to extract and order the language tags and subtags
based on qvalues.

- enhancing the guru.determines() method to return an ordered list of
acceptable locales rather than a single locale.

- enhancing guru.ask() to take a list of locales rather than a single
locale and try to a match a value in the list to a resource.