Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 2 letter language codes #975

Merged
merged 4 commits into from
Aug 19, 2016

Conversation

zerebubuth
Copy link
Member

Use ISO 639-1 two letter language codes for WOF & OSM rather than ISO 639-3 3 letter codes. This partially reverses changes made for #418.

Connects to #972.

@rmarianski could you review, please?

if country_candidate:
country_result = _normalize_country_code(country_candidate)
if country_result is None:
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the previous behavior, but I'm now wondering if it's better to keep the language code rather than dropping it on an invalid country code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we have something like name:en="Foo", name:en_XY="Bar" do we want the name:en_XY to normalise to name:en and potentially clash with the other entry?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. We can set it up so that we'll only set the language code if one doesn't already exist in this scenario, but the added complexity might not be worth it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the behaviour in 4df4863 to keep the most specific language code. At the moment, that just means that any with an omitted country are less specific and won't overwrite a code without a country, e.g: en always beats en_NOEXIST.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea with priorities! ⚡ My first thoughts were also to just return a more complex value object, but just whether the country code was invalid or not. The priority notion is a better generalization of that.

…iority to the result, so that we can keep the most specific match.
@rmarianski
Copy link
Member

👍

@zerebubuth zerebubuth merged commit 9f72d0e into master Aug 19, 2016
@zerebubuth zerebubuth deleted the zerebubuth/972-use-2-letter-language-codes branch August 19, 2016 15:27
1. `name:de` German
1. `name:gr` Greek
1. `name:it` Italian
1. `name:jp` Japanese
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be ja instead of jp.

nvkelso added a commit that referenced this pull request Aug 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants