Repository navigation
Map languages to the flag of their country - #1559
Merged
Merged
Conversation
Language.favicon used the language code as a country code. That gave a 404 for English and Japanese, and the wrong flag for others: Arabic got Argentina, Swedish got El Salvador. Map languages to their country, and give languages without one obvious country no flag at all.
|
Great to see this fixed! Especially the language flag mismatches I noticed with Bosnian (bs 🇧🇸 – Bahamas) and Bashkir (ba 🇧🇦 – Bosnia and Herzegovina). Thanks, Frenck, for your work on this project. Really appreciate it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Language.faviconnow returns a different URL for some languages, andNonefor languages without one obvious country (like Arabic or Catalan). Those previously returned a wrong flag, see below.Proposed change
Language.faviconput the ISO 639 language code straight into a flagcdn.com URL, which expects an ISO 3166 country code. For some languages that happens to work (nl,de,fr), others return a 404 (en,ja,zh,el,ko), and a few silently return the wrong flag:arsvsrcaneslmlbsHome Assistant uses this as the thumbnail in the media browser.
A new
LANGUAGE_FLAGSmapping inconst.pylinks 51 languages to the country they belong to (English togb). Languages without one obvious country are left out on purpose and get no favicon; no flag beats the wrong one. All mapped flags were checked to exist on flagcdn.com.Type of change
Additional information
Checklist
poetry run pytestpasses locally. A pull request cannot be merged unless CI is green.poetry run prek run --all-filespasses (lint, format, and type checks).