Add option to search in any language

This commit is contained in:
Eric Bailey
2024-10-03 15:50:03 -05:00
parent eb3b01d0ad
commit 79bb202965
2 changed files with 20 additions and 9 deletions
+1
View File
@@ -35,6 +35,7 @@ export function makeSearchQuery(query: string, params: Params) {
return [
query,
Object.entries(params)
.filter(([_, value]) => value)
.map(([name, value]) => `${name}:${value}`)
.join(' '),
]
+19 -9
View File
@@ -338,18 +338,28 @@ function SearchLanguageDropdown({
onChange(value: string): void
}) {
const t = useThemeNew()
const {_} = useLingui()
const {contentLanguages} = useLanguagePrefs()
const items = React.useMemo(() => {
return LANGUAGES.filter(l => Boolean(l.code2))
.map(l => ({
label: l.name,
inputLabel: l.name,
value: l.code2,
key: l.code2 + l.code3,
}))
.sort(a => (contentLanguages.includes(a.value) ? -1 : 1))
}, [contentLanguages])
return [
{
label: _(msg`Any language`),
inputLabel: _(msg`Any language`),
value: '',
key: '*',
},
].concat(
LANGUAGES.filter(l => Boolean(l.code2))
.map(l => ({
label: l.name,
inputLabel: l.name,
value: l.code2,
key: l.code2 + l.code3,
}))
.sort(a => (contentLanguages.includes(a.value) ? -1 : 1)),
)
}, [_, contentLanguages])
const style = {
backgroundColor: t.atoms.bg_contrast_25.backgroundColor,