igniterealtime / openfire-search-plugin

Adds Jabber Search (XEP-0055) capabilities to Openfire
Apache License 2.0
3 stars 8 forks source link

The search doesn't find anything if use a non-English localization #18

Open Plyha opened 2 years ago

Plyha commented 2 years ago

This happens because propepries:advance.user.search.username, advance.user.search.name ,advance.user.search.email must use an English translation string or must not be translated.

If the Brazilian/Russian language was set in Openfire, then the search stopped working. The Latvian language was not affected by this problem because it is not available in Openfire.

guusdk commented 1 year ago

Apologies for the long, long wait.

I don't believe that your changes fix the underlying problem. For some reason, the code uses a translatable value for the var of each item. That's not correct. Those var values should be hard-coded. If a human-readible translation is desired, then a label can be used.

I've added an untested commit that tries to do this.

raspopov commented 1 year ago

Maybe "var" and "label" attributes are mixed up when outputting "field" tags? Sample XML answer:

<iq type="result" id="H2XHS-311" from="search.foo.com" to="sender@foo.com/computer">
  <query xmlns="jabber:iq:search">
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden"/>
      <reported>
        <field var="jid" type="jid-single" label="JID"/>
        <field var="Username" type="text-single" label="Имя пользователя"/>
        <field var="Name" type="text-single" label="Имя"/>
        <field var="Email" type="text-single" label="Электронная почта"/>
      </reported>
      <item>
        <field var="jid">
          <value>
            user@foo.com
          </value>
        </field>
        <field var="Имя пользователя"> ⬅️
          <value>
            user_name
          </value>
        </field>
        <field var="Имя">⬅️
          <value>
            User Name
          </value>
        </field>
        <field var="Электронная почта">⬅️
          <value>
            user_name@foo.com
          </value>
        </field>
      </item>
    </x>
  </query>
</iq>