vibe.d beta banner
get vibe.d
0.8.1

Asynchronous I/O that doesn’t get in your way, written in D

Function determineLanguageByHeader

Determines a language code from the value of a header string.

string determineLanguageByHeader(T) (
  string accept_language,
  T allowed_languages
) pure @nogc @safe
if (isForwardRange!T);

string determineLanguageByHeader(Tuple...) (
  string accept_language,
  Tuple allowed_languages
) pure @nogc @safe;

string determineLanguageByHeader(T) (
  HTTPServerRequest req,
  T allowed_languages
) pure @safe
if (isForwardRange!T);

string determineLanguageByHeader(Tuple...) (
  HTTPServerRequest req,
  Tuple allowed_languages
) pure @safe;

Returns

The best match from the Accept-Language header for a language. null if there is no supported language.

Authors

Sönke Ludwig

Copyright

© 2014-2015 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.