1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Alternate Tag Separators

Discussion in 'XenForo Suggestions' started by ibnesayeed, Dec 19, 2015.

  1. ibnesayeed

    ibnesayeed Well-Known Member

    Currently, only one form of comma character is being used as the tag separator when adding tags in a thread. However, there are a few variations of the comma character that are being used by one language or the other. While entering tags, it is very inconvenient to switch keyboard to use the comma other than the current language. Wikipedia suggests three different commas (, ، 、). I would like to suggest inclusion of all of them as the tag separator. XenTag addon added support for the Arabic comma on request that is being used in many RTL languages. Recently, I have seen some long tags in our forum that have Arabic comma in it, but they were treated as a single tag.
  2. ibnesayeed

    ibnesayeed Well-Known Member

    Hey @Mike and @Chris D this issue is an ongoing pain for our members and the staff. People use Urdu keyboard to write messages in our forum, which uses a different comma. As a result, in order to make use of this system properly they will have to switch the keyboard twice after every tag they enter, just for the comma entry. The experience is even worse on mobile devices. Also, many members don't even know that they are not using the right comma. Hence moderators end up editing them later. Additionally, if someone puts a comma at the end it becomes part of the tag.

    Here is an example:
    اردو،اردو زبان،اردو زبان کا فروغ،اردو کا فروغ،
    People would expect it to be treated as:
    اردو زبان
    اردو زبان کا فروغ
    اردو کا فروغ
    But that ends up being a single tag.

    Is there a quick fix/edit you might suggest for us to put in place before it is done more thoroughly in the system for the entire comma separator class or Unicode characters (which I think are not many, just three or four). In our forum we would like it to work for both English and Urdu comma (which is same as Arabic comma).
    Last edited: Mar 17, 2016
  3. Chris D

    Chris D XenForo Developer Staff Member

    I'm not sure how well this will work with certain characters, but it may help. It's a code edit, unfortunately.


    Replace with:
    That allows , ; and ، to be used as delimiters for tags.
  4. ibnesayeed

    ibnesayeed Well-Known Member

    I am sure you meant js/xenforo/tag.js
    It didn't work unfortunately! I didn't try to debug what went wrong though. I am afraid if it's because of changing the value of the delimiter from a string to an array of strings?
  5. Chris D

    Chris D XenForo Developer Staff Member

    An array of strings should work there but I haven't tested it. I was going by the documentation for the most recent version so it's possible it's a newer feature.

    I'll try and test it and report back.
    ibnesayeed likes this.
  6. ibnesayeed

    ibnesayeed Well-Known Member

    I am not sure which library is being used in XF, but if it is jQuery-Tags-Input library then here is the relevant merge that was done a year ago.
  7. Chris D

    Chris D XenForo Developer Staff Member

    It is that library. I can't remember if we used the new version when we worked on XF 1.5. We may not have done as it was already working (mostly) as we wanted in XFMG 1.0.x at that point.

    If you can't get the array of strings working we'll see about (but can't guarantee) including a newer version in the future.
    ibnesayeed likes this.
  8. ibnesayeed

    ibnesayeed Well-Known Member

    Now that I understood the code, with my custom modification I can get it working. However, the changes will have to be applied each time I upgrade, the way I deal with this pagination workaround.
    Greatly appreciated!
    I have verified that XenForo is using the old code:
    if (event.which==event.data.delimiter.charCodeAt(0) || event.which==13 ) {
    Instead of:
    if (_checkDelimiter(event)) {
    Which is now implemented like this:
    var _checkDelimiter = function(event){
    flag false;// defalut no match

    if(event.which == 13){// Enter
    flag true;

    each(event.data.delimiter ,function(indexvalue){
    event.which == value.charCodeAt(0)){// match data.delimiter Array
    flag true;

    It turns out that the new implementation is not backwards compatible as they are now only supporting array. It could have been easy for them to also support the single character string config. However, this should not be an issue as the functionality is only used internally by XF and not advertised as a feature to be used by others (I guess). If it is otherwise, checking the type of "event.data.delimiter" and putting conditional should do the trick to keep it backward config compatible.
  9. ibnesayeed

    ibnesayeed Well-Known Member

    Recognizing other separators in the backend core would be great as it is needed in many places such as when mentioning users like @Mike, the English comma behaves as expected, but when other types are commas are used, they are considered as part of the name.

Share This Page