11 stable releases

3.1.0 Aug 19, 2023
3.0.1 Jun 23, 2023
2.0.0 Jan 11, 2019
1.2.2 Dec 31, 2018
1.0.0 May 25, 2017

#29 in Internationalization (i18n)

Download history 1835/week @ 2024-07-28 1546/week @ 2024-08-04 1461/week @ 2024-08-11 978/week @ 2024-08-18 1521/week @ 2024-08-25 1132/week @ 2024-09-01 1225/week @ 2024-09-08 1673/week @ 2024-09-15 3204/week @ 2024-09-22 2088/week @ 2024-09-29 2776/week @ 2024-10-06 2690/week @ 2024-10-13 3350/week @ 2024-10-20 3139/week @ 2024-10-27 3799/week @ 2024-11-03 2383/week @ 2024-11-10

12,763 downloads per month
Used in 11 crates (8 directly)

MIT license

19KB
258 lines

accept-language

A tiny library for parsing the Accept-Language header from browsers (as defined here)

Usage

accept-language is intended to be used by a web server, probably to decide which languages to serve up to the user based on their preferred language and the languages your application supports.

At it's most basic, it looks like this

extern crate accept_language;

use accept_language::{intersection, parse};

let user_languages = parse("en-US, en-GB;q=0.5");
let common_languages = intersection("en-US, en-GB;q=0.5", vec!["en-US", "de", "en-GB"]);

For more info and to view the full documentation, check them out on docs.rs.

Stability

accept-language is fuzz tested with cargo-fuzz on every PR and push via GitHub actions.

Contributing

Contributions are always welcome! If you found a bug, please submit an issue. If you'd like to submit a patch or feature, feel free to submit a pull request. rustfmt should be used to have consistent code formatting throughout the project.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Changelog

License

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Mike Engel
Mike Engel

🐛 💬 💻 📖 🎨 🤔 🚇 👀 ⚠️
Lukas Kalbertodt
Lukas Kalbertodt

💻
Sean Stangl
Sean Stangl

💻 🐛 ⚠️
Kornel
Kornel

💻
Daniel Lockyer
Daniel Lockyer

🐛
Peter C. S. Scholtens
Peter C. S. Scholtens

🐛 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

No runtime deps