Jump to content

Topic on Help talk:Extension:AdvancedSearch

Nicolas senechal (talkcontribs)

Hello, maybe I don’t quite understand the documentation : Adding Fields to AdvancedSearch.

I want to put a new field named extra (like the example), the search is good but I have a problem with the label. I put "advancedsearch-optgroup-extra" : "test" in i18n/fr.json and in every other language. In my wiki the result like I don't put an ID:

⧼advancedsearch-optgroup-undefined⧽

⧼advancedsearch-field-undefined⧽

The same for help message : ⧼advancedsearch-field-help-undefined⧽

Any help appreciated.

TheDJ (talkcontribs)

The example is incorrect, in so far that the messages won't be loaded automatically. If you have access to the server, you can just add the messages to the resource loader bundle in extension.json (just check where the messages for the other fields are being added). If you are using pure JS, load the RL module and trigger loadMessagesIfMissing, to load the content from server side into the frontend. See also: Manual:Messages API#Using an API query from JavaScript

Nicolas senechal (talkcontribs)

Thank you @TheDJ, I have access to my server so I use the extension.json solution, but for the optgroup I use a trick, because it was undefined so I just put it like it was my special label…

I have a question if I understand well if I put !category:"music", theoretically the music tag will be excluded. But it puts me on an error and when I put !-category:music it normally works like -category:"music".

.

Reply to "Providing labels"