Merge branch 'searxng:master' into master

This commit is contained in:
Azure Star 2023-05-09 14:46:53 +02:00 committed by GitHub
commit d81262aa5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 9543 additions and 444 deletions

View file

@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v2

View file

@ -1,13 +1,13 @@
mock==5.0.2
nose2[coverage_plugin]==0.12.0
nose2[coverage_plugin]==0.13.0
cov-core==1.15.0
black==22.12.0
pylint==2.17.2
pylint==2.17.3
splinter==0.19.0
selenium==4.9.0
twine==4.0.2
Pallets-Sphinx-Themes==2.0.3
Sphinx==5.3.0
Pallets-Sphinx-Themes==2.1.0
Sphinx==6.2.1
sphinx-issues==3.0.1
sphinx-jinja==2.0.2
sphinx-tabs==3.4.1
@ -17,6 +17,6 @@ sphinx-notfound-page==0.8.3
myst-parser==1.0.0
linuxdoc==20230321
aiounittest==1.4.2
yamllint==1.30.0
yamllint==1.31.0
wlc==1.13
coloredlogs==15.0.1

View file

@ -1,7 +1,7 @@
certifi==2022.12.7
babel==2.12.1
flask-babel==3.1.0
flask==2.2.3
flask==2.3.2
jinja2==3.1.2
lxml==4.9.2
pygments==2.15.1

File diff suppressed because it is too large Load diff

View file

