Closed nicokaiser closed 7 months ago
There seems to be an if-condition: if (params.langs.length < 2) {
(in forms.ts), however since params.langs
is an object (not an array), this will never be true.
When fixed to if (Object.keys(param.langs).length < 2) {
, something else breaks, since the .search-filter-lang
element is assumed to be there, and tried to add an event listener. Both can be fixed, but not I'm stuck, because without setting the language to "All" no results are found.
I'll try to understand how this module works and how it can be used on a single-language site without any language dropdowns, filters, etc.
Would a filter_languages parameter make sense in this context? (Default true to maintain compatibility, but when set to false, search all languages and hide the dropdown)
Make sense, but one parameter for two purposes is not a good way to go, since there is someone hope to hide the languages filter and search with current page language only. I'd like to add two parameters, one for the languages filter, one for the languages (all or current page language).
You are right. When there is only one language, this dropdown should be hidden anyway (see my above comment). When this is fixed (and results are found), this is totally fine.
I still need to figure out if I misconfigured something, since without setting the language to "All" every time, there are no search result at all. But this might as well be a configuration issue on my side.
When there is only one language, this dropdown should be hidden anyway (see my above comment)
I see, will check this use case later, let me know if you want to open a PR to fix it.
I still need to figure out if I misconfigured something, since without setting the language to "All" every time, there are no search result at all.
Do you have a public repo or live site to check this issue?
I've tested it myself on both of monolingual and multilingual sites, should be fixed since v0.8.5.
since without setting the language to "All" every time, there are no search result at all.
But I couldn't reproduce this, please share more details if you have any.
Great, thank you very much! My issue with no results displaying was just a configuration issue on my side, so all is fine now!
Is there an elegant way to select "All languages" by default? Currently the languages from the
lang
attribute in the root HTML element is used. However in some cases it might be desireable to ignore i18n and just select all languages by default (e.g. when the wholesearch-form-meta
toolbar is not needed and can be hidden via CSS).Would a
filter_languages
parameter make sense in this context? (Defaulttrue
to maintain compatibility, but when set tofalse
, search all languages and hide the dropdown)