class HTTP::Accept::Language

Defined in:

http/accept/language.cr

Constant Summary

LANGUAGE = /(?<language>#{LANGUAGE_RANGE})(#{WEIGHT})?/
LANGUAGE_ACCEPT = /#{LANGUAGE},?/
LANGUAGE_RANGE = /(?<locale>[a-zA-Z]{1,8}|\*)(-([a-zA-Z0-9]{1,8}|\*))*/

https://tools.ietf.org/html/rfc4647#section-2.1

QVALUE = /0(\.[0-9]{0,3})?|1(\.0{0,3})/

https://tools.ietf.org/html/rfc7231#section-5.3.1

WEIGHT = /\s*;\s*q=(?<qvalue>#{QVALUE})/

https://tools.ietf.org/html/rfc7231#section-5.3.1

Class Method Summary

Class Method Detail

def self.best_locale(locales : Array(String), wanted_languages : Array(Value) | Nil, default_language = "en") : String #

[View source]
def self.parse(text : String) : Array(Value) #

[View source]