@ -991,6 +991,7 @@
"コロンビア・ペソ": "COP",
"콜롬비아 페소": "COP",
"kolumbijos pesas": "COP",
"peso colombia": "COP",
"colombiaanse peso": "COP",
"ਕੋਲੰਬੀਆਈ ਪੇਸੋ": "COP",
"peso kolumbijskie": "COP",
@ -998,7 +999,6 @@
"колумбијски пезос": "COP",
"kolombiya pesosu": "COP",
"колумбійський песо": "COP",
"peso colombia": "COP",
"costa ricaanse colón": "CRC",
"كولون كوستاريكي": "CRC",
"костарикански колон": "CRC",
@ -2020,11 +2020,11 @@
"שילינג קנייתי": "KES",
"kenijski šiling": "KES",
"kenyai shilling": "KES",
"shilling kenya": "KES",
"scellino keniota": "KES",
"ケニア・シリング": "KES",
"케냐 실링": "KES",
"kenijos šilingas": "KES",
"shilling kenya": "KES",
"keniaanse shilling": "KES",
"szyling kenijski": "KES",
"xelim queniano": "KES",
@ -2178,6 +2178,7 @@
"won sul coreano": "KRW",
"won sud coreean": "KRW",
"южнокорейская вона": "KRW",
"južnokorejski won": "KRW",
"јужнокорејски вон": "KRW",
"sydkoreansk won": "KRW",
"güney kore wonu": "KRW",
@ -2622,7 +2623,7 @@
"ugiya": "MRU",
"мавританська угія": "MRU",
"mauritiaanse roepee": "MUR",
"روبي موريشي": "MUR",
"روبية موريشية": "MUR",
"rupia de maurici": "MUR",
"mauricijská rupie": "MUR",
"mauritiske rupee": "MUR",
@ -4646,7 +4647,7 @@
"zambiya kvaçası": "ZMW",
"замбійська квача": "ZMW",
"zimbabwean dollar": "ZWL",
"dólar rtgs": "ZWL",
"dólar zimbabuense": "ZWL",
"real time gross settlement dollar": "ZWL",
"dollaro rtgs": "ZWL",
"rtgsドル": "ZWL",
@ -4926,12 +4927,9 @@
"peso ley": "ARS",
"peso moneda nacional": "ARS",
"pesos argentinos": "ARS",
"nuevo peso argentino": "ARS",
"peso convertible": "ARS",
"peso convertible argentino": "ARS",
"peso de argentina": "ARS",
"peso dolar": "ARS",
"peso dólar": "ARS",
"argentine convertible peso": "ARS",
"peso convertible argentina": "ARS",
"peso argentino convertible": "ARS",
"argentinar peso": "ARS",
"nuevo peso": [
"UYU",
@ -4942,6 +4940,7 @@
"פסו ארגנטיני": "ARS",
"argentinski peso": "ARS",
"nuovo peso argentino": "ARS",
"peso convertible": "ARS",
"peso da argentina": "ARS",
"валюта аргентины": "ARS",
"песо": [
@ -6801,10 +6800,10 @@
"jeon": "KRW",
"lõuna korea won": "KRW",
"韓国ウォン": "KRW",
"대한민국 전": "KRW",
"대한민국원": "KRW",
"대한민국 통화": "KRW",
"대한민국 화폐": "KRW",
"대한민국의 통화": "KRW",
"대한민국의 화폐": "KRW",
"대한민국전": "KRW",
"won sud corean": "KRW",
"валюта республики корея": "KRW",
"วอนเกาหลีใต้": "KRW",
@ -7239,6 +7238,7 @@
"moritanya ouguiyası": "MRU",
"moritanya ugiyası": "MRU",
"ougiya": "MRU",
"روبي موريشي": "MUR",
"mur": "MUR",
"mauritisk rupee": "MUR",
"mauritius rupee": "MUR",
@ -8161,7 +8161,6 @@
"libra del sudán": "SDG",
"dinar soudanais": "SDG",
"לירה סודאנית": "SDG",
"수단파운드": "SDG",
"soedanese pond": "SDG",
"валюта судана": "SDG",
"sdd": "SDG",
@ -9267,6 +9266,7 @@
"zwl": "ZWL",
"zimdollar": "ZWL",
"fifth zimbabwean dollar": "ZWL",
"dólar rtgs": "ZWL",
"pesos": [
"MXN"
]
@ -9545,9 +9545,9 @@
"ca": "peso argentí",
"cs": "Argentinské peso",
"de": "argentinischer Peso",
"en": "Argentine peso",
"en": "Argentine convertible peso",
"eo": "argentina peso",
"es": "peso argentino",
"es": "peso argentino convertible",
"et": "Argentina peeso",
"eu": "Argentinar peso",
"fi": "Argentiinan peso",
@ -10495,6 +10495,7 @@
"ja": "コロンビア・ペソ",
"ko": "콜롬비아 페소",
"lt": "Kolumbijos pesas",
"ms": "Peso Colombia",
"nl": "Colombiaanse peso",
"pa": "ਕੋਲੰਬੀਆਈ ਪੇਸੋ",
"pap": "Peso colombiano",
@ -12238,6 +12239,7 @@
"ja": "リベリア・ドル",
"ko": "라이베리아 달러",
"lt": "Liberijos doleris",
"ms": "Dolar Liberia",
"nl": "Liberiaanse dollar",
"pl": "Dolar liberyjski",
"pt": "Dólar liberiano",

File diff suppressed because it is too large Load diff

View file

@ -3697,6 +3697,7 @@
"eu",
"ext",
"fa",
"fat",
"ff",
"fi",
"fiu-vro",

View file

@ -1,7 +1,7 @@
{
"versions": [
"111.0",
"110.0"
"112.0",
"111.0"
],
"os": [
"Windows NT 10.0; Win64; x64",

View file

@ -323,6 +323,7 @@
"Q169893": "S",
"Q170804": "Wb",
"Q17093295": "m/h",
"Q17143051": "Tf",
"Q17255465": "v_P",
"Q173117": "R$",
"Q1741429": "kpm",

View file

@ -1,6 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
from urllib.parse import quote_plus
from urllib.parse import quote_plus, urlparse
from searx.data import EXTERNAL_BANGS
LEAF_KEY = chr(16)
@ -40,9 +40,15 @@ def get_bang_definition_and_ac(external_bangs_db, bang):
def resolve_bang_definition(bang_definition, query):
url, rank = bang_definition.split(chr(1))
url = url.replace(chr(2), quote_plus(query))
if url.startswith('//'):
url = 'https:' + url
if query:
url = url.replace(chr(2), quote_plus(query))
else:
# go to main instead of search page
o = urlparse(url)
url = o.scheme + '://' + o.netloc
rank = int(rank) if len(rank) > 0 else 0
return (url, rank)

View file

@ -37,6 +37,7 @@ block_user_agent = re.compile(
# unmaintained Farside instances
+ r'|'
+ re.escape(r'Mozilla/5.0 (compatible; Farside/0.1.0; +https://farside.link)')
+ '|.*PetalBot.*'
+ r')'
)

View file

@ -8,9 +8,10 @@
from base64 import urlsafe_b64encode, urlsafe_b64decode
from zlib import compress, decompress
from urllib.parse import parse_qs, urlencode
from typing import Iterable, Dict, List
from typing import Iterable, Dict, List, Optional
import flask
import babel
from searx import settings, autocomplete
from searx.enginelib import Engine
@ -287,10 +288,65 @@ class PluginsSetting(BooleanChoices):
return [item[len('plugin_') :] for item in items]
class ClientPref:
"""Container to assemble client prefferences and settings."""
# hint: searx.webapp.get_client_settings should be moved into this class
locale: babel.Locale
"""Locale prefered by the client."""
def __init__(self, locale: Optional[babel.Locale] = None):
self.locale = locale
@property
def locale_tag(self):
if self.locale is None:
return None
tag = self.locale.language
if self.locale.territory:
tag += '-' + self.locale.territory
return tag
@classmethod
def from_http_request(cls, http_request: flask.Request):
"""Build ClientPref object from HTTP request.
- `Accept-Language used for locale setting
<https://www.w3.org/International/questions/qa-accept-lang-locales.en>`__
"""
al_header = http_request.headers.get("Accept-Language")
if not al_header:
return cls(locale=None)
pairs = []
for l in al_header.split(','):
# fmt: off
lang, qvalue = [_.strip() for _ in (l.split(';') + ['q=1',])[:2]]
# fmt: on
try:
qvalue = float(qvalue.split('=')[-1])
locale = babel.Locale.parse(lang, sep='-')
except (ValueError, babel.core.UnknownLocaleError):
continue
pairs.append((locale, qvalue))
pairs.sort(reverse=True, key=lambda x: x[1])
return cls(locale=pairs[0][0])
class Preferences:
"""Validates and saves preferences to cookies"""
def __init__(self, themes: List[str], categories: List[str], engines: Dict[str, Engine], plugins: Iterable[Plugin]):
def __init__(
self,
themes: List[str],
categories: List[str],
engines: Dict[str, Engine],
plugins: Iterable[Plugin],
client: Optional[ClientPref] = None,
):
super().__init__()
self.key_value_settings: Dict[str, Setting] = {
@ -414,6 +470,7 @@ class Preferences:
self.engines = EnginesSetting('engines', engines=engines.values())
self.plugins = PluginsSetting('plugins', plugins=plugins)
self.tokens = SetSetting('tokens')
self.client = client or ClientPref()
self.unknown_params: Dict[str, str] = {}
def get_as_url_params(self):

View file

@ -22,7 +22,6 @@ from searx.network import initialize as initialize_network, check_network_config
from searx.metrics import initialize as initialize_metrics, counter_inc, histogram_observe_time
from searx.search.processors import PROCESSORS, initialize as initialize_processors
from searx.search.checker import initialize as initialize_checker
from searx.utils import detect_language
logger = logger.getChild('search')
@ -40,57 +39,19 @@ def initialize(settings_engines=None, enable_checker=False, check_network=False,
initialize_checker()
def replace_auto_language(search_query: SearchQuery):
"""
Do nothing except if `search_query.lang` is "auto".
In this case:
* the value "auto" is replaced by the detected language of the query.
The default value is "all" when no language is detected.
* `search_query.locale` is updated accordingly
Use :py:obj:`searx.utils.detect_language` with `only_search_languages=True` to keep
only languages supported by the engines.
"""
if search_query.lang != 'auto':
return
detected_lang = detect_language(search_query.query, threshold=0.3, only_search_languages=True)
if detected_lang is None:
# fallback to 'all' if no language has been detected
search_query.lang = 'all'
search_query.locale = None
return
search_query.lang = detected_lang
try:
search_query.locale = babel.Locale.parse(search_query.lang)
except babel.core.UnknownLocaleError:
search_query.locale = None
class Search:
"""Search information container"""
__slots__ = "search_query", "result_container", "start_time", "actual_timeout"
def __init__(self, search_query: SearchQuery):
"""Initialize the Search
search_query is copied
"""
"""Initialize the Search"""
# init vars
super().__init__()
self.search_query = search_query
self.result_container = ResultContainer()
self.start_time = None
self.actual_timeout = None
self.search_query = copy(search_query)
self.update_search_query(self.search_query)
def update_search_query(self, search_query: SearchQuery):
"""Update search_query.
call replace_auto_language to replace the "auto" language
"""
replace_auto_language(search_query)
def search_external_bang(self):
"""

View file

@ -31,7 +31,7 @@ search:
autocomplete_min: 4
# Default search language - leave blank to detect from browser information or
# use codes from 'languages.py'
default_lang: ""
default_lang: "auto"
# Available languages
# languages:
# - all

View file

@ -3,7 +3,7 @@
"eslint": "^8.18.0",
"grunt": "~1.6.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^4.0.0",
"grunt-contrib-cssmin": "^5.0.0",
"grunt-contrib-less": "~3.0.0",
"grunt-contrib-uglify": "~5.2.1",
"grunt-xmlmin": "~0.1.8",

View file

@ -6,20 +6,22 @@
# Markus Heiser <markus.heiser@darmarit.de>, 2022.
# Sean Botha <seanbotha@gmail.com>, 2022.
# jestie <jestie@gmail.com>, 2023.
# return42 <markus.heiser@darmarit.de>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-02-14 09:56+0000\n"
"Last-Translator: jestie <jestie@gmail.com>\n"
"PO-Revision-Date: 2023-04-26 14:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Afrikaans <https://translate.codeberg.org/projects/searxng/"
"searxng/af/>\n"
"Language: af\n"
"Language-Team: Afrikaans "
"<https://translate.codeberg.org/projects/searxng/searxng/af/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -390,6 +392,8 @@ msgid ""
"You are using Tor and it looks like you have this external IP address: "
"{ip_address}"
msgstr ""
"Jy maak gebruik van Tor en dit lys as of jy hierdie eksterne IP-adres het "
":{ip_address}"
#: searx/plugins/tor_check.py:86
msgid "You are not using Tor and you have this external IP address: {ip_address}"
@ -1298,4 +1302,3 @@ msgstr ""
#~ msgid "!bang"
#~ msgstr ""

View file

@ -17,22 +17,23 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-03-13 18:37+0000\n"
"Last-Translator: Cavemanly <k.adel.2m@protonmail.com>\n"
"PO-Revision-Date: 2023-04-26 14:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Arabic <https://translate.codeberg.org/projects/searxng/"
"searxng/ar/>\n"
"Language: ar\n"
"Language-Team: Arabic "
"<https://translate.codeberg.org/projects/searxng/searxng/ar/>\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : "
"n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
#: searx/searxng.msg
msgid "without further subgrouping"
msgstr ""
msgstr "بدون تقسيم"
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
#: searx/searxng.msg
@ -1572,4 +1573,3 @@ msgstr "إخفاء الفيديو"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -8,20 +8,22 @@
# Markus Heiser <markus.heiser@darmarit.de>, 2022.
# NxOne14 <kiril2315@gmail.com>, 2022.
# vynaaa <stefanovpower@abv.bg>, 2022.
# return42 <markus.heiser@darmarit.de>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2022-11-11 07:18+0000\n"
"Last-Translator: vynaaa <stefanovpower@abv.bg>\n"
"PO-Revision-Date: 2023-05-04 19:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Bulgarian <https://translate.codeberg.org/projects/searxng/"
"searxng/bg/>\n"
"Language: bg\n"
"Language-Team: Bulgarian "
"<https://weblate.bubu1.eu/projects/searxng/searxng/bg/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -112,7 +114,7 @@ msgstr "пакети"
#. CATEGORY_GROUPS['Q_A']
#: searx/searxng.msg
msgid "q&a"
msgstr "в&о"
msgstr "въпроси и отговори"
#. CATEGORY_GROUPS['REPOS']
#: searx/searxng.msg
@ -1566,4 +1568,3 @@ msgstr "скрий видеото"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -25,7 +25,7 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-04-11 16:37+0000\n"
"PO-Revision-Date: 2023-04-28 07:08+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: German <https://translate.codeberg.org/projects/searxng/"
"searxng/de/>\n"
@ -34,7 +34,7 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.16.4\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -619,9 +619,7 @@ msgstr "Welche Sprache oder Region soll bei der Suche bevorzugt werden?"
#: searx/templates/simple/preferences.html:127
msgid "Choose Auto-detect to let SearXNG detect the language of your query."
msgstr ""
"Welche Sprache oder Region soll bei der Suche bevorzugt werden? Mit der "
"Spracherkennung wird die Sprache automatisch erkannt."
msgstr "Mit der Spracherkennung wird die Sprache automatisch erkannt."
#: searx/templates/simple/preferences.html:133
msgid "Autocomplete"
@ -629,7 +627,7 @@ msgstr "Autovervollständigung"
#: searx/templates/simple/preferences.html:142
msgid "Find stuff as you type"
msgstr "zeige Vorschläge während der Eingabe an"
msgstr "Die Autovervollständigung zeigt Vorschläge während der Eingabe an."
#: searx/templates/simple/filters/safesearch.html:1
#: searx/templates/simple/filters/safesearch.html:2

View file

@ -25,13 +25,14 @@
# zDylant <dylantfcs@gmail.com>, 2022.
# mester <oscarodriguez56@gmail.com>, 2023.
# gallegonovato <fran-carro@hotmail.es>, 2023.
# return42 <markus.heiser@darmarit.de>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-04-11 16:37+0000\n"
"Last-Translator: gallegonovato <fran-carro@hotmail.es>\n"
"PO-Revision-Date: 2023-05-04 19:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Spanish <https://translate.codeberg.org/projects/searxng/"
"searxng/es/>\n"
"Language: es\n"
@ -39,7 +40,7 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.16.4\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -820,7 +821,7 @@ msgstr "Nombre del motor de búsqueda"
#: searx/templates/simple/preferences.html:313
msgid "Bang"
msgstr "Bang"
msgstr "!bang"
#: searx/templates/simple/preferences.html:314
msgid "Supports selected language"

View file

@ -10,26 +10,28 @@
# Noémi Ványi <sitbackandwait@gmail.com>, 2020
# Markus Heiser <markus.heiser@darmarit.de>, 2022, 2023.
# Babak Ahari <babak.ahari@gmail.com>, 2022.
# Parsa Ranjbar <parsa@disr.it>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-01-13 07:14+0000\n"
"Last-Translator: Markus Heiser <markus.heiser@darmarit.de>\n"
"PO-Revision-Date: 2023-04-24 16:37+0000\n"
"Last-Translator: Parsa Ranjbar <parsa@disr.it>\n"
"Language-Team: Persian <https://translate.codeberg.org/projects/searxng/"
"searxng/fa/>\n"
"Language: fa_IR\n"
"Language-Team: Persian "
"<https://weblate.bubu1.eu/projects/searxng/searxng/fa/>\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
#: searx/searxng.msg
msgid "without further subgrouping"
msgstr ""
msgstr "بدون زیر گروه بندی بیشتر"
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
#: searx/searxng.msg
@ -1566,4 +1568,3 @@ msgstr "پنهان‌سازی ویدئو"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -7,20 +7,22 @@
# Markus Heiser <markus.heiser@darmarit.de>, 2022, 2023.
# Mico Hautaluoma <m@mha.fi>, 2022.
# return42 <markus.heiser@darmarit.de>, 2023.
# artnay <jiri.gronroos@iki.fi>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-02-19 11:39+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"PO-Revision-Date: 2023-05-04 19:37+0000\n"
"Last-Translator: artnay <jiri.gronroos@iki.fi>\n"
"Language-Team: Finnish <https://translate.codeberg.org/projects/searxng/"
"searxng/fi/>\n"
"Language: fi\n"
"Language-Team: Finnish "
"<https://translate.codeberg.org/projects/searxng/searxng/fi/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -390,10 +392,13 @@ msgid ""
"You are using Tor and it looks like you have this external IP address: "
"{ip_address}"
msgstr ""
"Käytät Tor-verkkoa ja vaikuttaa siltä, että sinulla on tämä ulkoinen IP-"
"osoite: {ip_address}"
#: searx/plugins/tor_check.py:86
msgid "You are not using Tor and you have this external IP address: {ip_address}"
msgstr ""
"Et käytä Tor-verkkoa ja sinulla on tämä ulkoinen IP-osoite: {ip_address}"
#: searx/plugins/tracker_url_remover.py:29
msgid "Tracker URL remover"
@ -581,7 +586,7 @@ msgstr "Oletuskieli"
#: searx/templates/simple/filters/languages.html:4
#: searx/templates/simple/preferences.html:120
msgid "Auto-detect"
msgstr ""
msgstr "Havaitse automaattisesti"
#: searx/templates/simple/preferences.html:127
msgid "What language do you prefer for search?"
@ -590,6 +595,8 @@ msgstr "Millä kielellä haluat etsiä ensisijaisesti?"
#: searx/templates/simple/preferences.html:127
msgid "Choose Auto-detect to let SearXNG detect the language of your query."
msgstr ""
"Valitse \"Havaitse automaattisesti\", jotta SearXNG havaitsee haun kielen "
"automaattisesti."
#: searx/templates/simple/preferences.html:133
msgid "Autocomplete"
@ -725,6 +732,9 @@ msgid ""
"href=\"http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods\""
" rel=\"external\">learn more about request methods</a>"
msgstr ""
"Vaihda tapaa miten lomakkeet lähetetään, <a href=\"http://en.wikipedia.org/"
"wiki/Hypertext_Transfer_Protocol#Request_methods\" rel=\"external\""
">lisätietoja eri pyyntömenetelmistä</a>"
#: searx/templates/simple/preferences.html:273
msgid "Image proxy"
@ -1143,7 +1153,7 @@ msgstr "Journaali"
#: searx/templates/simple/result_templates/paper.html:22
msgid "Editor"
msgstr ""
msgstr "Editori"
#: searx/templates/simple/result_templates/paper.html:23
msgid "Publisher"
@ -1151,7 +1161,7 @@ msgstr "Julkaisija"
#: searx/templates/simple/result_templates/paper.html:24
msgid "Type"
msgstr ""
msgstr "Tyyppi"
#: searx/templates/simple/result_templates/paper.html:25
msgid "Tags"
@ -1565,4 +1575,3 @@ msgstr "piilota video"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -21,7 +21,7 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-04-14 06:37+0000\n"
"PO-Revision-Date: 2023-05-04 19:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: French <https://translate.codeberg.org/projects/searxng/"
"searxng/fr/>\n"
@ -30,7 +30,7 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.16.4\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -548,11 +548,11 @@ msgstr "Afficher les journaux d'erreurs et soumettre un rapport de bogue"
#: searx/templates/simple/preferences.html:35
msgid "!bang for this engine"
msgstr ""
msgstr "!bang pour ce moteur de recherche"
#: searx/templates/simple/preferences.html:36
msgid "!bang for its categories"
msgstr ""
msgstr "!bang pour ses catégories"
#: searx/templates/simple/preferences.html:54
#: searx/templates/simple/stats.html:64
@ -793,6 +793,8 @@ msgid ""
"This tab dues not exists in the user interface, but you can search in "
"these engines by its !bangs."
msgstr ""
"Cet onglet n'existe pas dans l'interface utilisateur, mais vous pouvez "
"effectuer des recherches dans ces moteurs grâce à ses !bangs."
#: searx/templates/simple/preferences.html:311
#: searx/templates/simple/preferences.html:365
@ -806,7 +808,7 @@ msgstr "Nom du moteur"
#: searx/templates/simple/preferences.html:313
msgid "Bang"
msgstr ""
msgstr "!bang"
#: searx/templates/simple/preferences.html:314
msgid "Supports selected language"

View file

@ -16,21 +16,22 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-04-03 06:37+0000\n"
"PO-Revision-Date: 2023-05-01 07:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Hungarian <https://translate.codeberg.org/projects/searxng/"
"searxng/hu/>\n"
"Language: hu\n"
"Language-Team: Hungarian "
"<https://translate.codeberg.org/projects/searxng/searxng/hu/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
#: searx/searxng.msg
msgid "without further subgrouping"
msgstr ""
msgstr "további alcsoportosítás nélkül"
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
#: searx/searxng.msg
@ -1571,4 +1572,3 @@ msgstr "videó elrejtése"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -11,21 +11,22 @@ msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-04-03 06:37+0000\n"
"PO-Revision-Date: 2023-05-02 08:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Norwegian Bokmål <https://translate.codeberg.org/projects/"
"searxng/searxng/nb_NO/>\n"
"Language: nb_NO\n"
"Language-Team: Norwegian Bokmål "
"<https://translate.codeberg.org/projects/searxng/searxng/nb_NO/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
#: searx/searxng.msg
msgid "without further subgrouping"
msgstr ""
msgstr "uten ytterligere undergruppering"
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
#: searx/searxng.msg
@ -1485,4 +1486,3 @@ msgstr "skjul video"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -8,27 +8,29 @@
# jugi1, 2017
# Markus Heiser <markus.heiser@darmarit.de>, 2022.
# SecularSteve <fairfull.playing@gmail.com>, 2022.
# return42 <markus.heiser@darmarit.de>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2022-11-19 16:21+0000\n"
"Last-Translator: Markus Heiser <markus.heiser@darmarit.de>\n"
"PO-Revision-Date: 2023-04-26 14:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Serbian <https://translate.codeberg.org/projects/searxng/"
"searxng/sr/>\n"
"Language: sr\n"
"Language-Team: Serbian "
"<https://weblate.bubu1.eu/projects/searxng/searxng/sr/>\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
#: searx/searxng.msg
msgid "without further subgrouping"
msgstr ""
msgstr "bez daljeg podgrupisanja"
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
#: searx/searxng.msg
@ -390,6 +392,7 @@ msgid ""
"You are using Tor and it looks like you have this external IP address: "
"{ip_address}"
msgstr ""
"Koristis Tor i izgleda da je ovo tvoja externlana IP addresa : {ip_address}"
#: searx/plugins/tor_check.py:86
msgid "You are not using Tor and you have this external IP address: {ip_address}"
@ -1564,4 +1567,3 @@ msgstr "сакриј видео"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -14,26 +14,28 @@
# mikni <mikni@proton.me>, 2022.
# robert <robert.paegelow@gmail.com>, 2022.
# tygyh <jonis9898@hotmail.com>, 2023.
# return42 <markus.heiser@darmarit.de>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-08 09:24+0000\n"
"PO-Revision-Date: 2023-02-28 22:04+0000\n"
"Last-Translator: tygyh <jonis9898@hotmail.com>\n"
"PO-Revision-Date: 2023-05-01 07:37+0000\n"
"Last-Translator: return42 <markus.heiser@darmarit.de>\n"
"Language-Team: Swedish <https://translate.codeberg.org/projects/searxng/"
"searxng/sv/>\n"
"Language: sv\n"
"Language-Team: Swedish "
"<https://translate.codeberg.org/projects/searxng/searxng/sv/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Generated-By: Babel 2.12.1\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
#: searx/searxng.msg
msgid "without further subgrouping"
msgstr ""
msgstr "utan ytterligare undergruppering"
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
#: searx/searxng.msg
@ -73,7 +75,7 @@ msgstr "videor"
#. CATEGORY_NAMES['IT']
#: searx/searxng.msg
msgid "it"
msgstr "det"
msgstr "it"
#. CATEGORY_NAMES['NEWS']
#: searx/searxng.msg
@ -544,11 +546,11 @@ msgstr "Visa felmeddelande och skicka en bugrapport"
#: searx/templates/simple/preferences.html:35
msgid "!bang for this engine"
msgstr ""
msgstr "!bang för denna sökmotor"
#: searx/templates/simple/preferences.html:36
msgid "!bang for its categories"
msgstr ""
msgstr "!bang för deras kategorier"
#: searx/templates/simple/preferences.html:54
#: searx/templates/simple/stats.html:64
@ -787,6 +789,8 @@ msgid ""
"This tab dues not exists in the user interface, but you can search in "
"these engines by its !bangs."
msgstr ""
"Den här fliken finns inte i gränssnittet, men du kan söka i dessa sökmotorer "
"med deras !bangs."
#: searx/templates/simple/preferences.html:311
#: searx/templates/simple/preferences.html:365
@ -800,7 +804,7 @@ msgstr "Sökmotorns namn"
#: searx/templates/simple/preferences.html:313
msgid "Bang"
msgstr ""
msgstr "!bang"
#: searx/templates/simple/preferences.html:314
msgid "Supports selected language"
@ -1581,4 +1585,3 @@ msgstr "göm video"
#~ msgid "!bang"
#~ msgstr ""

View file

@ -6,6 +6,7 @@ from searx.query import RawTextQuery
from searx.engines import categories, engines
from searx.search import SearchQuery, EngineRef
from searx.preferences import Preferences, is_locked
from searx.utils import detect_language
# remove duplicate queries.
@ -214,7 +215,27 @@ def parse_engine_data(form):
def get_search_query_from_webapp(
preferences: Preferences, form: Dict[str, str]
) -> Tuple[SearchQuery, RawTextQuery, List[EngineRef], List[EngineRef]]:
) -> Tuple[SearchQuery, RawTextQuery, List[EngineRef], List[EngineRef], str]:
"""Assemble data from preferences and request.form (from the HTML form) needed
in a search query.
The returned tuple consits of:
1. instance of :py:obj:`searx.search.SearchQuery`
2. instance of :py:obj:`searx.query.RawTextQuery`
3. list of :py:obj:`searx.search.EngineRef` instances
4. string with the *selected locale* of the query
About language/locale: if the client selects the alias ``auto`` the
``SearchQuery`` object is build up by the :py:obj:`detected language
<searx.utils.detect_language>`. If language recognition does not have a
match the language preferred by the :py:obj:`Preferences.client` is used.
If client does not have a preference, the default ``all`` is used.
The *selected locale* in the tuple always represents the selected
language/locale and might differ from the language recognition.
"""
# no text for the query ?
if not form.get('q'):
raise SearxParameterException('q', '')
@ -229,13 +250,19 @@ def get_search_query_from_webapp(
# set query
query = raw_text_query.getQuery()
query_pageno = parse_pageno(form)
query_lang = parse_lang(preferences, form, raw_text_query)
query_safesearch = parse_safesearch(preferences, form)
query_time_range = parse_time_range(form)
query_timeout = parse_timeout(form, raw_text_query)
external_bang = raw_text_query.external_bang
engine_data = parse_engine_data(form)
query_lang = parse_lang(preferences, form, raw_text_query)
selected_locale = query_lang
if query_lang == 'auto':
query_lang = detect_language(query, threshold=0.8, only_search_languages=True)
query_lang = query_lang or preferences.client.locale_tag or 'all'
if not is_locked('categories') and raw_text_query.specific:
# if engines are calculated from query,
# set categories by using that information
@ -265,4 +292,5 @@ def get_search_query_from_webapp(
raw_text_query,
query_engineref_list_unknown,
query_engineref_list_notoken,
selected_locale,
)

View file

@ -84,6 +84,7 @@ from searx.webutils import (
from searx.webadapter import (
get_search_query_from_webapp,
get_selected_categories,
parse_lang,
)
from searx.utils import (
html_to_text,
@ -96,6 +97,7 @@ from searx.plugins import Plugin, plugins, initialize as plugin_initialize
from searx.plugins.oa_doi_rewrite import get_doi_resolver
from searx.preferences import (
Preferences,
ClientPref,
ValidationException,
)
from searx.answerers import (
@ -221,16 +223,9 @@ babel = Babel(app, locale_selector=get_locale)
def _get_browser_language(req, lang_list):
for lang in req.headers.get("Accept-Language", "en").split(","):
if ';' in lang:
lang = lang.split(';')[0]
if '-' in lang:
lang_parts = lang.split('-')
lang = "{}-{}".format(lang_parts[0], lang_parts[-1].upper())
locale = match_locale(lang, lang_list, fallback=None)
if locale is not None:
client = ClientPref.from_http_request(req)
locale = match_locale(client.locale_tag, lang_list, fallback='en')
return locale
return 'en'
def _get_locale_rfc5646(locale):
@ -446,11 +441,7 @@ def render(template_name: str, **kwargs):
kwargs['rtl'] = True
if 'current_language' not in kwargs:
_locale = request.preferences.get_value('language')
if _locale in ('auto', 'all'):
kwargs['current_language'] = _locale
else:
kwargs['current_language'] = match_locale(_locale, settings['search']['languages'])
kwargs['current_language'] = parse_lang(request.preferences, {}, RawTextQuery('', []))
# values from settings
kwargs['search_formats'] = [x for x in settings['search']['formats'] if x != 'html']
@ -512,7 +503,10 @@ def pre_request():
request.timings = [] # pylint: disable=assigning-non-slot
request.errors = [] # pylint: disable=assigning-non-slot
preferences = Preferences(themes, list(categories.keys()), engines, plugins) # pylint: disable=redefined-outer-name
client_pref = ClientPref.from_http_request(request)
# pylint: disable=redefined-outer-name
preferences = Preferences(themes, list(categories.keys()), engines, plugins, client_pref)
user_agent = request.headers.get('User-Agent', '').lower()
if 'webkit' in user_agent and 'android' in user_agent:
preferences.key_value_settings['method'].value = 'GET'
@ -681,7 +675,9 @@ def search():
raw_text_query = None
result_container = None
try:
search_query, raw_text_query, _, _ = get_search_query_from_webapp(request.preferences, request.form)
search_query, raw_text_query, _, _, selected_locale = get_search_query_from_webapp(
request.preferences, request.form
)
# search = Search(search_query) # without plugins
search = SearchWithPlugins(search_query, request.user_plugins, request) # pylint: disable=redefined-outer-name
@ -812,13 +808,6 @@ def search():
)
)
if search_query.lang in ('auto', 'all'):
current_language = search_query.lang
else:
current_language = match_locale(
search_query.lang, settings['search']['languages'], fallback=request.preferences.get_value("language")
)
# search_query.lang contains the user choice (all, auto, en, ...)
# when the user choice is "auto", search.search_query.lang contains the detected language
# otherwise it is equals to search_query.lang
@ -841,7 +830,7 @@ def search():
result_container.unresponsive_engines
),
current_locale = request.preferences.get_value("locale"),
current_language = current_language,
current_language = selected_locale,
search_language = match_locale(
search.search_query.lang,
settings['search']['languages'],