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

Search country flags using country names #99

Merged
merged 2 commits into from Aug 17, 2017

Conversation

chadoh
Copy link

@chadoh chadoh commented Aug 6, 2017

This addresses #96.

This works around current limitations/inconsistences in emoji-data and emojilib by matching between the two libraries on the emoji character itself, rather than relying on a perfect match between the two disparate "short name" fields.

See individual commit messages, especially for a927821, for extra info.

Demo of new functionality:

country-search

* Always match on emoji character
* For flag emojis where emojiLib data is found, use emojiLib name
Always perform the capitalization-correction for country names. If we
did this naïvely, using the same regex as before, it would change things
like "Falkland Islands" to "Falkland ISLANDS". The new regex checks on
word boundary, `\b`, instead of space, `\s`, which means even single
words like `Eu` are found. It then checks for exactly two letters, where
the first is uppercase and the second lowercase.

Here's exactly what it affects:

* All "Regional Indicator Symbol Letters AC"-type names that don't
have data in emojiLib
* There are some flags in emojiLib for which it uses two-character
abbreviations instead of full country names (see muan/emojilib#131).
These countries are: CN, EU, FR, DE, IT, JP, RU, KR, ES, TR, UK, US
This new regex corrects these from Cn, Eu, Fr, etc.
@chadoh chadoh mentioned this pull request Aug 6, 2017
@EtienneLem
Copy link
Member

This looks great @chadoh, I’ll do a thorough review ASAP!

@EtienneLem EtienneLem merged commit 2becc5a into missive:master Aug 17, 2017
@EtienneLem
Copy link
Member

That’s perfect, thanks again @chadoh!

@chadoh chadoh deleted the countries-search branch August 17, 2017 16:12
EtienneLem added a commit that referenced this pull request Dec 15, 2017
Countries name now properly handled in emoji-data

This reverts commit 2becc5a, reversing
changes made to c21e140.
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.

None yet

2 participants