Resolve alternate language names through fromname - #55
Open
LavX wants to merge 1 commit into
Open
Conversation
NameConverter only indexed each language's single ISO 639-3 reference
name, so alternate spellings raised LanguageReverseError:
>>> Language.fromname('Pashto') # the 'pus' reference name is 'Pushto'
LanguageReverseError: 'Pashto'
Bundle SIL's iso-639-3_Name_Index.tab and register every print name as a
reverse-only alias; the forward Language(x).name still returns the
canonical ISO 639-3 reference name. Reference names are seeded first so
they always win on any clash, and lookups stay case-insensitive. Also add
a small curated map for common names absent from every ISO source
(e.g. 'Greek' -> ell, which SIL only lists as 'Modern Greek (1453-)').
Fixes Diaoul#22
Fixes Diaoul#23
Fixes Diaoul#31
Fixes Diaoul#24
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.
Summary
NameConverteronly indexed each language's single ISO 639-3 reference name, so any alternate spelling raisedLanguageReverseError:Change
iso-639-3_Name_Index.tab(source: https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3_Name_Index.tab) and register every print name as a reverse-only alias.Language('pus').namestill returns the canonical reference name'Pushto'. Reference names are seeded first, so they always win on any clash, and lookups stay case-insensitive.COMMON_NAMESmap for common names that no ISO source provides (e.g.'Greek'->ell, which SIL only lists as'Modern Greek (1453-)').Verified that no print name maps to more than one language (reverse stays deterministic) and that forward display names are unchanged.
Fixes #22
Fixes #23
Fixes #31
Fixes #24