internetarchive / internetarchive/openlibrary
Browser language lookup is incorrectly using ISO 639-1 instead of BCP 47
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 138
Description
### Problem
As I mentioned in https://github.com/internetarchive/openlibrary/issues/5997#issuecomment-3993278982, the language tags sent by browsers are based on BCP 47, not ISO 639-1, so doing ISO 639-1 based lookups is incorrect. This will not work for the over 300 MARC languages which don't have ISO 639-1 codes, disenfranchising those users.
In Wikidata, these can be found using the property [P305](https://www.wikidata.org/wiki/Property:P305) "IETF Language Tag". For languages which have ISO 639-1 codes, these will overlap, but most languages do not have an ISO 639-1 code.
### Reproducing the bug
* Expected behavior: Language specific searches like Random Book work for all MARC languages
* Actual behavior: Only ISO 639-1 languages work
### Context
- Browser (Chrome, Safari, Firefox, etc):
- OS (Windows, Mac, etc):
- Logged in (Y/N):
- Environment (prod, dev, local): prod
### Breakdown
Implementation Details (for maintainers)
#### Requirements Checklist
* [ ]
#### Related files
*
#### Stakeholders
* @cdrini
* @mekarpeles
#### Instructions for Contributors
- Please [run these commands](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#working-on-your-branch) to ensure your repository is up to date **before** [creating a new branch](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#making-changes-and-creating-a-pull-request) to work on this issue and **each time after** pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.
Contributor guide
Assessment
This issue has not been assessed yet.