-
Notifications
You must be signed in to change notification settings - Fork 124
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
base: master
Are you sure you want to change the base?
Conversation
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. |
Thanks, now I get it. This is a useful feature. |
There was a problem hiding this 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' }, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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à`. |
There was a problem hiding this comment.
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.
src/VoerroTagsInput.vue
Outdated
@@ -400,17 +407,19 @@ export default { | |||
value: text, | |||
}; | |||
|
|||
const queryTerm = this.latinizeTags ? latinize(newTag[this.textField]) : newTag[this.textField]; |
There was a problem hiding this comment.
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.
I tested your branch and I was able to add |
I think now it's fixed ! |
No description provided.