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

Adding latinize-tags flag to ignore accents #128

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

carlosabcs
Copy link

No description provided.

@AlexMordred
Copy link
Member

Please give me a real use case for this, I am a bit confused. Also, there are conflicts now.

@carlosabcs
Copy link
Author

Please give me a real use case for this, I am a bit confused. Also, there are conflicts now.

In languages like Spanish or Portuguese, for example, some users may have errors when accentuating words. Because of that, sometimes they may not find what they are looking for even though the text is the same and only the accents were missing.

Another option could be to pass a callback as a prop, to be used as a pre-processing function for the query term and searchable options.

@AlexMordred
Copy link
Member

AlexMordred commented Mar 26, 2021

Thanks, now I get it. This is a useful feature.

Copy link
Member

@AlexMordred AlexMordred left a comment

Choose a reason for hiding this comment

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

Please fix any conflicts and the things I mentioned in the comments.

index.html Outdated
@@ -203,13 +212,15 @@ <h2 class="is-size-4" style="margin-bottom: 1rem;">Options</h2>
:existing-tags="[
{ key: 'children-of-bodom', value: 'Children of Bodom' },
{ key: 'epica', value: 'Epica' },
{ key: 'epica', value: 'Épica' },
Copy link
Member

Choose a reason for hiding this comment

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

In real life "Epica" and "Épica" could be two different words with different meanings, right? So the keys should also be different so you would be able to select both words. Please fix your examples here or think of different words.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I'll add just one little example of an accentuated word.

README.md Outdated
@@ -179,6 +179,7 @@ limit | Number | 0 | Limit the number of tags that can be chosen. 0 = no limit.
hide-input-on-limit | Boolean | false | Hide the input field when the tags limit is reached.
only-existing-tags | Boolean | false | Only existing tags can be added/chosen. New tags won't be created.
case-sensitive-tags | Boolean | false | Determines whether tags are case sensitive. Setting this to `true` would allow tags like `php`, `PHP`, `PhP`, and so on to be added at the same time.
latinize-tags | Boolean | false | Determines whether the accents in words are ignored or not. Setting this to `true` would ignore the differences between words like `voila` and `voilà`.
Copy link
Member

Choose a reason for hiding this comment

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

I think the prop should be called ignore-diacritics as this would be a more general term. The word "latinize" doesn't have anything to do with accents according to Google.

@@ -400,17 +407,19 @@ export default {
value: text,
};

const queryTerm = this.latinizeTags ? latinize(newTag[this.textField]) : newTag[this.textField];
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to remove diacritics here when checking for whether a tag has been added already. As I mentioned above, there could be two words "Epica" and "Épica" with completely different meanings and because of this code here we won't be able to add them both.

@AlexMordred
Copy link
Member

I tested your branch and I was able to add Naïve Bayes twice, first selecting from the autocomplete, then creating a new tag. You shouldn't remove diacritics when checking for tag existence when creating new tags.

@carlosabcs
Copy link
Author

I tested your branch and I was able to add Naïve Bayes twice, first selecting from the autocomplete, then creating a new tag. You shouldn't remove diacritics when checking for tag existence when creating new tags.

I think now it's fixed !

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.

2 participants