Add option to search in any language (#5598)
This commit is contained in:
@@ -35,6 +35,7 @@ export function makeSearchQuery(query: string, params: Params) {
|
|||||||
return [
|
return [
|
||||||
query,
|
query,
|
||||||
Object.entries(params)
|
Object.entries(params)
|
||||||
|
.filter(([_, value]) => value)
|
||||||
.map(([name, value]) => `${name}:${value}`)
|
.map(([name, value]) => `${name}:${value}`)
|
||||||
.join(' '),
|
.join(' '),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -338,18 +338,28 @@ function SearchLanguageDropdown({
|
|||||||
onChange(value: string): void
|
onChange(value: string): void
|
||||||
}) {
|
}) {
|
||||||
const t = useThemeNew()
|
const t = useThemeNew()
|
||||||
|
const {_} = useLingui()
|
||||||
const {contentLanguages} = useLanguagePrefs()
|
const {contentLanguages} = useLanguagePrefs()
|
||||||
|
|
||||||
const items = React.useMemo(() => {
|
const items = React.useMemo(() => {
|
||||||
return LANGUAGES.filter(l => Boolean(l.code2))
|
return [
|
||||||
|
{
|
||||||
|
label: _(msg`Any language`),
|
||||||
|
inputLabel: _(msg`Any language`),
|
||||||
|
value: '',
|
||||||
|
key: '*',
|
||||||
|
},
|
||||||
|
].concat(
|
||||||
|
LANGUAGES.filter(l => Boolean(l.code2))
|
||||||
.map(l => ({
|
.map(l => ({
|
||||||
label: l.name,
|
label: l.name,
|
||||||
inputLabel: l.name,
|
inputLabel: l.name,
|
||||||
value: l.code2,
|
value: l.code2,
|
||||||
key: l.code2 + l.code3,
|
key: l.code2 + l.code3,
|
||||||
}))
|
}))
|
||||||
.sort(a => (contentLanguages.includes(a.value) ? -1 : 1))
|
.sort(a => (contentLanguages.includes(a.value) ? -1 : 1)),
|
||||||
}, [contentLanguages])
|
)
|
||||||
|
}, [_, contentLanguages])
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
backgroundColor: t.atoms.bg_contrast_25.backgroundColor,
|
backgroundColor: t.atoms.bg_contrast_25.backgroundColor,
|
||||||
|
|||||||
Reference in New Issue
Block a user