mirror of https://github.com/searxng/searxng.git
[mod] move category and names of constants to searx/searxng.msg
Closes: https://github.com/searxng/searxng/issues/814 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
b9cf3c82a1
commit
784bf9ed15
|
@ -3,7 +3,7 @@
|
|||
"""This module implements the :origin:`searxng_msg <babel.cfg>` extractor to
|
||||
extract messages from:
|
||||
|
||||
- None
|
||||
- :origin:`searx/searxng.msg`
|
||||
|
||||
The ``searxng.msg`` files are selected by Babel_, see Babel's configuration in
|
||||
:origin:`babel.cfg`::
|
||||
|
@ -25,7 +25,7 @@ A ``searxng.msg`` file is a python file that is *executed* by the
|
|||
from os import path
|
||||
|
||||
SEARXNG_MSG_FILE = "searxng.msg"
|
||||
_MSG_FILES = []
|
||||
_MSG_FILES = [path.join(path.dirname(__file__), SEARXNG_MSG_FILE)]
|
||||
|
||||
|
||||
def extract(
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
# -*- mode: python -*-
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
"""A SearXNG message file, see :py:obj:`searx.babel`
|
||||
"""
|
||||
|
||||
from searx import webutils
|
||||
from searx import engines
|
||||
|
||||
__all__ = [
|
||||
'CONSTANT_NAMES',
|
||||
'CATEGORY_NAMES',
|
||||
'CATEGORY_GROUPS',
|
||||
'STYLE_NAMES',
|
||||
]
|
||||
|
||||
CONSTANT_NAMES = {
|
||||
# Constants defined in other modules
|
||||
'DEFAULT_GROUP_NAME': webutils.DEFAULT_GROUP_NAME,
|
||||
'OTHER_CATEGORY': engines.OTHER_CATEGORY,
|
||||
}
|
||||
|
||||
CATEGORY_NAMES = {
|
||||
'FILES': 'files',
|
||||
'GENERAL': 'general',
|
||||
'MUSIC': 'music',
|
||||
'SOCIAL_MEDIA': 'social media',
|
||||
'IMAGES': 'images',
|
||||
'VIDEOS': 'videos',
|
||||
'IT': 'it',
|
||||
'NEWS': 'news',
|
||||
'MAP': 'map',
|
||||
'ONIONS': 'onions',
|
||||
'SCIENCE': 'science',
|
||||
}
|
||||
|
||||
CATEGORY_GROUPS = {
|
||||
# non-tab categories
|
||||
'APPS': 'apps',
|
||||
'DICTIONARIES': 'dictionaries',
|
||||
'LYRICS': 'lyrics',
|
||||
'PACKAGES': 'packages',
|
||||
'Q_A': 'q&a',
|
||||
'REPOS': 'repos',
|
||||
'SOFTWARE_WIKIS': 'software wikis',
|
||||
'WEB': 'web',
|
||||
}
|
||||
|
||||
STYLE_NAMES = {
|
||||
'AUTO': 'auto',
|
||||
'LIGHT': 'light',
|
||||
'DARK': 'dark',
|
||||
}
|
|
@ -80,7 +80,6 @@ from searx.webutils import (
|
|||
new_hmac,
|
||||
is_hmac_of,
|
||||
is_flask_run_cmdline,
|
||||
DEFAULT_GROUP_NAME,
|
||||
group_engines_in_tab,
|
||||
)
|
||||
from searx.webadapter import (
|
||||
|
@ -166,35 +165,6 @@ app.secret_key = settings['server']['secret_key']
|
|||
|
||||
babel = Babel(app)
|
||||
|
||||
# used when translating category names
|
||||
_category_names = (
|
||||
gettext('files'),
|
||||
gettext('general'),
|
||||
gettext('music'),
|
||||
gettext('social media'),
|
||||
gettext('images'),
|
||||
gettext('videos'),
|
||||
gettext('it'),
|
||||
gettext('news'),
|
||||
gettext('map'),
|
||||
gettext('onions'),
|
||||
gettext('science'),
|
||||
# non-tab categories
|
||||
gettext('apps'),
|
||||
gettext('dictionaries'),
|
||||
gettext('lyrics'),
|
||||
gettext('packages'),
|
||||
gettext('q&a'),
|
||||
gettext('repos'),
|
||||
gettext('software wikis'),
|
||||
gettext('web'),
|
||||
gettext(DEFAULT_GROUP_NAME),
|
||||
gettext(OTHER_CATEGORY),
|
||||
)
|
||||
|
||||
_simple_style = (gettext('auto'), gettext('light'), gettext('dark'))
|
||||
|
||||
#
|
||||
timeout_text = gettext('timeout')
|
||||
parsing_error_text = gettext('parsing error')
|
||||
http_protocol_error_text = gettext('HTTP protocol error')
|
||||
|
|
Loading…
Reference in New Issue