langcodes
langcodes copied to clipboard
Don't lose region/territory when converting back from display name
Given a language code of en-ca
, the following currently happens:
code = "en-ca"
tag = langcodes.get(code) # Language.make(language='en', territory='CA')
display_name = tag.display_name() # 'English (Canada)'
tag = langcodes.find(display_name) # <- .find does not capture the territory, yielding Language.make(language='en')
Is there any way .find could correctly get the territory from the display name?